DaanHoogland commented on a change in pull request #3218: vmware: don't use 
redundant worker VM to extract volume
URL: https://github.com/apache/cloudstack/pull/3218#discussion_r269081602
 
 

 ##########
 File path: 
plugins/hypervisors/vmware/src/main/java/com/cloud/storage/resource/VmwareStorageProcessor.java
 ##########
 @@ -999,15 +1000,18 @@ private String getVolumePathInDatastore(DatastoreMO 
dsMo, String volumeFileName,
                 String datastoreVolumePath = getVolumePathInDatastore(dsMo, 
volumePath + ".vmdk", searchExcludedFolders);
                 workerVm.attachDisk(new String[] {datastoreVolumePath}, morDs);
                 vmMo = workerVm;
+                clonedWorkerVMNeeded = false;
+            } else {
+                vmMo.createSnapshot(exportName, "Temporary snapshot for 
copy-volume command", false, false);
             }
 
-            vmMo.createSnapshot(exportName, "Temporary snapshot for 
copy-volume command", false, false);
-
-            exportVolumeToSecondaryStroage(vmMo, volumePath, secStorageUrl, 
destVolumePath, exportName, hostService.getWorkerName(hyperHost.getContext(), 
cmd, 1), _nfsVersion);
+            exportVolumeToSecondaryStorage(vmMo, volumePath, secStorageUrl, 
destVolumePath, exportName, hostService.getWorkerName(hyperHost.getContext(), 
cmd, 1), _nfsVersion, clonedWorkerVMNeeded);
             return new Pair<>(destVolumePath, exportName);
 
         } finally {
-            vmMo.removeSnapshot(exportName, false);
+            if (vmMo != null && vmMo.getSnapshotMor(exportName) != null) {
+                vmMo.removeSnapshot(exportName, false);
+            }
             if (workerVm != null) {
 
 Review comment:
   same here as in VmwareStorageManagerImpl.java#1020; if we move 
clonedWorkerVMNeeded outside the try block we don't need this extra workerVm

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to