From 0f054246b65d003ae7f024b6ef125b2ec1846879 Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Thu, 16 Feb 2017 14:18:56 +0100 Subject: [PATCH] CLOUDSTACK-9789: Fix releasing secondary guest IP fails with associated static nat which is actually not used --- server/src/com/cloud/network/NetworkServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java index b6dac872f30..e77b40e1818 100644 --- a/server/src/com/cloud/network/NetworkServiceImpl.java +++ b/server/src/com/cloud/network/NetworkServiceImpl.java @@ -835,7 +835,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService { } } //check if the secondary ip associated with any static nat rule - IPAddressVO publicIpVO = _ipAddressDao.findByVmIp(secondaryIp); + IPAddressVO publicIpVO = _ipAddressDao.findByIpAndNetworkId(secIpVO.getNetworkId(), secondaryIp); if (publicIpVO != null) { s_logger.debug("VM nic IP " + secondaryIp + " is associated with the static NAT rule public IP address id " + publicIpVO.getId()); throw new InvalidParameterValueException("Can' remove the ip " + secondaryIp + "is associate with static NAT rule public IP address id " + publicIpVO.getId());