You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2019/05/23 09:20:38 UTC

[GitHub] [cloudstack] rhtyd commented on a change in pull request #3218: [WIP DO NOT MERGE] vmware: don't use redundant worker VM to extract volume

rhtyd commented on a change in pull request #3218: [WIP DO NOT MERGE] vmware: don't use redundant worker VM to extract volume
URL: https://github.com/apache/cloudstack/pull/3218#discussion_r286851911
 
 

 ##########
 File path: plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
 ##########
 @@ -961,16 +961,19 @@ private void exportVolumeToSecondaryStroage(VirtualMachineMO vmMo, String volume
                 throw new Exception(msg);
             }
 
-            // 4 MB is the minimum requirement for VM memory in VMware
-            vmMo.cloneFromCurrentSnapshot(workerVmName, 0, 4, volumeDeviceInfo.second(), VmwareHelper.getDiskDeviceDatastore(volumeDeviceInfo.first()));
-            clonedVm = vmMo.getRunningHost().findVmOnHyperHost(workerVmName);
-            if (clonedVm == null) {
-                String msg = "Unable to create dummy VM to export volume. volume path: " + volumePath;
-                s_logger.error(msg);
-                throw new Exception(msg);
+            if (clonedWorkerVMNeeded) {
+                // 4 MB is the minimum requirement for VM memory in VMware
+                vmMo.cloneFromCurrentSnapshot(workerVmName, 0, 4, volumeDeviceInfo.second(), VmwareHelper.getDiskDeviceDatastore(volumeDeviceInfo.first()));
+                clonedVm = vmMo.getRunningHost().findVmOnHyperHost(workerVmName);
+                if (clonedVm == null) {
+                    String msg = "Unable to create dummy VM to export volume. volume path: " + volumePath;
+                    s_logger.error(msg);
+                    throw new Exception(msg);
+                }
+                clonedVm.exportVm(exportPath, exportName, false, false);  //Note: volss: not to create ova.
 
 Review comment:
   It's because, if we need to clone i.e. require a worker VM `clonedVm`, then in finally we need to detach and destroy that worker VM. This is why we cannot refactor them to use a single variable.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services