incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject [7/9] git commit: CLOUDSTACK-689: Clean stop pending flags when VR start/stop
Date Fri, 21 Dec 2012 20:53:31 GMT
CLOUDSTACK-689: Clean stop pending flags when VR start/stop


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

Branch: refs/heads/ui-plugins
Commit: 53e6825b744252daeab7c4e694adae69c65cf0d3
Parents: 13944a0
Author: Sheng Yang <sheng.yang@citrix.com>
Authored: Thu Dec 20 17:01:12 2012 -0800
Committer: Sheng Yang <sheng.yang@citrix.com>
Committed: Thu Dec 20 18:51:01 2012 -0800

----------------------------------------------------------------------
 .../router/VirtualNetworkApplianceManagerImpl.java |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/53e6825b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index a7f4b5e..0af034f 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -501,6 +501,14 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
         if(virtualRouter == null){
             throw new CloudRuntimeException("Failed to stop router with id " + routerId);
         }
+        
+        // Clear stop pending flag after stopped successfully
+        if (router.isStopPending()) {
+            s_logger.info("Clear the stop pending flag of router " + router.getHostName()
+ " after stop router successfully");
+            router.setStopPending(false);
+            router = _routerDao.persist(router);
+            virtualRouter.setStopPending(false);
+        }
         return virtualRouter;
     }
 
@@ -2413,6 +2421,11 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
     ConcurrentOperationException, ResourceUnavailableException {
         s_logger.debug("Starting router " + router);
         if (_itMgr.start(router, params, user, caller, planToDeploy) != null) {
+            if (router.isStopPending()) {
+                s_logger.info("Clear the stop pending flag of router " + router.getHostName()
+ " after start router successfully!");
+                router.setStopPending(false);
+                router = _routerDao.persist(router);
+            }
             // We don't want the failure of VPN Connection affect the status of router, so
we try to make connection
             // only after router start successfully
             Long vpcId = router.getVpcId();
@@ -3308,6 +3321,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
         List<DomainRouterVO> routers = _routerDao.listIsolatedByHostId(host.getId());
         for (DomainRouterVO router : routers) {
             if (router.isStopPending()) {
+                s_logger.info("Stopping router " + router.getInstanceName() + " due to stop
pending flag found!");
                 State state = router.getState();
                 if (state != State.Stopped && state != State.Destroyed) {
                     try {


Mime
View raw message