bug 11263: only update host Id when VM is in running state when detected external VM migration

This commit is contained in:
Kelven Yang 2011-08-26 16:24:33 -07:00
parent de4e5ea02f
commit bf814aeadd
1 changed files with 10 additions and 3 deletions

View File

@ -1577,13 +1577,20 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
}
}
if(vm.getHostId() == null || hostId != vm.getHostId()) {
if(serverState == State.Running) {
try {
stateTransitTo(vm, VirtualMachine.Event.AgentReportMigrated, hostId);
if(hostId != vm.getHostId()) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("detected host change when VM " + vm + " is at running state, VM could be live-migrated externally from host "
+ vm.getHostId() + " to host " + hostId);
}
stateTransitTo(vm, VirtualMachine.Event.AgentReportMigrated, hostId);
}
} catch (NoTransitionException e) {
s_logger.warn(e.getMessage());
}
}
}
}
if (agentState == serverState) {