Updated Branches:
  refs/heads/master 66d761506 -> 41f2c75ae

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/41f2c75a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/41f2c75a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/41f2c75a

Branch: refs/heads/master
Commit: 41f2c75aee69dc15de2acd0199ac7318ab3f291e
Parents: 66d7615
Author: Sateesh Chodapuneedi <[email protected]>
Authored: Mon Aug 19 05:52:13 2013 +0530
Committer: Sateesh Chodapuneedi <[email protected]>
Committed: Mon Aug 19 05:55:17 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/41f2c75a/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 1438111..5ab2216 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
@@ -3723,9 +3723,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