bug 11019: Let VM sync to coordinate with possible VM-relocation under VMware when VM is in starting time

This commit is contained in:
Kelven Yang 2011-08-11 14:28:32 -07:00
parent 258a1bc451
commit bbf20ac125
1 changed files with 11 additions and 5 deletions

View File

@ -1554,11 +1554,17 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
}
if(trackExternalChange) {
if(vm.getHostId() == null || hostId != vm.getHostId()) {
try {
stateTransitTo(vm, VirtualMachine.Event.AgentReportMigrated, hostId);
} catch (NoTransitionException e) {
s_logger.warn(e.getMessage());
if(serverState == State.Starting) {
if(vm.getHostId() != null && vm.getHostId() != hostId) {
s_logger.info("CloudStack is starting VM on host " + vm.getHostId() + ", but status report comes from a different host " + hostId + ", skip status sync for vm: " + vm.getInstanceName());
return null;
}
}
if(vm.getHostId() == null || hostId != vm.getHostId()) {
try {
stateTransitTo(vm, VirtualMachine.Event.AgentReportMigrated, hostId);
} catch (NoTransitionException e) {
}
}
}