You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by li...@apache.org on 2014/01/06 10:07:48 UTC

git commit: updated refs/heads/4.3 to 665d036

Updated Branches:
  refs/heads/4.3 ef51def9f -> 665d036e8


CLOUDSTACK-5782. [VMware] Snapshot creation on a detached volume failes with NPE.
For a detached volume, don't try to find the associated VM on the hypervisor/peer hypervisor host.
By default create a worker VM to perform snapshot operations.


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

Branch: refs/heads/4.3
Commit: 665d036e8bdbe97b5bbf3d2d7c64f2bd891d8e1a
Parents: ef51def
Author: Likitha Shetty <li...@citrix.com>
Authored: Mon Jan 6 14:19:31 2014 +0530
Committer: Likitha Shetty <li...@citrix.com>
Committed: Mon Jan 6 14:24:07 2014 +0530

----------------------------------------------------------------------
 .../resource/VmwareStorageProcessor.java        | 42 +++++++++-----------
 1 file changed, 18 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/665d036e/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 07b8db0..0d97709 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
@@ -1030,32 +1030,26 @@ public class VmwareStorageProcessor implements StorageProcessor {
             CopyCmdAnswer answer = null;
 
             try {
-                vmMo = hyperHost.findVmOnHyperHost(vmName);
-                if (vmMo == null) {
-                    if(s_logger.isDebugEnabled()) {
-                        s_logger.debug("Unable to find owner VM for BackupSnapshotCommand on host " + hyperHost.getHyperHostName() + ", will try within datacenter");
-                    }
-
-                    vmMo = hyperHost.findVmOnPeerHyperHost(vmName);
-                    if(vmMo == null) {
-                        dsMo = new DatastoreMO(hyperHost.getContext(), morDs);
-
-                        workerVMName = hostService.getWorkerName(context, cmd, 0);
-
-                        vmMo = HypervisorHostHelper.createWorkerVM(hyperHost, dsMo, workerVMName);
-
-                        if (vmMo == null) {
-                            throw new Exception("Failed to find the newly create or relocated VM. vmName: " + workerVMName);
+                if(vmName != null) {
+                    vmMo = hyperHost.findVmOnHyperHost(vmName);
+                    if (vmMo == null) {
+                        if(s_logger.isDebugEnabled()) {
+                            s_logger.debug("Unable to find owner VM for BackupSnapshotCommand on host " + hyperHost.getHyperHostName() + ", will try within datacenter");
                         }
-                        workerVm = vmMo;
-
-                        // attach volume to worker VM
-                        String datastoreVolumePath = dsMo.getDatastorePath(volumePath + ".vmdk");
-                        vmMo.attachDisk(new String[] { datastoreVolumePath }, morDs);
-                    } else {
-                        s_logger.info("Using owner VM " + vmName + " for snapshot operation");
-                        hasOwnerVm = true;
+                        vmMo = hyperHost.findVmOnPeerHyperHost(vmName);
+                    }
+                }
+                if(vmMo == null) {
+                    dsMo = new DatastoreMO(hyperHost.getContext(), morDs);
+                    workerVMName = hostService.getWorkerName(context, cmd, 0);
+                    vmMo = HypervisorHostHelper.createWorkerVM(hyperHost, dsMo, workerVMName);
+                    if (vmMo == null) {
+                        throw new Exception("Failed to find the newly create or relocated VM. vmName: " + workerVMName);
                     }
+                    workerVm = vmMo;
+                    // attach volume to worker VM
+                    String datastoreVolumePath = dsMo.getDatastorePath(volumePath + ".vmdk");
+                    vmMo.attachDisk(new String[] { datastoreVolumePath }, morDs);
                 } else {
                     s_logger.info("Using owner VM " + vmName + " for snapshot operation");
                     hasOwnerVm = true;