Skip to content

Commit af175d8

Browse files
author
Prachi Damle
committed
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
1 parent 92eb84c commit af175d8

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
@@ -3917,6 +3917,18 @@ public VirtualMachine migrateVirtualMachine(Long vmId, Host destinationHost)
39173917
+ destinationHost.getResourceState());
39183918
}
39193919

3920+
if (vm.getType() != VirtualMachine.Type.User) {
3921+
// for System VMs check that the destination host is within the same
3922+
// cluster
3923+
HostVO srcHost = _hostDao.findById(srcHostId);
3924+
if (srcHost != null && srcHost.getClusterId() != null && destinationHost.getClusterId() != null) {
3925+
if (srcHost.getClusterId().longValue() != destinationHost.getClusterId().longValue()) {
3926+
throw new InvalidParameterValueException(
3927+
"Cannot migrate the VM, destination host is not in the same cluster as current host of the VM");
3928+
}
3929+
}
3930+
}
3931+
39203932
checkHostsDedication(vm, srcHostId, destinationHost.getId());
39213933

39223934
// call to core process

0 commit comments

Comments
 (0)