You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by hu...@apache.org on 2014/03/14 14:58:14 UTC

[17/50] [abbrv] git commit: updated refs/heads/4.4 to 48f8a95

perform VM HA based on agent state report.


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

Branch: refs/heads/4.4
Commit: 7fa4715b996fe551c09423b22bb24b22f9926044
Parents: 8e27120
Author: Kelven Yang <ke...@gmail.com>
Authored: Thu Mar 6 11:45:13 2014 -0800
Committer: Kelven Yang <ke...@gmail.com>
Committed: Thu Mar 13 16:59:56 2014 -0700

----------------------------------------------------------------------
 .../src/com/cloud/ha/HighAvailabilityManagerImpl.java   | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7fa4715b/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java b/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java
index 29f1e7b..52100c8 100755
--- a/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java
+++ b/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java
@@ -393,8 +393,12 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai
             }
         }
 
-        HaWorkVO work =
-            new HaWorkVO(vm.getId(), vm.getType(), WorkType.HA, investigate ? Step.Investigating : Step.Scheduled, hostId, vm.getState(), maxRetries + 1, vm.getUpdated());
+        if (hostId == null) {
+            hostId = vm.getLastHostId();
+        }
+
+        HaWorkVO work = new HaWorkVO(vm.getId(), vm.getType(), WorkType.HA, investigate ? Step.Investigating : Step.Scheduled,
+                hostId != null ? hostId : 0L, vm.getState(), maxRetries + 1, vm.getUpdated());
         _haDao.persist(work);
 
         if (s_logger.isInfoEnabled()) {
@@ -962,7 +966,7 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai
         if (oldState == State.Running && event == VirtualMachine.Event.FollowAgentPowerOffReport && newState == State.Stopped) {
             final VMInstanceVO vm = _instanceDao.findById(vo.getId());
             if (vm.isHaEnabled()) {
-                if (vm.getState() == State.Stopped)
+                if (vm.getState() != State.Stopped)
                     s_logger.warn("Sanity check failed. postStateTransitionEvent reports transited to Stopped but VM " + vm + " is still at state " + vm.getState());
 
                 s_logger.info("Detected out-of-band stop of a HA enabled VM " + vm.getInstanceName() + ", will schedule restart");
@@ -970,7 +974,7 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai
                     @Override
                     protected void runInContext() {
                         try {
-                            scheduleRestart(vm, true);
+                            scheduleRestart(vm, false);
                         } catch (Exception e) {
                             s_logger.warn("Unexpected exception when scheduling a HA restart", e);
                         }