sureshanaparti commented on code in PR #12970:
URL: https://github.com/apache/cloudstack/pull/12970#discussion_r3055451340


##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtConvertInstanceCommandWrapper.java:
##########
@@ -84,61 +91,76 @@ public Answer execute(ConvertInstanceCommand cmd, 
LibvirtComputingResource serve
         logger.info(String.format("(%s) Attempting to convert the instance %s 
from %s to KVM",
                 originalVMName, sourceInstanceName, sourceHypervisorType));
         final String temporaryConvertPath = 
temporaryStoragePool.getLocalPath();
+        final String temporaryConvertUuid = UUID.randomUUID().toString();
+        boolean verboseModeEnabled = 
serverResource.isConvertInstanceVerboseModeEnabled();
 
-        String ovfTemplateDirOnConversionLocation;
-        String sourceOVFDirPath;
+        boolean cleanupSecondaryStorage = false;
         boolean ovfExported = false;
-        if (cmd.getExportOvfToConversionLocation()) {
-            String exportInstanceOVAUrl = 
getExportInstanceOVAUrl(sourceInstance, originalVMName);
-            if (StringUtils.isBlank(exportInstanceOVAUrl)) {
-                String err = String.format("Couldn't export OVA for the VM %s, 
due to empty url", sourceInstanceName);
-                logger.error(String.format("(%s) %s", originalVMName, err));
-                return new Answer(cmd, false, err);
-            }
+        String ovfTemplateDirOnConversionLocation = null;
 
-            int noOfThreads = cmd.getThreadsCountToExportOvf();
-            if (noOfThreads > 1 && 
!serverResource.ovfExportToolSupportsParallelThreads()) {
-                noOfThreads = 0;
-            }
-            ovfTemplateDirOnConversionLocation = UUID.randomUUID().toString();
-            
temporaryStoragePool.createFolder(ovfTemplateDirOnConversionLocation);
-            sourceOVFDirPath = String.format("%s/%s/", temporaryConvertPath, 
ovfTemplateDirOnConversionLocation);
-            ovfExported = exportOVAFromVMOnVcenter(exportInstanceOVAUrl, 
sourceOVFDirPath, noOfThreads, originalVMName, timeout);
-            if (!ovfExported) {
-                String err = String.format("Export OVA for the VM %s failed", 
sourceInstanceName);
-                logger.error(String.format("(%s) %s", originalVMName, err));
-                return new Answer(cmd, false, err);
-            }
-            sourceOVFDirPath = String.format("%s%s/", sourceOVFDirPath, 
sourceInstanceName);
-        } else {
-            ovfTemplateDirOnConversionLocation = 
cmd.getTemplateDirOnConversionLocation();
-            sourceOVFDirPath = String.format("%s/%s/", temporaryConvertPath, 
ovfTemplateDirOnConversionLocation);
-        }
+        try {
+            boolean result;
+            if (useVddk) {
+                logger.info("({}) Using VDDK-based conversion (direct from 
VMware)", originalVMName);
+                String vddkLibDir = resolveVddkSetting(cmd.getVddkLibDir(), 
serverResource.getVddkLibDir());
+                if (StringUtils.isBlank(vddkLibDir)) {
+                    String err = String.format("VDDK lib dir is not configured 
on the host. " +
+                            "Set '%s' in agent.properties to use VDDK-based 
conversion.", "vddk.lib.dir");

Review Comment:
   ```suggestion
                               "Set '%s' in agent.properties or in details 
parameter of the import api calll to use VDDK-based conversion.", 
"vddk.lib.dir");
   ```



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to