incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject [3/11] git commit: VPC: don't fail when create/remove static route when VPC VR is in Stopped state
Date Fri, 06 Jul 2012 18:11:02 GMT
VPC: don't fail when create/remove static route when VPC VR is in Stopped state


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

Branch: refs/heads/vpc
Commit: e19e26ec4e2d867a421d22f6c174416b042a7a98
Parents: b13acc6
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Thu Jul 5 17:25:51 2012 -0700
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Fri Jul 6 11:09:15 2012 -0700

----------------------------------------------------------------------
 .../VpcVirtualNetworkApplianceManagerImpl.java     |   21 ++++++++++++--
 1 files changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e19e26ec/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
index 959831c..37aa6ff 100644
--- a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
@@ -41,6 +41,7 @@ import com.cloud.agent.api.to.NetworkACLTO;
 import com.cloud.agent.api.to.NicTO;
 import com.cloud.agent.api.to.VirtualMachineTO;
 import com.cloud.agent.manager.Commands;
+import com.cloud.dc.DataCenter;
 import com.cloud.dc.DataCenterVO;
 import com.cloud.deploy.DataCenterDeployment;
 import com.cloud.deploy.DeployDestination;
@@ -98,6 +99,7 @@ import com.cloud.vm.Nic;
 import com.cloud.vm.NicProfile;
 import com.cloud.vm.ReservationContext;
 import com.cloud.vm.VirtualMachine;
+import com.cloud.vm.VirtualMachine.State;
 import com.cloud.vm.VirtualMachineProfile;
 import com.cloud.vm.VirtualMachineProfile.Param;
 import com.cloud.vm.dao.VMInstanceDao;
@@ -1014,9 +1016,22 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
             return true;
         }
         
-        //send commands to only one router as there is only one in the VPC
-        return sendStaticRoutes(staticRoutes, routers.get(0));     
-         
+        boolean result = true;
+        for (VirtualRouter router : routers) {
+            if (router.getState() == State.Running) {
+                result = result && sendStaticRoutes(staticRoutes, routers.get(0));
    
+
+            } else if (router.getState() == State.Stopped || router.getState() == State.Stopping)
{
+                s_logger.debug("Router " + router.getInstanceName() + " is in " + router.getState()
+ 
+                        ", so not sending StaticRoute command to the backend");
+            } else {
+                s_logger.warn("Unable to apply StaticRoute, virtual router is not in the
right state " + router.getState());
+                
+                throw new ResourceUnavailableException("Unable to apply StaticRoute on the
backend," +
+                		" virtual router is not in the right state", DataCenter.class, router.getDataCenterIdToDeployIn());
+            }
+        }
+        return result;
     }
     
     protected boolean sendStaticRoutes(List<StaticRouteProfile> staticRoutes, DomainRouterVO
router) 


Mime
View raw message