Skip to content

Commit 8db598b

Browse files
DaanHooglandDaan Hoogland
andauthored
set pod after migration (apache#5972)
Co-authored-by: Daan Hoogland <dahn@onecht.net>
1 parent 5297b52 commit 8db598b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2849,13 +2849,23 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy
28492849
_networkMgr.commitNicForMigration(vmSrc, profile);
28502850
volumeMgr.release(vm.getId(), srcHostId);
28512851
_networkMgr.setHypervisorHostname(profile, dest, true);
2852+
2853+
updateVmPod(vm, dstHostId);
28522854
}
28532855

28542856
work.setStep(Step.Done);
28552857
_workDao.update(work.getId(), work);
28562858
}
28572859
}
28582860

2861+
private void updateVmPod(VMInstanceVO vm, long dstHostId) {
2862+
// update the VMs pod
2863+
HostVO host = _hostDao.findById(dstHostId);
2864+
VMInstanceVO newVm = _vmDao.findById(vm.getId());
2865+
newVm.setPodIdToDeployIn(host.getPodId());
2866+
_vmDao.persist(newVm);
2867+
}
2868+
28592869
/**
28602870
* We create the mapping of volumes and storage pool to migrate the VMs according to the information sent by the user.
28612871
* If the user did not enter a complete mapping, the volumes that were left behind will be auto mapped using {@link #createStoragePoolMappingsForVolumes(VirtualMachineProfile, DataCenterDeployment, Map, List)}
@@ -4583,6 +4593,8 @@ private void orchestrateMigrateForScale(final String vmUuid, final long srcHostI
45834593
}
45844594
} else {
45854595
_networkMgr.setHypervisorHostname(profile, dest, true);
4596+
4597+
updateVmPod(vm, dstHostId);
45864598
}
45874599

45884600
work.setStep(Step.Done);

0 commit comments

Comments
 (0)