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_r269078559
##########
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:
how about unifying both calls by assigning the clonedVm or vmMo to a local
var, so it is obvious where the real work is done in both cases?
----------------------------------------------------------------
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