Skip to content

Conversation

@sureshanaparti
Copy link
Contributor

Description

This PR improves the code for Autoscale VM load balancing rules.

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?

@codecov
Copy link

codecov bot commented Jan 16, 2026

Codecov Report

❌ Patch coverage is 8.69565% with 84 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.23%. Comparing base (5c1f931) to head (4b31782).
⚠️ Report is 2 commits behind head on 4.20.

Files with missing lines Patch % Lines
...loud/network/lb/LoadBalancingRulesManagerImpl.java 5.61% 82 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.20   #12446   +/-   ##
=========================================
  Coverage     16.23%   16.23%           
  Complexity    13380    13380           
=========================================
  Files          5657     5657           
  Lines        498996   499007   +11     
  Branches      60566    60560    -6     
=========================================
+ Hits          81011    81025   +14     
+ Misses       408951   408946    -5     
- Partials       9034     9036    +2     
Flag Coverage Δ
uitests 4.03% <ø> (ø)
unittests 17.09% <8.69%> (+<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.

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

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 performs code cleanup and improvements for the Autoscale VM load balancing rules implementation. The changes focus on improving code readability and maintainability through better naming conventions, use of modern Java syntax, and code simplification.

Changes:

  • Renamed DAO field variables to follow proper camelCase naming conventions (_lb2stickinesspoliciesDao_lb2StickinessPoliciesDao, _lb2healthcheckDao_lb2HealthCheckDao)
  • Modernized code by using diamond operators for generic type inference and simplifying conditional logic
  • Fixed spelling errors in code comments ("comparisions" → "comparison", "assoication" → "association")
  • Improved variable naming for better readability (e.g., priIpprimaryIp, lstVmIdvmIds, mapslb2VmMaps)

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java Renamed DAO fields to proper camelCase, applied diamond operators, improved variable naming, fixed spelling in comments, simplified conditional logic
server/src/test/java/com/cloud/network/lb/UpdateLoadBalancerTest.java Updated test mock setup to reflect renamed DAO fields
server/src/main/java/com/cloud/network/as/AutoScaleManagerImpl.java Improved variable naming from lstVmId to vmIds and applied diamond operator
engine/schema/src/main/java/com/cloud/network/dao/LoadBalancerVMMapDao.java Added blank line for better code formatting
engine/schema/src/main/java/com/cloud/network/dao/LoadBalancerVMMapDaoImpl.java Removed extra blank line for cleaner code formatting

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

_lb2VmMapDao.remove(lb.getId(), lbVmMapToRevoke.getInstanceId(), lbVmMapToRevoke.getInstanceIp(), null);
logger.debug("Load balancer rule {} is removed for Instance {} and IP {}",
lb, lbVmMap.getInstanceId(), lbVmMap.getInstanceIp());;
lb, lbVmMapToRevoke.getInstanceId(), lbVmMapToRevoke.getInstanceIp());;
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

Double semicolon at the end of the statement. Remove one semicolon.

Suggested change
lb, lbVmMapToRevoke.getInstanceId(), lbVmMapToRevoke.getInstanceIp());;
lb, lbVmMapToRevoke.getInstanceId(), lbVmMapToRevoke.getInstanceIp());

Copilot uses AI. Check for mistakes.
}
}
lstVmId.add(new Long(vmId));
vmIds.add(new Long(vmId));
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The explicit Long constructor call is unnecessary and deprecated. Use Long.valueOf(vmId) or simply add vmId directly since autoboxing will handle the conversion.

Suggested change
vmIds.add(new Long(vmId));
vmIds.add(vmId);

Copilot uses AI. Check for mistakes.
continue;
}
if(_nicSecondaryIpDao.findByIp4AddressAndNicId(ip,nicInSameNetwork.getId()) == null) {
if (_nicSecondaryIpDao.findByIp4AddressAndNicId(ip,nicInSameNetwork.getId()) == null) {
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

Missing space after comma in method call arguments. Add space after the comma for better readability.

Suggested change
if (_nicSecondaryIpDao.findByIp4AddressAndNicId(ip,nicInSameNetwork.getId()) == null) {
if (_nicSecondaryIpDao.findByIp4AddressAndNicId(ip, nicInSameNetwork.getId()) == null) {

Copilot uses AI. Check for mistakes.
map.setRevoke(true);
_lb2VmMapDao.persist(map);
logger.debug("Set load balancer rule for revoke: rule {}, vmId {}, vmip {}", loadBalancer::toString, () -> _vmDao.findById(instanceId), vmIp::toString);
logger.debug("Set load balancer rule for revoke: rule {}, vmId {}, vmIp {}", loadBalancer::toString, () -> _vmDao.findById(instanceId), vmIp::toString);
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

Redundant call to 'toString' on a String object.

Suggested change
logger.debug("Set load balancer rule for revoke: rule {}, vmId {}, vmIp {}", loadBalancer::toString, () -> _vmDao.findById(instanceId), vmIp::toString);
logger.debug("Set load balancer rule for revoke: rule {}, vmId {}, vmIp {}", loadBalancer::toString, () -> _vmDao.findById(instanceId), vmIp);

Copilot uses AI. Check for mistakes.
@blueorangutan
Copy link

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

@sureshanaparti sureshanaparti marked this pull request as draft January 16, 2026 08:32
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