Skip to content

Configuration settings validation improvements #10998

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: 4.19
Choose a base branch
from

Conversation

sureshanaparti
Copy link
Contributor

@sureshanaparti sureshanaparti commented Jun 10, 2025

Description

This PR improves configuration settings validation and some code refactoring.

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?

@sureshanaparti
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

Copy link

codecov bot commented Jun 10, 2025

Codecov Report

Attention: Patch coverage is 41.02564% with 23 lines in your changes missing coverage. Please review.

Project coverage is 15.18%. Comparing base (0d5a0ea) to head (b7a23e2).

Files with missing lines Patch % Lines
.../cloud/configuration/ConfigurationManagerImpl.java 35.29% 20 Missing and 2 partials ⚠️
...om/cloud/network/firewall/FirewallManagerImpl.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.19   #10998   +/-   ##
=========================================
  Coverage     15.18%   15.18%           
+ Complexity    11365    11364    -1     
=========================================
  Files          5416     5417    +1     
  Lines        475890   475906   +16     
  Branches      58093    58097    +4     
=========================================
+ Hits          72254    72260    +6     
- Misses       395550   395560   +10     
  Partials       8086     8086           
Flag Coverage Δ
uitests 4.28% <ø> (ø)
unittests 15.91% <41.02%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 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

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

@sureshanaparti sureshanaparti requested a review from Copilot June 10, 2025 12:03
Copy link

@Copilot Copilot AI left a comment

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 enhances configuration settings validation and cleans up redundant configuration declarations, while refactoring related validation logic. Key changes include:

  • Removal of duplicate configuration keys and unused variables.
  • Improvements in type handling, especially for Boolean and Double values.
  • Refactoring of configuration value parsing by introducing a helper method for consistent error messaging.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
server/src/main/java/com/cloud/storage/ImageStoreServiceImpl.java Removed unused ConfigKey and variable declarations for image storage imbalance threshold.
server/src/main/java/com/cloud/network/firewall/FirewallManagerImpl.java Updated Boolean parsing to better handle null values.
server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java Refactored configuration validation logic with a new helper method; added range checking for Double values.
server/src/main/java/com/cloud/configuration/Config.java Updated configuration type for load balancer enabled flag from String to Boolean.
plugins/database/quota/.../QuotaResponseBuilderImpl.java Adjusted config value handling to use Boolean directly.
framework/quota/.../QuotaConfig.java Updated types for quota configuration keys from String to Boolean.
engine/orchestration/.../StorageOrchestrator.java Removed redundant configuration key declaration.
engine/api/.../StorageOrchestrationService.java Centralized declaration of image store imbalance threshold via the interface.

if (type.equals(Double.class)) {
try {
final Double val = Double.parseDouble(value);
if (weightBasedParametersForValidation.contains(name) && (val < 0f || val > 1f)) {
Copy link
Preview

Copilot AI Jun 10, 2025

Choose a reason for hiding this comment

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

Consider using double literals (0.0 and 1.0) instead of float literals (0f and 1f) for clarity when comparing Double values.

Suggested change
if (weightBasedParametersForValidation.contains(name) && (val < 0f || val > 1f)) {
if (weightBasedParametersForValidation.contains(name) && (val < 0.0 || val > 1.0)) {

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants