Merge pull request #2002 from sudhansu7/CLOUDSTACK-9831

CLOUDSTACK-9831: Previous pod_id still remains in the vm_instance table
This commit is contained in:
Rajani Karuturi 2017-05-17 10:11:14 +05:30 committed by GitHub
commit 6dd2ebea62
1 changed files with 3 additions and 0 deletions

View File

@ -2298,8 +2298,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
work.setResourceId(destHostId);
work = _workDao.persist(work);
// Put the vm in migrating state.
vm.setLastHostId(srcHostId);
vm.setPodIdToDeployIn(destHost.getPodId());
moveVmToMigratingState(vm, destHostId, work);
boolean migrated = false;
@ -2376,6 +2378,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
"Migrate Command failed. Please check logs.");
try {
_agentMgr.send(destHostId, new Commands(cleanup(vm.getInstanceName())), null);
vm.setPodIdToDeployIn(srcHost.getPodId());
stateTransitTo(vm, Event.OperationFailed, srcHostId);
} catch (final AgentUnavailableException e) {
s_logger.warn("Looks like the destination Host is unavailable for cleanup.", e);