Skip to content

Commit 712a2a0

Browse files
committed
CLSTACK-784 - Deassociate IP address if enabling static nat fails
Steps to reproduce the issue (1) create a vpc (vpc-001) and a vpc tier (vpc-001-001) (2) create a vm (vm-001-001) in vpc-001-001 (3) acquire a public ip (ip-1) and enable static nat to vm-001-001, operation succeeds. (4) acquire a public ip (ip-2) and enable static nat to vm-001-001, operation fails but the ip is still assigned to vpc tier vpc-001-001. Note down the ip address and the id of it. (5) create another vpc tier vpc-001-002, and vm (vm-001-002) in the tier (6) enabled ip-2 static nat to vm-001-002, operation should succeed
1 parent ac20263 commit 712a2a0

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

server/src/main/java/com/cloud/network/rules/RulesManagerImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,7 @@ private boolean enableStaticNat(long ipId, long vmId, long networkId, boolean is
500500
s_logger.debug("The ip is not associated with the VPC network id=" + networkId + ", so assigning");
501501
try {
502502
ipAddress = _ipAddrMgr.associateIPToGuestNetwork(ipId, networkId, false);
503+
performedIpAssoc = true;
503504
} catch (Exception ex) {
504505
s_logger.warn("Failed to associate ip id=" + ipId + " to VPC network id=" + networkId + " as " + "a part of enable static nat");
505506
return false;

0 commit comments

Comments
 (0)