cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From likit...@apache.org
Subject git commit: updated refs/heads/master to b8fdda0
Date Thu, 13 Nov 2014 07:42:50 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 5d094e5ca -> b8fdda0a3


BUG-ID: CLOUDSTACK-7102. Volume migration fails with 'VM i-2-3-VM does not exist in VMware
datacenter' expection.
Look for a VM in vCenter based on both the vCenter name and CS internal name (required in
case 'vm.instancename.flag' is enabled).
During Attach Volume and Volume Migration, for lookup and other operations use VM's name as
obtained from vCenter instead of using the name set in the agent command.


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

Branch: refs/heads/master
Commit: b8fdda0a34f5338db284ee616c5e04206c97b82e
Parents: 5d094e5
Author: Likitha Shetty <likitha.shetty@citrix.com>
Authored: Tue Oct 28 16:38:18 2014 +0530
Committer: Likitha Shetty <likitha.shetty@citrix.com>
Committed: Thu Nov 13 12:58:56 2014 +0530

----------------------------------------------------------------------
 .../vmware/resource/VmwareResource.java           |  6 ++++--
 .../storage/resource/VmwareStorageProcessor.java  |  1 +
 .../cloud/hypervisor/vmware/mo/DatacenterMO.java  | 18 ++++++------------
 3 files changed, 11 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8fdda0a/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 7406ca0..6596057 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
@@ -2904,7 +2904,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
         }
 
         VirtualMachineTO vmTo = cmd.getVirtualMachine();
-        final String vmName = vmTo.getName();
+        String vmName = vmTo.getName();
 
         VmwareHypervisorHost srcHyperHost = null;
         VmwareHypervisorHost tgtHyperHost = null;
@@ -2954,6 +2954,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
                 s_logger.error(msg);
                 throw new Exception(msg);
             }
+            vmName = vmMo.getName();
 
             // Get details of each target datastore & attach to source host.
             for (Entry<VolumeTO, StorageFilerTO> entry : volToFiler.entrySet()) {
@@ -3083,7 +3084,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
             s_logger.info("Executing resource MigrateVolumeCommand: " + _gson.toJson(cmd));
         }
 
-        final String vmName = cmd.getAttachedVmName();
+        String vmName = cmd.getAttachedVmName();
 
         VirtualMachineMO vmMo = null;
         VmwareHypervisorHost srcHyperHost = null;
@@ -3110,6 +3111,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
                 s_logger.error(msg);
                 throw new Exception(msg);
             }
+            vmName = vmMo.getName();
             morDs = HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(srcHyperHost,
tgtDsName);
             if (morDs == null) {
                 String msg = "Unable to find the mounted datastore with name " + tgtDsName
+ " to execute MigrateVolumeCommand";

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8fdda0a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
index 1a39410..b256ae3 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
@@ -1299,6 +1299,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
                 s_logger.error(msg);
                 throw new Exception(msg);
             }
+            vmName = vmMo.getName();
 
             ManagedObjectReference morDs = null;
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8fdda0a/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatacenterMO.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatacenterMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatacenterMO.java
index ef13783..39a30be 100755
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatacenterMO.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatacenterMO.java
@@ -82,19 +82,13 @@ public class DatacenterMO extends BaseMO {
     }
 
     public VirtualMachineMO findVm(String vmName) throws Exception {
-        List<ObjectContent> ocs = getVmPropertiesOnDatacenterVmFolder(new String[]
{"name"});
-        if (ocs != null && ocs.size() > 0) {
-            for (ObjectContent oc : ocs) {
-                List<DynamicProperty> props = oc.getPropSet();
-                if (props != null) {
-                    for (DynamicProperty prop : props) {
-                        if (prop.getVal().toString().equals(vmName))
-                            return new VirtualMachineMO(_context, oc.getObj());
-                    }
-                }
-            }
+        int key = getCustomFieldKey("VirtualMachine", CustomFieldConstants.CLOUD_VM_INTERNAL_NAME);
+        if (key == 0) {
+            s_logger.warn("Custom field " + CustomFieldConstants.CLOUD_VM_INTERNAL_NAME +
" is not registered ?!");
         }
-        return null;
+        String instanceNameCustomField = "value[" + key + "]";
+        List<ObjectContent> ocs = getVmPropertiesOnDatacenterVmFolder(new String[]
{"name", instanceNameCustomField});
+        return HypervisorHostHelper.findVmFromObjectContent(_context, ocs.toArray(new ObjectContent[0]),
vmName, instanceNameCustomField);
     }
 
     public List<VirtualMachineMO> findVmByNameAndLabel(String vmLabel) throws Exception
{


Mime
View raw message