Repository navigation
StorageManager tech debt 1/6: remove unused methods, fields and return values - #13598
DaanHoogland wants to merge 1 commit into
Conversation
|
@blueorangutan package |
|
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
There was a problem hiding this comment.
Pull request overview
This PR addresses tech debt in the storage management area (Fixes #12316) by removing unused code paths, tightening type usage, and consolidating configuration access via ConfigKey/ConfigurationManager while standardizing logging.
Changes:
- Refactors
StorageManagerImplto remove unused methods/fields, reduce raw types, and modernize logging and collection checks. - Moves several global configuration keys from
Configenum usage towardConfigurationManager/StorageManagerConfigKeys and updates call sites (including Swift/S3 drivers). - Cleans up API command/service signatures to align with the refactors (generics, removed obsolete checked exceptions, minor code simplifications).
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| server/src/main/java/com/cloud/storage/StorageManagerImpl.java | Core refactor: remove unused code, generics cleanup, logging updates, config usage changes. |
| server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java | Exposes newly added ConfigurationManager config keys via getConfigKeys(). |
| server/src/main/java/com/cloud/configuration/Config.java | Removes several config enum entries migrated to ConfigKey locations. |
| plugins/storage/image/swift/src/main/java/org/apache/cloudstack/storage/datastore/driver/SwiftImageStoreDriverImpl.java | Uses ConfigurationManager ConfigKey for extract URL expiry; logging/generics cleanup. |
| plugins/storage/image/s3/src/main/java/org/apache/cloudstack/storage/datastore/driver/S3ImageStoreDriverImpl.java | Uses ConfigurationManager ConfigKey for extract URL expiry; logging cleanup. |
| engine/storage/cache/src/main/java/org/apache/cloudstack/storage/cache/manager/StorageCacheManagerImpl.java | Switches expunge worker count to ConfigurationManager.ExpungeWorkers. |
| engine/components-api/src/main/java/com/cloud/storage/StorageManager.java | Removes unused API surface; adds disk throttling ConfigKeys and minor boolean cleanup. |
| engine/components-api/src/main/java/com/cloud/configuration/ConfigurationManager.java | Introduces expunge/extract URL related ConfigKeys. |
| api/src/main/java/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java | Simplifies execute flow after service signature change. |
| api/src/main/java/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java | Adjusts details map typing to reduce raw/unchecked usage. |
| api/src/main/java/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java | Formatting cleanup and removes obsolete exception handling. |
| api/src/main/java/org/apache/cloudstack/api/command/admin/storage/AddImageStoreS3CMD.java | Simplifies execute flow and generics; API command annotation adjusted. |
| api/src/main/java/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java | Simplifies details extraction loop and execute flow. |
| api/src/main/java/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java | Simplifies execute flow after service signature change. |
| api/src/main/java/com/cloud/storage/StorageService.java | Tightens generics and removes obsolete checked exceptions from API surface. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (logger.isDebugEnabled()) { | ||
| logger.debug("Failed to add object store: " + e.getMessage(), e); | ||
| logger.debug("Failed to add object store: {}", e.getMessage(), e); | ||
| } | ||
| throw new CloudRuntimeException("Failed to add object store: " + e.getMessage(), e); | ||
| throw new CloudRuntimeException("Failed to add object store: {}" + e.getMessage(), e); | ||
| } |
| DataStoreDownloadFollowRedirects, | ||
| AllowVolumeReSizeBeyondAllocation, | ||
| StoragePoolHostConnectWorkers, | ||
| ObjectStorageCapacityThreshold, | ||
| COPY_TEMPLATES_FROM_OTHER_SECONDARY_STORAGES | ||
| ObjectStorageCapacityThreshold |
| ConfigKey<Integer> VmDiskThrottlingIopsReadRate = new ConfigKey<>( | ||
| Integer.class, | ||
| "vm.disk.throttling.iops_read_rate", | ||
| "Storage", | ||
| "0", |
| ConfigKey<Integer> VmDiskThrottlingIopsWriteRate = new ConfigKey<>( | ||
| Integer.class, | ||
| "vm.disk.throttling.iops_write_rate", | ||
| "Storage", | ||
| "0", |
| ConfigKey<Integer> VmDiskThrottlingBytesReadRate = new ConfigKey<>( | ||
| Integer.class, | ||
| "vm.disk.throttling.bytes_read_rate", | ||
| "Storage", | ||
| "0", |
| ConfigKey.CATEGORY_ADVANCED, | ||
| Integer.class, | ||
| "expunge.workers", | ||
| "10", |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13598 +/- ##
==========================================
Coverage 20.76% 20.77%
- Complexity 21903 21906 +3
==========================================
Files 6496 6496
Lines 591612 591486 -126
Branches 72585 72561 -24
==========================================
+ Hits 122851 122861 +10
+ Misses 455424 455288 -136
Partials 13337 13337
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18550 |
|
🔴 Test Coverage Grade:
|
| Metric | Value |
|---|---|
| Line coverage | 24.31% |
| Branch coverage | 18.45% |
Grade Scale
| Grade | Line Coverage | Meaning |
|---|---|---|
| 🟢 A | ≥ 80% | Excellent - this code sleeps well at night 😴 |
| 🟡 B | 60-79% | Good - almost there, don't stop now 😉 |
| 🟠 C | 40-59% | Acceptable - your code is wearing a seatbelt, but no airbags 😬 |
| 🔴 D | 20-39% | Marginal - boldly shipping where no test has gone before 🖖 |
| ⛔ F | < 20% | Failing - tests? what tests? 🔥 |
Branch coverage is shown as a secondary signal. Grade is determined by line coverage.
View full Actions run
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
| throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); | ||
| ImageStore result = _storageService.discoverImageStore(null, getUrl(), "NFS", getZoneId(), getDetails()); | ||
| ImageStoreResponse storeResponse = null; | ||
| if (result != null ) { |
There was a problem hiding this comment.
@DaanHoogland can we invert the logic to reduce identation?
There was a problem hiding this comment.
not my style, but I’ll have to revisit anyway because of conflicts :/ later..
| throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); | ||
| ImageStore result = _storageService.discoverImageStore(getName(), getUrl(), getProviderName(), getZoneId(), getDetails()); | ||
| ImageStoreResponse storeResponse; | ||
| if (result != null) { |
| throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); | ||
| ImageStore result = _storageService.discoverImageStore(null, null, "S3", null, dm); | ||
| ImageStoreResponse storeResponse; | ||
| if (result != null) { |
| throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); | ||
| ImageStore result = _storageService.discoverImageStore(null, getUrl(), "Swift", null, dm); | ||
| ImageStoreResponse storeResponse; | ||
| if (result != null) { |
|
🔴 Test Coverage Grade:
|
| Metric | Value |
|---|---|
| Line coverage | 25.88% |
| Branch coverage | 20.21% |
Grade Scale
| Grade | Line Coverage | Meaning |
|---|---|---|
| 🟢 A | ≥ 80% | Excellent - this code sleeps well at night 😴 |
| 🟡 B | 60-79% | Good - almost there, don't stop now 😉 |
| 🟠 C | 40-59% | Acceptable - your code is wearing a seatbelt, but no airbags 😬 |
| 🔴 D | 20-39% | Marginal - boldly shipping where no test has gone before 🖖 |
| ⛔ F | < 20% | Failing - tests? what tests? 🔥 |
Branch coverage is shown as a secondary signal. Grade is determined by line coverage.
View full Actions run
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
50ddab2 to
ea758d7
Compare
Part of #12316 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ea758d7 to
58eae14
Compare
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
7 open issues
ChangingupdateSecondaryStoragefrom returningHosttovoidis a binary-incompatible change… · Newexpunge.workersdefault changed from 1 (previous Config enum default) to 10 here. That increases…COPY_TEMPLATES_FROM_OTHER_SECONDARY_STORAGESis still a StorageManager ConfigKey and is used… The thrown CloudRuntimeException message concatenates a literal "{}" placeholder with the exception… These disk throttling config keys were historically categorized under "Advanced" (see db schema… These disk throttling config keys were historically categorized under "Advanced" (see db schema… These disk throttling config keys were historically categorized under "Advanced" (see db schema…
3 resolved since last review
Review effort: Lite
| Host getHost(long hostId); | ||
|
|
||
| Host updateSecondaryStorage(long secStorageId, String newUrl); | ||
| void updateSecondaryStorage(long secStorageId, String newUrl); |
|








Description
Stack for #12316 (StorageManager tech debt), one PR per item of the issue checklist, review only the top commit of each:
SearchCriteria.addAndusagesThis PR (1/6) removes code in
StorageManager/StorageManagerImplthat has no callers anywhere in the repo:share,chooseHostForStoragePool,isPoolAvailable,findAllSnapshotForVolume,findAllVolumeIdInSnapshotTable,getPrimaryStorageNameLabel,ListByDataCenterHypervisor,canDisconnectHostFromStoragePool,poolProvidesCustomStorageStats,getCustomStorageStats, and the_discoverersfield with its accessors_configServer,storageService,storageManager,_serviceOfferingDetailsDao)updateSecondaryStoragenow returnsvoid(its only caller ignored theHost)The Config→ConfigKey migration that an earlier version of this PR contained has been dropped, because it duplicated #14467.
Part of #12316
Types of changes
🤖 Generated with Claude Code