cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject [21/50] [abbrv] git commit: updated refs/heads/4.4 to 48f8a95
Date Fri, 14 Mar 2014 13:58:18 GMT
Restore to old HA logic, but suppress VM state change on resource state report to avoid interferring
HA.


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

Branch: refs/heads/4.4
Commit: 6ad245e6756176eb0ca374f121f30877498b9225
Parents: 4312d88
Author: Kelven Yang <kelveny@gmail.com>
Authored: Wed Mar 5 17:03:02 2014 -0800
Committer: Kelven Yang <kelveny@gmail.com>
Committed: Thu Mar 13 16:59:56 2014 -0700

----------------------------------------------------------------------
 .../src/com/cloud/ha/HighAvailabilityManager.java           | 2 ++
 .../src/com/cloud/vm/VirtualMachineManagerImpl.java         | 4 ++--
 server/src/com/cloud/ha/HighAvailabilityManagerImpl.java    | 9 +++++++++
 3 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6ad245e6/engine/components-api/src/com/cloud/ha/HighAvailabilityManager.java
----------------------------------------------------------------------
diff --git a/engine/components-api/src/com/cloud/ha/HighAvailabilityManager.java b/engine/components-api/src/com/cloud/ha/HighAvailabilityManager.java
index eb60f3e..ecfb6f6 100644
--- a/engine/components-api/src/com/cloud/ha/HighAvailabilityManager.java
+++ b/engine/components-api/src/com/cloud/ha/HighAvailabilityManager.java
@@ -100,6 +100,8 @@ public interface HighAvailabilityManager extends Manager {
 
     void cancelScheduledMigrations(HostVO host);
 
+    boolean hasPendingHaWork(long vmId);
+
     /**
      * @return
      */

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6ad245e6/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
index 0ca0d30..e344001 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -4100,7 +4100,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
 
         List<VmWorkJobVO> pendingWorkJobs = _workJobDao.listPendingWorkJobs(
                 VirtualMachine.Type.Instance, vmId);
-        if (pendingWorkJobs.size() == 0) {
+        if (pendingWorkJobs.size() == 0 || _haMgr.hasPendingHaWork(vmId)) {
             // there is no pending operation job
             VMInstanceVO vm = _vmDao.findById(vmId);
             if (vm != null) {
@@ -4125,7 +4125,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
                 s_logger.warn("VM " + vmId + " no longer exists when processing VM state
report");
             }
         } else {
-            s_logger.info("There is pending job working on the VM. vm id: " + vmId + ", postpone
power-change report by resetting power-change counters");
+            s_logger.info("There is pending job or HA tasks working on the VM. vm id: " +
vmId + ", postpone power-change report by resetting power-change counters");
 
             // reset VM power state tracking so that we won't lost signal when VM has
             // been translated to

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6ad245e6/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 8bd569a..29f1e7b 100755
--- a/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java
+++ b/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java
@@ -962,6 +962,9 @@ 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)
+                    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");
                 _executor.submit(new ManagedContextRunnable() {
                     @Override
@@ -977,4 +980,10 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements
HighAvai
         }
         return true;
     }
+
+    @Override
+    public boolean hasPendingHaWork(long vmId) {
+        List<HaWorkVO> haWorks = _haDao.listRunningHaWorkForVm(vmId);
+        return haWorks.size() > 0;
+    }
 }


Mime
View raw message