This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch 4.11
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.11 by this push:
     new 223a373  orchestration: Fixes #2845 PowerReportMissing for new VRs 
(#2846)
223a373 is described below

commit 223a373e53ce8db5b2dea9963aff6142fc1c0e49
Author: René Moser <m...@renemoser.net>
AuthorDate: Tue Sep 18 08:04:31 2018 +0200

    orchestration: Fixes #2845 PowerReportMissing for new VRs (#2846)
    
    Fixes #2845
---
 .../src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java        | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/engine/orchestration/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java 
b/engine/orchestration/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java
index 60c0a99..f8aad26 100644
--- 
a/engine/orchestration/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java
+++ 
b/engine/orchestration/src/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java
@@ -123,8 +123,12 @@ public class VirtualMachinePowerStateSyncImpl implements 
VirtualMachinePowerStat
 
                 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;
+                    s_logger.warn("VM power state update time is null, falling 
back to update time for vm id: " + instance.getId());
+                    vmStateUpdateTime = instance.getUpdateTime();
+                    if (vmStateUpdateTime == null) {
+                        s_logger.warn("VM update time is null, falling back to 
creation time for vm id: " + instance.getId());
+                        vmStateUpdateTime = instance.getCreated();
+                    }
                 }
 
                 if (s_logger.isDebugEnabled())

Reply via email to