cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject [7/11] git commit: VPC: mark gateway with Deleting state when all static routes are gone
Date Fri, 13 Jul 2012 20:34:35 GMT
VPC: mark gateway with Deleting state when all static routes are gone


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

Branch: refs/heads/vpc
Commit: eb52f4a610b6695b37e18f1f85eb7534b1b701f0
Parents: 5923659
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Wed Jul 11 15:46:52 2012 -0700
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Fri Jul 13 13:26:04 2012 -0700

----------------------------------------------------------------------
 .../src/com/cloud/network/vpc/VpcManagerImpl.java  |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/eb52f4a6/server/src/com/cloud/network/vpc/VpcManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/VpcManagerImpl.java b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
index 5381029..28086a4 100644
--- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
@@ -1170,7 +1170,6 @@ public class VpcManagerImpl implements VpcManager, Manager{
         }
         
         try {
-            gatewayVO.setState(VpcGateway.State.Deleting);
             _vpcGatewayDao.update(gatewayVO.getId(), gatewayVO);
             s_logger.debug("Marked gateway " + gatewayVO + " with state " + VpcGateway.State.Deleting);
             //don't allow to remove gateway when there are static routes associated with
it
@@ -1179,7 +1178,9 @@ public class VpcManagerImpl implements VpcManager, Manager{
                 throw new CloudRuntimeException("Can't delete private gateway " + gatewayVO
+ " as it has " + routeCount +
                         " static routes applied. Remove the routes first");
             }
-                    
+            
+            gatewayVO.setState(VpcGateway.State.Deleting);
+            
             //1) delete the gateway on the backend
             PrivateGateway gateway = getVpcPrivateGateway(gatewayId);
             if (getVpcElement().deletePrivateGateway(gateway)) {
@@ -1373,12 +1374,6 @@ public class VpcManagerImpl implements VpcManager, Manager{
             throw new InvalidParameterValueException("Unable to find static route by id");
         }
         
-        VpcGateway gateway = _vpcGatewayDao.findById(route.getVpcGatewayId());
-        
-        if (gateway.getState() != VpcGateway.State.Ready) {
-            throw new InvalidParameterValueException("Gateway is not in the " + VpcGateway.State.Ready
+ " state: " + gateway.getState());
-        }
-
         _accountMgr.checkAccess(caller, null, false, route);
 
         markStaticRouteForRevoke(route, caller);


Mime
View raw message