Skip to content

Commit 75e8a0f

Browse files
engine: nest the requested null-check in the NIC allocation retry
Fold the requested-IPv4 throw and the address reset under a single requested != null guard instead of repeating the check on both branches.
1 parent 0035c61 commit 75e8a0f

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,10 +1120,12 @@ protected NicVO checkForRaceAndAllocateNic(final NicProfile requested, final Net
11201120
}
11211121

11221122
if (vo == null) {
1123-
if (requested != null && requested.getRequestedIPv4() != null) {
1124-
throw new InsufficientVirtualNetworkCapacityException("Unable to acquire requested Guest IP address " + requested.getRequestedIPv4() + " for network " + network, DataCenter.class, dcVo.getId());
1125-
} else if (requested != null) {
1126-
requested.setIPv4Address(null);
1123+
if (requested != null) {
1124+
if (requested.getRequestedIPv4() != null) {
1125+
throw new InsufficientVirtualNetworkCapacityException("Unable to acquire requested Guest IP address " + requested.getRequestedIPv4() + " for network " + network, DataCenter.class, dcVo.getId());
1126+
} else {
1127+
requested.setIPv4Address(null);
1128+
}
11271129
}
11281130
retryIpAllocation = true;
11291131
}

0 commit comments

Comments
 (0)