abh1sar commented on code in PR #14266:
URL: https://github.com/apache/cloudstack/pull/14266#discussion_r4146965973


##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtRestoreBackupCommandWrapper.java:
##########
@@ -431,14 +431,16 @@ private boolean attachRbdVolumeToVm(KVMStoragePoolManager 
storagePoolMgr, String
     }
 
     private String getDeviceToAttachDisk(String vmName) {
-        String[] domblkCmd = new String[] { 
Script.getExecutableAbsolutePath("virsh"), "domblklist", "--domain", vmName };
-        String[] tailCmd = new String[] { 
Script.getExecutableAbsolutePath("tail"), "-n", "3" };
-        String[] headCmd = new String[] { 
Script.getExecutableAbsolutePath("head"), "-n", "1" };
+        // --details adds a Type column so cdrom slots (hdc, hdd) can be 
filtered out — they sort

Review Comment:
   The comment here is not right. --details doesn't change the ordering in any 
way:
   ```
   
   [root@ref-trl-12455-k-Mr9-abhisar-sinha-kvm1 ~]# virsh  domblklist --domain  
i-2-5-VM --details
    Type   Device   Target   Source
   
----------------------------------------------------------------------------------------------------------
    file   disk     vda      
/mnt/eaae5267-a60a-369d-a4da-a13db16e3aa2/250bd073-3a2c-4875-9ba0-29bf632801b7
    file   disk     vdb      
/mnt/eaae5267-a60a-369d-a4da-a13db16e3aa2/6f259e43-74a5-461e-b857-e945bcff7b45
    file   disk     vdc      
/mnt/eaae5267-a60a-369d-a4da-a13db16e3aa2/bca15b84-3acf-4b1d-8466-3866e563c21f
    file   cdrom    hdc      -
    file   cdrom    hdd      -
   
   [root@ref-trl-12455-k-Mr9-abhisar-sinha-kvm1 ~]# virsh  domblklist --domain  
i-2-5-VM 
    Target   Source
   
------------------------------------------------------------------------------------------
    vda      
/mnt/eaae5267-a60a-369d-a4da-a13db16e3aa2/250bd073-3a2c-4875-9ba0-29bf632801b7
    vdb      
/mnt/eaae5267-a60a-369d-a4da-a13db16e3aa2/6f259e43-74a5-461e-b857-e945bcff7b45
    vdc      
/mnt/eaae5267-a60a-369d-a4da-a13db16e3aa2/bca15b84-3acf-4b1d-8466-3866e563c21f
    hdc      -
    hdd      -
   
   [root@ref-trl-12455-k-Mr9-abhisar-sinha-kvm1 ~]# 
   ```
   --details does add the type Device column (not Type) which  `awk 
$2==\"disk\"` uses to filter by type.
   
   



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