mirror of https://github.com/apache/cloudstack.git
bug 11154: host can go in Maintenance state only after all vms are migrated from it
status 11154: resolved fixed
This commit is contained in:
parent
54e4e0011b
commit
441d9d765c
|
|
@ -138,7 +138,8 @@ public class AgentMonitor extends Thread implements Listener {
|
|||
|
||||
if (host.getType() != Host.Type.Storage) {
|
||||
List<VMInstanceVO> vos = _vmDao.listByHostId(hostId);
|
||||
if (vos.size() == 0) {
|
||||
List<VMInstanceVO> vosMigrating = _vmDao.listVmsMigratingFromHost(hostId);
|
||||
if (vos.isEmpty() && vosMigrating.isEmpty()) {
|
||||
_alertMgr.sendAlert(AlertManager.ALERT_TYPE_HOST, host.getDataCenterId(), host.getPodId(), "Migration Complete for host " + hostDesc, "Host [" + hostDesc + "] is ready for maintenance");
|
||||
_hostDao.updateStatus(host, Event.PreparationComplete, _msId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,5 +81,6 @@ public interface VMInstanceDao extends GenericDao<VMInstanceVO, Long>, StateDao<
|
|||
List<VMInstanceVO> listByAccountId(long accountId);
|
||||
public Long countAllocatedVirtualRoutersForAccount(long accountId);
|
||||
|
||||
List<VMInstanceVO> listByClusterId(long clusterId);
|
||||
List<VMInstanceVO> listByClusterId(long clusterId);
|
||||
List<VMInstanceVO> listVmsMigratingFromHost(Long hostId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -329,4 +329,12 @@ public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO, Long> implem
|
|||
sc.setParameters("state", new Object[] {State.Destroyed, State.Error, State.Expunging});
|
||||
return customSearch(sc, null).get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VMInstanceVO> listVmsMigratingFromHost(Long hostId) {
|
||||
SearchCriteria<VMInstanceVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("lastHost", hostId);
|
||||
sc.setParameters("state", State.Migrating);
|
||||
return listBy(sc);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue