From 55b4ead49594212ba55bfcf7007b0cae11bf68ba Mon Sep 17 00:00:00 2001 From: Devdeep Singh Date: Thu, 25 Sep 2014 13:10:12 +0530 Subject: [PATCH] CLOUDSTACK-7598: When a vm deployed by cloudstack is stopped on the hypervisor (outside cloudstack), the state of the vm is not updated in cloudstack db. The ping task was not checking for resource (host) status by default. The power state of the vms is returned as part of the resource status. Fixed the issue by making sure ping task atleast tries once to get the resource status. --- .../src/com/cloud/agent/manager/DirectAgentAttache.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/engine/orchestration/src/com/cloud/agent/manager/DirectAgentAttache.java b/engine/orchestration/src/com/cloud/agent/manager/DirectAgentAttache.java index 9cf643f3bc4..f39bf1d2ebd 100755 --- a/engine/orchestration/src/com/cloud/agent/manager/DirectAgentAttache.java +++ b/engine/orchestration/src/com/cloud/agent/manager/DirectAgentAttache.java @@ -166,11 +166,13 @@ public class DirectAgentAttache extends AgentAttache { if (resource != null) { PingCommand cmd = null; int retried = 0; - while ( cmd == null && ++retried < _HostPingRetryCount.value()) + cmd = resource.getCurrentStatus(_id); + while (cmd == null && retried++ < _HostPingRetryCount.value()) { - cmd = resource.getCurrentStatus(_id); Thread.sleep(1000*_HostPingRetryTimer.value()); + cmd = resource.getCurrentStatus(_id); } + if (cmd == null) { s_logger.warn("Unable to get current status on " + _id + "(" + _name + ")"); return;