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.

(cherry picked from commit 55b4ead495)
This commit is contained in:
Devdeep Singh 2014-09-25 13:10:12 +05:30 committed by David Nalley
parent 89736d011e
commit 43a9bbf509
1 changed files with 4 additions and 2 deletions

View File

@ -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;