mirror of https://github.com/apache/cloudstack.git
bug 13449: running VMs can also have null host id, put a check
reviewed-by: kishan
This commit is contained in:
parent
f50fa56b55
commit
ff3ea9356c
|
|
@ -1685,10 +1685,11 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
|
|||
}
|
||||
} // END INIT
|
||||
// host id can change
|
||||
if (info != null && vm.getState() == State.Running){
|
||||
// check for host id changed
|
||||
Host host = _hostDao.findByGuid(info.getHostUuid());
|
||||
if (host.getId() != vm.getHostId()){
|
||||
if (info != null && vm.getState() == State.Running){
|
||||
// check for host id changes
|
||||
Host host = _hostDao.findByGuid(info.getHostUuid());
|
||||
if (host != null && (vm.getHostId() == null || host.getId() != vm.getHostId())){
|
||||
s_logger.info("Found vm " + vm.getInstanceName() + " with inconsistent host in db, new host is " + host.getId());
|
||||
try {
|
||||
stateTransitTo(vm, VirtualMachine.Event.AgentReportMigrated, host.getId());
|
||||
} catch (NoTransitionException e) {
|
||||
|
|
@ -1700,6 +1701,7 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
|
|||
}
|
||||
|
||||
for (final AgentVmInfo left : infos.values()) {
|
||||
if (VirtualMachineName.isValidVmName(left.name)) continue; // if the vm follows cloudstack naming ignore it for stopping
|
||||
try {
|
||||
Host host = _hostDao.findByGuid(left.getHostUuid());
|
||||
if (host != null){
|
||||
|
|
|
|||
Loading…
Reference in New Issue