From 93a0989167d13f814b10e0461cb3680bd8c64648 Mon Sep 17 00:00:00 2001 From: Vijayendra Bhamidipati Date: Mon, 13 Aug 2012 17:58:17 -0700 Subject: [PATCH] CS-15569: InterVlan - ApiDispatcher reports wrong Information as the reason for Failure. Public IP Addresses unrelated to the Guest VM are mentioned to be associated with the VM. Description: Fixing misleading error message in exception. --- .../cloud/network/rules/RulesManagerImpl.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/server/src/com/cloud/network/rules/RulesManagerImpl.java b/server/src/com/cloud/network/rules/RulesManagerImpl.java index f5b9c687f9c..2acfd94fdb6 100755 --- a/server/src/com/cloud/network/rules/RulesManagerImpl.java +++ b/server/src/com/cloud/network/rules/RulesManagerImpl.java @@ -381,9 +381,9 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager { @Override @ActionEvent(eventType = EventTypes.EVENT_ENABLE_STATIC_NAT, eventDescription = "enabling static nat") public boolean enableStaticNat(long ipId, long vmId, long networkId) throws NetworkRuleConflictException, ResourceUnavailableException { - return enableStaticNat(ipId, vmId, networkId, false); + return enableStaticNat(ipId, vmId, networkId, false); } - + private boolean enableStaticNat(long ipId, long vmId, long networkId, boolean isSystemVm) throws NetworkRuleConflictException, ResourceUnavailableException { UserContext ctx = UserContext.current(); @@ -544,10 +544,10 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager { if (!reassignStaticNat) { List idList = new ArrayList(); idList.add(new IdentityProxy(ipAddress, ipAddress.getId(), "ipId")); - idList.add(new IdentityProxy(oldIP, oldIP.getId(), "oldipId")); + idList.add(new IdentityProxy(oldIP, oldIP.getId(), "curIpId")); idList.add(new IdentityProxy("vm_instance", vmId, "vmId")); throw new InvalidParameterValueException("Failed to enable static nat for the ip address with specified ipId" + - " as vm with specified vmId is already associated with ip with specified oldipId", idList); + " as vm with specified vmId is already associated with ip specified as curIpId", idList); } // unassign old static nat rule s_logger.debug("Disassociating static nat for ip " + oldIP); @@ -1300,7 +1300,7 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager { @Override public boolean applyStaticNatForIp(long sourceIpId, boolean continueOnError, Account caller, boolean forRevoke) { IpAddress sourceIp = _ipAddressDao.findById(sourceIpId); - + List staticNats = createStaticNatForIp(sourceIp, caller, forRevoke); if (staticNats != null && !staticNats.isEmpty()) { @@ -1316,12 +1316,12 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager { return true; } - - + + @Override public boolean applyStaticNatForNetwork(long networkId, boolean continueOnError, Account caller, boolean forRevoke) { List staticNatIps = _ipAddressDao.listStaticNatPublicIps(networkId); - + List staticNats = new ArrayList(); for (IpAddress staticNatIp : staticNatIps) { staticNats.addAll(createStaticNatForIp(staticNatIp, caller, forRevoke));