Updated Branches:
  refs/heads/4.2 8babd390d -> e280d24d1

CLOUDSTACK-4385 : [ZWPS]Across the cluster live migration of VM on zone wide 
primary storage pool fails

If all the VM's volumes are on zone wide primary storage pool then live 
migration of the VM would not involve storage migration. Hence MigrateVM API 
would be called against MigrateVMWithVolume. So far PrepareForMigrationCommand 
handled scenarios of VM moving across hosts within a cluster, but with zone 
wide primary storage in picture this command need to handle scenarios of VM 
moving across clusters. Try to find the VM in datacenter if not found within 
cluster.

Signed-off-by: Sateesh Chodapuneedi <[email protected]>


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

Branch: refs/heads/4.2
Commit: dd5ea8f2aa86221c67e66cc83b8c1e2f003f4066
Parents: 3c40e8b
Author: Sateesh Chodapuneedi <[email protected]>
Authored: Mon Aug 19 05:52:13 2013 +0530
Committer: Sateesh Chodapuneedi <[email protected]>
Committed: Mon Aug 19 05:52:13 2013 +0530

----------------------------------------------------------------------
 .../hypervisor/vmware/resource/VmwareResource.java      | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd5ea8f2/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
 
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index 1c5e7b6..9cb6115 100755
--- 
a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ 
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -3794,9 +3794,15 @@ public class VmwareResource implements 
StoragePoolResource, ServerResource, Vmwa
             // find VM through datacenter (VM is not at the target host yet)
             VirtualMachineMO vmMo = hyperHost.findVmOnPeerHyperHost(vmName);
             if (vmMo == null) {
-                String msg = "VM " + vmName + " does not exist in VMware 
datacenter";
-                s_logger.error(msg);
-                throw new Exception(msg);
+                s_logger.info("VM " + vmName + " was not found in the cluster 
of host " + hyperHost.getHyperHostName() + ". Looking for the VM in 
datacenter.");
+                ManagedObjectReference dcMor = 
hyperHost.getHyperHostDatacenter();
+                DatacenterMO dcMo = new DatacenterMO(hyperHost.getContext(), 
dcMor);
+                vmMo = dcMo.findVm(vmName);
+                if (vmMo == null) {
+                    String msg = "VM " + vmName + " does not exist in VMware 
datacenter";
+                    s_logger.error(msg);
+                    throw new Exception(msg);
+                }
             }
 
             NicTO[] nics = vm.getNics();

Reply via email to