Merge branch '4.16' into main

This commit is contained in:
Suresh Kumar Anaparti 2022-02-11 22:32:37 +05:30
commit 48b1e73573
No known key found for this signature in database
GPG Key ID: D7CEAE3A9E71D0AA

View File

@ -2750,6 +2750,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
_networkMgr.commitNicForMigration(vmSrc, profile);
volumeMgr.release(vm.getId(), srcHostId);
_networkMgr.setHypervisorHostname(profile, dest, true);
updateVmPod(vm, dstHostId);
}
work.setStep(Step.Done);
@ -2757,6 +2759,14 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
}
}
private void updateVmPod(VMInstanceVO vm, long dstHostId) {
// update the VMs pod
HostVO host = _hostDao.findById(dstHostId);
VMInstanceVO newVm = _vmDao.findById(vm.getId());
newVm.setPodIdToDeployIn(host.getPodId());
_vmDao.persist(newVm);
}
/**
* We create the mapping of volumes and storage pool to migrate the VMs according to the information sent by the user.
* 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)}
@ -4333,6 +4343,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
}
} else {
_networkMgr.setHypervisorHostname(profile, dest, true);
updateVmPod(vm, dstHostId);
}
work.setStep(Step.Done);