From 3564d30233184161df64e8aaee5ad96917cf8a1d Mon Sep 17 00:00:00 2001 From: Sudhansu Date: Mon, 13 Mar 2017 13:14:12 +0530 Subject: [PATCH] CLOUDSTACK-9831: Previous pod_id still remains in the vm_instance table after VM migration with migrateVirtualMachineWithVolume --- .../src/com/cloud/vm/VirtualMachineManagerImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java index d19aaf372cc..e2394aabb57 100755 --- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -2287,8 +2287,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; @@ -2365,6 +2367,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);