Skip to content

Commit 72a3cbb

Browse files
Prachi Damlechaturvedia
authored andcommitted
CLOUDSTACK-4528 [Vmware] new mapping vmware datacenter cloudstack zone - Virtual Router host migration across cluster FAIL
Change: - Also add a check in migrateSystemVM API to check that source and destination host are in the same cluster (cherry picked from commit b24e9a6) Signed-off-by: animesh <animesh@apache.org>
1 parent cd592f5 commit 72a3cbb

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎server/src/com/cloud/vm/UserVmManagerImpl.java‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3950,6 +3950,18 @@ public VirtualMachine migrateVirtualMachine(Long vmId, Host destinationHost)
39503950
+ destinationHost.getResourceState());
39513951
}
39523952

3953+
if (vm.getType() != VirtualMachine.Type.User) {
3954+
// for System VMs check that the destination host is within the same
3955+
// cluster
3956+
HostVO srcHost = _hostDao.findById(srcHostId);
3957+
if (srcHost != null && srcHost.getClusterId() != null && destinationHost.getClusterId() != null) {
3958+
if (srcHost.getClusterId().longValue() != destinationHost.getClusterId().longValue()) {
3959+
throw new InvalidParameterValueException(
3960+
"Cannot migrate the VM, destination host is not in the same cluster as current host of the VM");
3961+
}
3962+
}
3963+
}
3964+
39533965
checkHostsDedication(vm, srcHostId, destinationHost.getId());
39543966

39553967
// call to core process

0 commit comments

Comments
 (0)