From 2daf7998c8544073fd784868384fc79142df8180 Mon Sep 17 00:00:00 2001 From: Alena Prokharchyk Date: Fri, 11 May 2012 16:15:38 -0700 Subject: [PATCH] CS-14692: don't allow to remove account specific ip range when it has sourceNat ip address, and associated with non-removed Guest network --- .../src/com/cloud/configuration/ConfigurationManagerImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index 90a43f8a9f6..b97ce9fac56 100755 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -2474,10 +2474,10 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura " as ip " + ip + " belonging to the range is used for static nat purposes. Cleanup the rules first"); } - if (ip.isSourceNat() && _nicDao.findByIp4AddressAndNetworkId(ip.getAddress().addr(), ip.getSourceNetworkId()) != null) { + if (ip.isSourceNat() && _networkMgr.getNetwork(ip.getAssociatedWithNetworkId()) != null) { throw new InvalidParameterValueException("Can't delete account specific vlan " + vlanDbId + " as ip " + ip + " belonging to the range is a source nat ip for the network id=" + ip.getSourceNetworkId() + - ". Either delete the network, or Virtual Router instance using this ip address"); + ". IP range with the source nat ip address can be removed either as a part of Network, or account removal"); } if (_firewallDao.countRulesByIpId(ip.getId()) > 0) {