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 b24e9a6dd5281b2163ce088e6f5b1fa730c33f7d)

Signed-off-by: animesh <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/72a3cbb8
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/72a3cbb8
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/72a3cbb8

Branch: refs/heads/4.2
Commit: 72a3cbb82e5d6fa620bbcf110416b295ff99a635
Parents: cd592f5
Author: Prachi Damle <[email protected]>
Authored: Wed Aug 28 15:54:30 2013 -0700
Committer: animesh <[email protected]>
Committed: Tue Sep 3 15:57:52 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/72a3cbb8/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 ce77630..251c203 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -3950,6 +3950,18 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
                             + 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

Reply via email to