DaanHoogland 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_r286854454
##########
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:
ok, as said it is a matter of style but we have that boolean to decide:
clonedWorkerVMNeeded
----------------------------------------------------------------
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