Bug 14646 - Enabling Host into maintenance mode is stopping the VMs instead of live migrating them to other hosts in the cluster.

Changes:
-  While listing UP hosts in the cluster of the host, the query has changed and now also considers the Host 'resourceState' field and picks only those hosts that have value 'enabled'.
   This query result does not include the host being put in maintainance; unlike the earlier query that used to include it.
-  But the logic to find out if this is the last host in the Cluster is not updated and has a bug when it compares the list size.
- Fixed this.
This commit is contained in:
prachi 2012-04-11 16:15:19 -07:00
parent 38e54d35e0
commit 4f116fb24f

View File

@ -1095,7 +1095,7 @@ public class ResourceManagerImpl implements ResourceManager, ResourceService, Ma
List<HostVO> hosts = listAllUpAndEnabledHosts(Host.Type.Routing, host.getClusterId(), host.getPodId(), host.getDataCenterId());
for (final VMInstanceVO vm : vms) {
if (hosts == null || hosts.size() <= 1 || !answer.getMigrate()) {
if (hosts == null || hosts.isEmpty() || !answer.getMigrate()) {
// for the last host in this cluster, stop all the VMs
_haMgr.scheduleStop(vm, hostId, WorkType.ForceStop);
} else {