HA manager to check target state of the VM to make decisions on whether or not to carry on a cheduled step. Fix NPE in capacity manager when releasing capacity of a stopped VM.

This commit is contained in:
Kelven Yang 2014-03-04 16:43:26 -08:00
parent 3d5fbe7073
commit 4312d88462
2 changed files with 7 additions and 0 deletions

View File

@ -188,6 +188,11 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager,
Long clusterId = null;
if (hostId != null) {
HostVO host = _hostDao.findById(hostId);
if (host == null) {
s_logger.warn("Host " + hostId + " no long exist anymore!");
return true;
}
clusterId = host.getClusterId();
}
if (capacityCpu == null || capacityMemory == null || svo == null) {

View File

@ -701,6 +701,7 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai
(vm.getHostId() != null ? vm.getHostId() : "none") + " State: " + vm.getState());
return null;
}
_itMgr.advanceStop(vm.getUuid(), false);
s_logger.info("Stop for " + vm + " was successful");
return null;
@ -711,6 +712,7 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai
(vm.getHostId() != null ? vm.getHostId() : "none") + " State: " + vm.getState());
return null;
}
_itMgr.advanceStop(vm.getUuid(), true);
s_logger.info("Stop for " + vm + " was successful");
return null;