bug 11148: VMs that got stopped during Host Maintenance have host_id associated with them

status 11148: resolved fixed

enabled vm stop, if the host is last valid host in cluster
This commit is contained in:
Murali Reddy 2011-08-17 18:06:30 +05:30
parent e4162e5be6
commit b87c5ba331

View File

@ -1634,10 +1634,10 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, Manager {
}
List<HostVO> hosts = _hostDao.listBy(host.getClusterId(), host.getPodId(), host.getDataCenterId());
List<Long> upHosts = _hostDao.listBy( host.getDataCenterId(), host.getPodId(), host.getClusterId(), Host.Type.Routing, Status.Up);
for (final VMInstanceVO vm : vms) {
if (hosts == null || hosts.size() <= 1 || !answer.getMigrate()) {
// for the last host in this cluster, stop all the VMs
if (hosts == null || hosts.size() <= 1 || !answer.getMigrate() || upHosts == null || upHosts.size() == 0) {
// for the last valid host in this cluster, stop all the VMs
_haMgr.scheduleStop(vm, hostId, WorkType.ForceStop);
} else {
_haMgr.scheduleMigration(vm);