cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From muralire...@apache.org
Subject git commit: updated refs/heads/master to f1c611a
Date Sun, 11 Aug 2013 23:19:23 GMT
Updated Branches:
  refs/heads/master 2868d4b33 -> f1c611ac6


CLOUDSTACK-4206: [EIP/ELB] Failed to disableStaticNAT when the userVM is
in destroyed state.

ignore VM state when system is enabling static NAT on the system IP to
VM in EIP enable network


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f1c611ac
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f1c611ac
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f1c611ac

Branch: refs/heads/master
Commit: f1c611ac60715583fbd5d65a1bfd59c8a736fecd
Parents: 2868d4b
Author: Murali Reddy <muralimmreddy@gmail.com>
Authored: Mon Aug 12 04:46:29 2013 +0530
Committer: Murali Reddy <muralimmreddy@gmail.com>
Committed: Mon Aug 12 04:49:03 2013 +0530

----------------------------------------------------------------------
 .../com/cloud/network/rules/RulesManagerImpl.java  | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f1c611ac/server/src/com/cloud/network/rules/RulesManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/rules/RulesManagerImpl.java b/server/src/com/cloud/network/rules/RulesManagerImpl.java
index 4c1fa37..a2f5da3 100755
--- a/server/src/com/cloud/network/rules/RulesManagerImpl.java
+++ b/server/src/com/cloud/network/rules/RulesManagerImpl.java
@@ -138,7 +138,7 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager,
Rules
     LoadBalancerVMMapDao _loadBalancerVMMapDao;
 
     
-    protected void checkIpAndUserVm(IpAddress ipAddress, UserVm userVm, Account caller) {
+    protected void checkIpAndUserVm(IpAddress ipAddress, UserVm userVm, Account caller, Boolean
ignoreVmState) {
         if (ipAddress == null || ipAddress.getAllocatedTime() == null || ipAddress.getAllocatedToAccountId()
== null) {
             throw new InvalidParameterValueException("Unable to create ip forwarding rule
on address " + ipAddress + ", invalid IP address specified.");
         }
@@ -148,7 +148,9 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager,
Rules
         }
 
         if (userVm.getState() == VirtualMachine.State.Destroyed || userVm.getState() == VirtualMachine.State.Expunging)
{
-            throw new InvalidParameterValueException("Invalid user vm: " + userVm.getId());
+            if (!ignoreVmState) {
+                throw new InvalidParameterValueException("Invalid user vm: " + userVm.getId());
+            }
         }
 
         _accountMgr.checkAccess(caller, null, true, ipAddress, userVm);
@@ -545,7 +547,12 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager,
Rules
                 }
 
                 // Check permissions
-                checkIpAndUserVm(ipAddress, vm, caller);
+                if (ipAddress.getSystem()) {
+                    // when system is enabling static NAT on system IP's (for EIP) ignore
VM state
+                    checkIpAndUserVm(ipAddress, vm, caller, true);
+                } else {
+                    checkIpAndUserVm(ipAddress, vm, caller, false);
+                }
 
                 //is static nat is for vm secondary ip
                 //dstIp = guestNic.getIp4Address();
@@ -1186,7 +1193,7 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager,
Rules
         CallContext ctx = CallContext.current();
         Account caller = ctx.getCallingAccount();
         IPAddressVO ipAddress = _ipAddressDao.findById(ipId);
-        checkIpAndUserVm(ipAddress, null, caller);
+        checkIpAndUserVm(ipAddress, null, caller, false);
 
         if (ipAddress.getSystem()) {
             InvalidParameterValueException ex = new InvalidParameterValueException("Can't
disable static nat for system IP address with specified id");
@@ -1220,7 +1227,7 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager,
Rules
         boolean success = true;
 
         IPAddressVO ipAddress = _ipAddressDao.findById(ipId);
-        checkIpAndUserVm(ipAddress, null, caller);
+        checkIpAndUserVm(ipAddress, null, caller, false);
         long networkId = ipAddress.getAssociatedWithNetworkId();
 
         if (!ipAddress.isOneToOneNat()) {


Mime
View raw message