Skip to content

StorageManager tech debt: remove unused methods, fields and return values - #13598

Open
DaanHoogland wants to merge 1 commit into
mainfrom
ghi12316-storageManagerTechDebt
Open

DaanHoogland wants to merge 1 commit into
mainfrom
ghi12316-storageManagerTechDebt

Conversation

@DaanHoogland

@DaanHoogland DaanHoogland commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Description

Removes code in StorageManager/StorageManagerImpl that has no callers anywhere in the repo:

  • methods share, chooseHostForStoragePool, isPoolAvailable, findAllSnapshotForVolume, findAllVolumeIdInSnapshotTable, getPrimaryStorageNameLabel, ListByDataCenterHypervisor, canDisconnectHostFromStoragePool, poolProvidesCustomStorageStats, getCustomStorageStats, and the _discoverers field with its accessors
  • unused injected fields (_configServer, storageService, storageManager, _serviceOfferingDetailsDao)
  • updateSecondaryStorage now returns void (its only caller ignored the Host)

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

  • Cleanup (Code refactoring and cleanup, that may add test cases)

🤖 Generated with Claude Code

@DaanHoogland

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 StorageManagerImpl to remove unused methods/fields, reduce raw types, and modernize logging and collection checks.
  • Moves several global configuration keys from Config enum usage toward ConfigurationManager/StorageManager ConfigKeys 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.

Comment on lines 4477 to 4481
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);
}
@codecov

codecov Bot commented Jul 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 20.78%. Comparing base (fb60564) to head (07a100a).

Files with missing lines Patch % Lines
...ain/java/com/cloud/storage/StorageManagerImpl.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #13598      +/-   ##
============================================
- Coverage     20.78%   20.78%   -0.01%     
+ Complexity    21931    21927       -4     
============================================
  Files          6496     6496              
  Lines        591657   591531     -126     
  Branches      72592    72568      -24     
============================================
- Hits         122966   122925      -41     
+ Misses       455346   455269      -77     
+ Partials      13345    13337       -8     
Flag Coverage Δ
uitests 3.88% <ø> (ø)
unittests 22.09% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18550

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
8.5% Coverage on New Code (required ≥ 40%)

See analysis details on SonarQube Cloud

@github-actions

Copy link
Copy Markdown

🔴 Test Coverage Grade: D — Marginal

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

@github-actions

Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@DaanHoogland
DaanHoogland marked this pull request as draft July 20, 2026 11:27
@DaanHoogland DaanHoogland self-assigned this Jul 20, 2026
@DaanHoogland DaanHoogland moved this from Backlog to conflict/waiting for author in CloudStack Testing Aug 31, 2026
@sonarqubecloud

sonarqubecloud Bot commented Sep 7, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
8.3% Coverage on New Code (required ≥ 40%)

See analysis details on SonarQube Cloud

@github-actions

github-actions Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

🔴 Test Coverage Grade: D — Marginal

Metric Value
Line coverage 25.89%
Branch coverage 20.22%

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

@github-actions

Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@DaanHoogland
DaanHoogland force-pushed the ghi12316-storageManagerTechDebt branch from 50ddab2 to ea758d7 Compare November 2, 2026 13:20
@DaanHoogland
DaanHoogland force-pushed the ghi12316-storageManagerTechDebt branch from ea758d7 to 58eae14 Compare November 2, 2026 14:30
@DaanHoogland DaanHoogland changed the title Deal with Storage Manager tech debt StorageManager tech debt 1/5: remove unused methods, fields and return values Nov 2, 2026
@DaanHoogland
DaanHoogland added this pull request to stack #14563 November 2, 2026 14:31
@DaanHoogland
DaanHoogland marked this pull request as ready for review November 2, 2026 14:31
Copilot AI balanced review requested due to automatic review settings November 2, 2026 14:31
@DaanHoogland DaanHoogland linked an issue Nov 2, 2026 that may be closed by this pull request
7 tasks done

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DaanHoogland DaanHoogland changed the title StorageManager tech debt 1/5: remove unused methods, fields and return values StorageManager tech debt 1/6: remove unused methods, fields and return values Nov 2, 2026
Part of #12316

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DaanHoogland
DaanHoogland force-pushed the ghi12316-storageManagerTechDebt branch from 58eae14 to 07a100a Compare November 6, 2026 11:36
Copilot AI balanced review requested due to automatic review settings November 6, 2026 11:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@sonarqubecloud

sonarqubecloud Bot commented Nov 6, 2026

Copy link
Copy Markdown

@DaanHoogland DaanHoogland changed the title StorageManager tech debt 1/6: remove unused methods, fields and return values StorageManager tech debt: remove unused methods, fields and return values Nov 6, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: conflict/waiting

Development

Successfully merging this pull request may close these issues.

deal with tech debt in StorageManager(Impl)

4 participants