Skip to content

config cleanup - #13884

Open
DaanHoogland wants to merge 49 commits into
mainfrom
ghi10752-configCleanup
Open

config cleanup#13884
DaanHoogland wants to merge 49 commits into
mainfrom
ghi10752-configCleanup

Conversation

@DaanHoogland

Copy link
Copy Markdown
Contributor

Description

This PR tries to get rid of the Config enum or the old mechanism to define configuration items, which is long overdue. The change should be transparent, but is huge so good regression testing is required. And merg early in the release cycle is recommended.
Commits are being done in batches for review convenience. They could have been done in separate PRs but in the end the changes are rather trivial.

Fixes: #10752

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

This comment was marked as duplicate.

@codecov

codecov Bot commented Aug 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 41.53005% with 428 lines in your changes missing coverage. Please review.
✅ Project coverage is 19.79%. Comparing base (e9dbb5e) to head (26780fd).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...java/com/cloud/server/ConfigurationServerImpl.java 0.00% 46 Missing ⚠️
.../cloud/resourcelimit/ResourceLimitManagerImpl.java 0.00% 31 Missing ⚠️
...oud/network/lb/ElasticLoadBalancerManagerImpl.java 5.55% 17 Missing ⚠️
.../cloud/configuration/ConfigurationManagerImpl.java 42.30% 13 Missing and 2 partials ⚠️
...ork/router/VirtualNetworkApplianceManagerImpl.java 0.00% 13 Missing ⚠️
...isor/xenserver/discoverer/XcpServerDiscoverer.java 0.00% 11 Missing ⚠️
...ava/com/cloud/network/NetworkUsageManagerImpl.java 0.00% 10 Missing ⚠️
...rc/main/java/com/cloud/usage/UsageServiceImpl.java 0.00% 10 Missing ⚠️
...oud/network/ExternalFirewallDeviceManagerImpl.java 0.00% 9 Missing ⚠️
...ain/java/com/cloud/network/NetworkServiceImpl.java 0.00% 9 Missing ⚠️
... and 100 more
Additional details and impacted files
@@            Coverage Diff            @@
##               main   #13884   +/-   ##
=========================================
  Coverage     19.78%   19.79%           
- Complexity    19995    20018   +23     
=========================================
  Files          6371     6387   +16     
  Lines        575907   575888   -19     
  Branches      70496    70474   -22     
=========================================
+ Hits         113956   114000   +44     
+ Misses       449520   449453   -67     
- Partials      12431    12435    +4     
Flag Coverage Δ
uitests 3.53% <ø> (ø)
unittests 21.07% <41.53%> (+<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.

@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown

🔴 Test Coverage Grade: D — Marginal

Metric Value
Line coverage 24.69%
Branch coverage 18.92%

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 comment was marked as duplicate.

Copilot AI review requested due to automatic review settings August 15, 2026 15:49

This comment was marked as duplicate.

Copilot AI review requested due to automatic review settings August 15, 2026 16:07

This comment was marked as duplicate.

Copilot AI review requested due to automatic review settings August 15, 2026 19:40
Daan Hoogland and others added 25 commits September 8, 2026 12:41
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@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.

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.

Pull request overview

Copilot reviewed 166 out of 166 changed files in this pull request and generated 2 comments.

Suppressed comments (5)

server/src/test/java/com/cloud/api/response/ApiResponseSerializerTest.java:1

  • This test mutates the static ConfigKey default value via reflection but does not restore the previous value, which can leak into other tests and create ordering-dependent failures. Capture the original _defaultValue before overriding and restore it in @After (or in a try/finally around each override) to keep the test suite isolated.
    server/src/test/java/com/cloud/resource/DiscovererBaseTest.java:1
  • Like other new tests in this PR, this test mutates ConfigKey._defaultValue via reflection without restoring it afterward. To avoid cross-test pollution, store the original values and restore them in an @After method (or use a try/finally around the overrides).
    plugins/storage/image/s3/src/main/java/org/apache/cloudstack/storage/datastore/driver/S3ImageStoreDriverImpl.java:1
  • After switching to typed ConfigKey access (.value()), this code no longer parses a string, so NumberFormatException cannot be thrown here. The try/catch is now dead code and can be removed; if you still need a fallback, handle null/invalid values at the ConfigKey level (defaults) or explicitly guard for null.
    server/src/main/java/com/cloud/storage/download/DownloadMonitorImpl.java:1
  • With typed config (MaxUploadVolumeSize.value()), there is no string parsing anymore, so NumberFormatException will never be thrown and these try/catch blocks are redundant. Simplify by removing the try/catch; if value() can ever be null in your config framework, explicitly handle null to avoid returning null only on an exception that can’t occur.
    plugins/network-elements/elastic-loadbalancer/src/main/java/com/cloud/network/lb/ElasticLoadBalancerManager.java:1
  • The defaults and comments are internally inconsistent: DEFAULT_ELB_VM_RAMSIZE is 128 but commented as 512 MB, while the new ElasticLoadBalancerVmMemory default is 512; similarly CPU constant is 256 but the config default is 128. This can lead to unintended behavior changes during the config migration. Align the constants, comments, and ConfigKey defaults to the intended historical defaults (and consider removing/deriving the constants if the ConfigKey is now the single source of truth).

Comment on lines +150 to +152
ConfigKey<String> NetworkLBHaproxyStatsAuth = new ConfigKey<>("Secure", String.class,
"network.loadbalancer.haproxy.stats.auth", "admin1:AdMiN123",
"Load Balancer(haproxy) authentication string in the format username:password", true);
boolean _sslCopy = false;
String sslCfg = _configDao.getValue(Config.SecStorageEncryptCopy.toString());
boolean _sslCopy = SecondaryStorageVmManager.SecStorageEncryptCopy.value();
String _ssvmUrlDomain = _configDao.getValue("secstorage.ssl.cert.domain");
@blueorangutan

Copy link
Copy Markdown

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

@sonarqubecloud

sonarqubecloud Bot commented Sep 8, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
26.3% Coverage on New Code (required ≥ 40%)
C Reliability Rating on New Code (required ≥ B)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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.

phase out enum Config

4 participants