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 2021/09/24 12:13:38 UTC

[GitHub] [cloudstack] harikrishna-patnala commented on a change in pull request #5510: Fix export snapshot and template to secondary storage to export only required disk

harikrishna-patnala commented on a change in pull request #5510:
URL: https://github.com/apache/cloudstack/pull/5510#discussion_r715559992



##########
File path: plugins/hypervisors/vmware/src/main/java/com/cloud/storage/resource/VmwareStorageProcessor.java
##########
@@ -1849,6 +1854,19 @@ public Answer createTemplateFromSnapshot(CopyCommand cmd) {
         }
     }
 
+    private void checkIfVMHasOnlyRequiredDisk(VirtualMachineMO clonedVm, VirtualDisk requiredDisk) throws Exception {
+
+        s_logger.info(String.format("Checking if Cloned VM %s is created only with required Disk, if not detach the remaining disks", clonedVm.getName()));
+        VirtualDisk[] vmDisks = clonedVm.getAllDiskDevice();
+        if (vmDisks.length != 1) {
+            String baseName = VmwareHelper.getDiskDeviceFileName(requiredDisk);
+            s_logger.info(String.format("Detaching all disks for the cloned VM: %s except disk with base name: %s, key=%d", clonedVm.getName(), baseName, requiredDisk.getKey()));
+            clonedVm.detachAllDisksExcept(VmwareHelper.getDiskDeviceFileName(requiredDisk), null);

Review comment:
       I'll try to keep it in same method. Thanks Suresh




-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org