-
Notifications
You must be signed in to change notification settings - Fork 1.2k
address warnings in capacity manager #11971
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11971 +/- ##
======================================
Coverage 3.58% 3.58%
======================================
Files 445 445
Lines 37552 37552
Branches 6914 6914
======================================
Hits 1347 1347
Misses 36039 36039
Partials 166 166
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
d3ec59b to
7e2c34f
Compare
|
@blueorangutan package |
|
@DaanHoogland 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. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15951 |
|
@blueorangutan test |
|
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
7e2c34f to
7a6692d
Compare
|
There was a problem hiding this 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 removes compiler warnings from the CapacityManagerImpl class by cleaning up unused imports, removing dead code, eliminating unnecessary variable initializations and boxing/unboxing operations, and adding explicit casts to address lossy conversion warnings.
- Removed unused imports (StartupRoutingCommand, SearchCriteria)
- Removed dead code (empty stop() method, unreachable return statement, createCapacityEntry() method)
- Eliminated unnecessary boxing/unboxing operations (Float to float conversions, removed redundant .intValue()/.longValue() calls)
- Added explicit (long) casts to fix lossy conversion warnings in floating-point arithmetic
- Removed redundant local variables and simplified return statements
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| reservedCpu += | ||
| ((Integer.parseInt(vmDetails.get(UsageEventVO.DynamicParameters.cpuNumber.name())) * Integer.parseInt(vmDetails.get(UsageEventVO.DynamicParameters.cpuSpeed.name()))) / cpuOvercommitRatio) * | ||
| clusterCpuOvercommitRatio; | ||
| (long) (((Long.parseLong(vmDetails.get(UsageEventVO.DynamicParameters.cpuNumber.name())) * Integer.parseInt(vmDetails.get(UsageEventVO.DynamicParameters.cpuSpeed.name()))) / cpuOvercommitRatio) * |
Copilot
AI
Dec 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent parsing method used for cpuNumber parameter. This line uses Long.parseLong() while the similar code at line 713 (for used capacity calculation) uses Integer.parseInt() for the same parameter. For consistency and correctness, both should use the same parsing method, preferably Integer.parseInt() since cpuNumber is used as an integer elsewhere in the code (e.g., lines 721, 765).
| reservedCpu += | ||
| ((Integer.parseInt(vmDetails.get(UsageEventVO.DynamicParameters.cpuNumber.name())) * so.getSpeed()) / cpuOvercommitRatio) * | ||
| clusterCpuOvercommitRatio; | ||
| (long) (((Long.parseLong(vmDetails.get(UsageEventVO.DynamicParameters.cpuNumber.name())) * so.getSpeed()) / cpuOvercommitRatio) * |
Copilot
AI
Dec 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent parsing method used for cpuNumber parameter. This line uses Long.parseLong() while the similar code at line 718 (for used capacity calculation) uses Integer.parseInt() for the same parameter. For consistency and correctness, both should use the same parsing method, preferably Integer.parseInt() since cpuNumber is used as an integer elsewhere in the code (e.g., lines 721, 765).


Description
This PR cleans the CapacityManagerImpl class from compiler warning ...
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?
regression testing only