mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
fixed problem with halted local storage vms
This commit is contained in:
parent
209713fba5
commit
9b8d251afd
@ -279,6 +279,23 @@ public abstract class CitrixResourceBase implements ServerResource {
|
||||
}
|
||||
|
||||
|
||||
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 boolean isRefNull(XenAPIObject object) {
|
||||
return (object == null || object.toWireString().equals("OpaqueRef:NULL"));
|
||||
}
|
||||
@ -3724,6 +3741,16 @@ public abstract class CitrixResourceBase implements ServerResource {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
cleanupHaltedVms(conn);
|
||||
} 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();
|
||||
fillHostInfo(conn, cmd);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user