Skip to content

Commit 3b342da

Browse files
committed
Refactor LB CIDR list comparison & rollback code
- Replace manual null-check comparison with Objects.equals for clarity and null safety - Simplify CIDR list rollback to always restore backup value unconditionally - Add JavaDoc for setCidrList method for improved documentation
1 parent dd59044 commit 3b342da

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

engine/schema/src/main/java/com/cloud/network/dao/LoadBalancerVO.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ public String toString() {
145145
this, "id", "uuid", "name", "purpose", "state"));
146146
}
147147

148+
/**
149+
* Sets the CIDR list associated with this load balancer rule.
150+
*
151+
* @param cidrList a comma-separated list of CIDR strings, e.g. "1.2.3.4/24,1.2.3.5/24" or and empty string e.g. "" to clear the restrictions
152+
*/
148153
public void setCidrList(String cidrList) {
149154
this.cidrList = cidrList;
150155
}

server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2306,9 +2306,6 @@ public LoadBalancer updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd) {
23062306
if (lbBackup.getAlgorithm() != null) {
23072307
lb.setAlgorithm(lbBackup.getAlgorithm());
23082308
}
2309-
if (lbBackup.getLbProtocol() != null) {
2310-
lb.setLbProtocol(lbBackup.getLbProtocol());
2311-
}
23122309

23132310
lb.setCidrList(lbBackup.getCidrList());
23142311
lb.setState(lbBackup.getState());

0 commit comments

Comments
 (0)