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 Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/af175d8c Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/af175d8c Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/af175d8c Branch: refs/heads/ldapplugin Commit: af175d8c65728dc3c7f29241e936decdec67e936 Parents: 92eb84c Author: Prachi Damle <[email protected]> Authored: Wed Aug 28 15:54:30 2013 -0700 Committer: Prachi Damle <[email protected]> Committed: Wed Aug 28 17:03:24 2013 -0700 ---------------------------------------------------------------------- server/src/com/cloud/vm/UserVmManagerImpl.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af175d8c/server/src/com/cloud/vm/UserVmManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index 103fd0b..20f5fda 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -3917,6 +3917,18 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir + destinationHost.getResourceState()); } + if (vm.getType() != VirtualMachine.Type.User) { + // for System VMs check that the destination host is within the same + // cluster + HostVO srcHost = _hostDao.findById(srcHostId); + if (srcHost != null && srcHost.getClusterId() != null && destinationHost.getClusterId() != null) { + if (srcHost.getClusterId().longValue() != destinationHost.getClusterId().longValue()) { + throw new InvalidParameterValueException( + "Cannot migrate the VM, destination host is not in the same cluster as current host of the VM"); + } + } + } + checkHostsDedication(vm, srcHostId, destinationHost.getId()); // call to core process
