cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [1/3] git commit: updated refs/heads/4.5 to 59f337d
Date Tue, 13 Oct 2015 09:36:44 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.5 f1f1fefdf -> 59f337da5


CLOUDSTACK-8848: ensure power state is up to date when handling missing VMs in powerReport

There 2 things which has been changed.

* We look on power_state_update_time instead of update_time. Didn't make sense to me at all
to look at update_time.
* Due DB update optimisation, powerState will only be updated if < MAX_CONSECUTIVE_SAME_STATE_UPDATE_COUNT.
That is why we can not rely on these information unless we make sure these are up to date.


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

Branch: refs/heads/4.5
Commit: 30c704915c882f8ac2ab551aa157d0b7a0bdb47f
Parents: f1f1fef
Author: Rene Moser <resmo@apache.org>
Authored: Thu Sep 24 21:10:26 2015 +0200
Committer: Rene Moser <resmo@apache.org>
Committed: Sun Oct 11 14:05:23 2015 +0200

----------------------------------------------------------------------
 .../src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java  | 9 ++++++++-
 engine/schema/src/com/cloud/vm/dao/VMInstanceDao.java       | 2 ++
 engine/schema/src/com/cloud/vm/dao/VMInstanceDaoImpl.java   | 6 ++++++
 3 files changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/30c70491/engine/orchestration/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java
index d3dcdec..19ed71c 100644
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java
@@ -111,7 +111,14 @@ public class VirtualMachinePowerStateSyncImpl implements VirtualMachinePowerStat
 
             for (VMInstanceVO instance : vmsThatAreMissingReport) {
 
-                Date vmStateUpdateTime = instance.getUpdateTime();
+                // Make sure powerState is up to date for missing VMs
+                if (!_instanceDao.isPowerStateUpToDate(instance.getId())) {
+                    s_logger.warn("Detected missing VM but power state is outdated, wait
for another process report run for VM id: " + instance.getId());
+                    _instanceDao.resetVmPowerStateTracking(instance.getId());
+                    continue;
+                }
+
+                Date vmStateUpdateTime = instance.getPowerStateUpdateTime();
                 if (vmStateUpdateTime == null) {
                     s_logger.warn("VM state was updated but update time is null?! vm id:
" + instance.getId());
                     vmStateUpdateTime = currentTime;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/30c70491/engine/schema/src/com/cloud/vm/dao/VMInstanceDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/dao/VMInstanceDao.java b/engine/schema/src/com/cloud/vm/dao/VMInstanceDao.java
index 1d522dc..8d457fa 100644
--- a/engine/schema/src/com/cloud/vm/dao/VMInstanceDao.java
+++ b/engine/schema/src/com/cloud/vm/dao/VMInstanceDao.java
@@ -138,4 +138,6 @@ public interface VMInstanceDao extends GenericDao<VMInstanceVO, Long>,
StateDao<
     HashMap<String, Long> countVgpuVMs(Long dcId, Long podId, Long clusterId);
 
     VMInstanceVO findVMByHostNameInZone(String hostName, long zoneId);
+
+    boolean isPowerStateUpToDate(long instanceId);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/30c70491/engine/schema/src/com/cloud/vm/dao/VMInstanceDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/dao/VMInstanceDaoImpl.java b/engine/schema/src/com/cloud/vm/dao/VMInstanceDaoImpl.java
index be0e366..48b56d1 100644
--- a/engine/schema/src/com/cloud/vm/dao/VMInstanceDaoImpl.java
+++ b/engine/schema/src/com/cloud/vm/dao/VMInstanceDaoImpl.java
@@ -804,6 +804,12 @@ public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO,
Long> implem
     }
 
     @Override
+    public boolean isPowerStateUpToDate(final long instanceId) {
+        VMInstanceVO instance = findById(instanceId);
+        return instance.getPowerStateUpdateCount() < MAX_CONSECUTIVE_SAME_STATE_UPDATE_COUNT;
+    }
+
+    @Override
     public void resetVmPowerStateTracking(final long instanceId) {
         Transaction.execute(new TransactionCallbackNoReturn() {
             @Override


Mime
View raw message