cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kelv...@apache.org
Subject [08/10] git commit: updated refs/heads/master to 42d6373
Date Fri, 14 Mar 2014 00:14:53 GMT
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/master
Commit: 7fa4715b996fe551c09423b22bb24b22f9926044
Parents: 8e27120
Author: Kelven Yang <kelveny@gmail.com>
Authored: Thu Mar 6 11:45:13 2014 -0800
Committer: Kelven Yang <kelveny@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);
                         }


Mime
View raw message