cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kous...@apache.org
Subject git commit: updated refs/heads/master to c3515c9
Date Mon, 01 Dec 2014 13:21:14 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 449d123ce -> c3515c9ff


CLOUDSTACK-7994: Network rules are not configured in VR after out-of-band movement due to
host crash
Ensure that VR is re-booted when it is moved to another host out-of-band. This is necessary
to re-program all network rules

Conflicts:
	server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java


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

Branch: refs/heads/master
Commit: c3515c9ff98c8447d16dc9cc294aab3496f045a4
Parents: 449d123
Author: Koushik Das <koushik@apache.org>
Authored: Mon Dec 1 16:18:06 2014 +0530
Committer: Koushik Das <koushik@apache.org>
Committed: Mon Dec 1 18:49:09 2014 +0530

----------------------------------------------------------------------
 .../router/VirtualNetworkApplianceManagerImpl.java | 17 +++++++++++++++--
 .../VpcVirtualNetworkApplianceManagerImpl.java     |  8 ++++++++
 2 files changed, 23 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c3515c9f/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 73b6343..ba76e57 100644
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -200,6 +200,7 @@ import com.cloud.user.dao.UserDao;
 import com.cloud.user.dao.UserStatisticsDao;
 import com.cloud.user.dao.UserStatsLogDao;
 import com.cloud.utils.NumbersUtil;
+import com.cloud.utils.Pair;
 import com.cloud.utils.component.ComponentContext;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.concurrency.NamedThreadFactory;
@@ -2575,8 +2576,20 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine>
{
         final VirtualMachine.Event event = transition.getEvent();
         if (event == VirtualMachine.Event.FollowAgentPowerOnReport && newState ==
State.Running) {
             if (vo.getType() == VirtualMachine.Type.DomainRouter) {
-                s_logger.info("Schedule a router reboot task as router " + vo.getId() + "
is powered-on out-of-band. we need to reboot to refresh network rules");
-                _executor.schedule(new RebootTask(vo.getId()), 1000, TimeUnit.MICROSECONDS);
+                if (opaque != null && opaque instanceof Pair<?, ?>) {
+                    Pair<?, ?> pair = (Pair<?, ?>)opaque;
+                    Object first = pair.first();
+                    Object second = pair.second();
+                    if (first != null && second != null && first instanceof
Long && second instanceof Long) {
+                        Long hostId = (Long)first;
+                        Long powerHostId = (Long)second;
+                        // If VM host known to CS is different from 'PowerOn' report host,
then it is out-of-band movement
+                        if (hostId.longValue() != powerHostId.longValue()) {
+                            s_logger.info("Schedule a router reboot task as router " + vo.getId()
+ " is powered-on out-of-band, need to reboot to refresh network rules");
+                            _executor.schedule(new RebootTask(vo.getId()), 1000, TimeUnit.MICROSECONDS);
+                        }
+                    }
+                }
             }
         }
         return true;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c3515c9f/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 abb4849..688453e 100644
--- a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
@@ -81,6 +81,7 @@ import com.cloud.user.UserStatisticsVO;
 import com.cloud.utils.Pair;
 import com.cloud.utils.db.EntityManager;
 import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.utils.fsm.StateMachine2;
 import com.cloud.utils.net.NetUtils;
 import com.cloud.vm.DomainRouterVO;
 import com.cloud.vm.Nic;
@@ -741,4 +742,11 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
         }
         return true;
     }
+
+    @Override
+    public boolean postStateTransitionEvent(final StateMachine2.Transition<State, VirtualMachine.Event>
transition, final VirtualMachine vo, final boolean status, final Object opaque) {
+        // Without this VirtualNetworkApplianceManagerImpl.postStateTransitionEvent() gets
called twice as part of listeners -
+        // once from VpcVirtualNetworkApplianceManagerImpl and once from VirtualNetworkApplianceManagerImpl
itself
+        return true;
+    }
 }


Mime
View raw message