mirror of https://github.com/apache/cloudstack.git
bug 8279: In the recreatable case, we considered the vm fenced off and restarted it elsewhere. That causes the vm sync to think the vm is in stopped state for which there is no StopCommand sent. We now cleanup the halted vms in this situation.
This commit is contained in:
parent
c7f0fd2973
commit
2ac8f682e8
|
|
@ -1993,6 +1993,23 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||
throw new CloudRuntimeException("Com'on no control domain? What the crap?!#@!##$@");
|
||||
}
|
||||
|
||||
protected void cleanupHaltedVms(Connection conn) throws XenAPIException, XmlRpcException {
|
||||
Host host = Host.getByUuid(conn, _host.uuid);
|
||||
Set<VM> vms = host.getResidentVMs(conn);
|
||||
|
||||
for (VM vm : vms) {
|
||||
try {
|
||||
if (VmPowerState.HALTED.equals(vm.getPowerState(conn))) {
|
||||
vm.destroy(conn);
|
||||
}
|
||||
} catch (XenAPIException e) {
|
||||
s_logger.warn("Unable to cleanup " + vm);
|
||||
} catch (XmlRpcException e) {
|
||||
s_logger.warn("Unable to cleanup " + vm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected HashMap<String, State> sync() {
|
||||
HashMap<String, State> newStates;
|
||||
HashMap<String, State> oldStates = null;
|
||||
|
|
@ -3779,6 +3796,16 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||
}
|
||||
|
||||
setupLinkLocalNetwork();
|
||||
|
||||
try {
|
||||
cleanupHaltedVms(getConnection());
|
||||
} catch (XenAPIException e) {
|
||||
s_logger.warn("Unable to cleanup halted vms", e);
|
||||
return null;
|
||||
} catch (XmlRpcException e) {
|
||||
s_logger.warn("Unable to cleanup halted vms", e);
|
||||
return null;
|
||||
}
|
||||
|
||||
StartupRoutingCommand cmd = new StartupRoutingCommand();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue