On Fri, Mar 18, 2022 at 10:13 AM Sandro Bonazzola <sbona...@redhat.com> wrote:
> I got a question on oVirt Itala Telegram group about how to get which LUNs > are used by the disks attached to a specific VMs. > This information doesn't seem to be exposed in API or within the engine DB. > Has anybody ever tried something like this? > We don't expose this, but you can find it using lvm. For example for disk id c5401e6c-9c56-4ddf-b57a-efde3f8b0494 # lvs -o vg_name,lv_name,devices --devicesfile='' --select 'lv_tags = {IU_c5401e6c-9c56-4ddf-b57a-efde3f8b0494}' VG LV Devices aecec81f-d464-4a35-9a91-6acf2ca4938c dea573e4-734c-405c-9c2c-590dac63122c /dev/mapper/36001405351b21217d814266b5354d710(141) 141 is the first extent used by the disk on the device /dev/mapper/36001405351b21217d814266b5354d710. A disk with snapshots can have many logical volumes. Each logical volume can use one or more luns in the storage domain. The example works with oVirt 4.5, using lvmdevices. For older versions using lvm filter you can use: --config 'devices { filter = ["|.*|" ] }' This info is not static, lvm may move data around, so we cannot keep it in engine db. Getting the info is pretty cheap, one lvs command can return the info for all disks in a storage domain. Nir
_______________________________________________ Devel mailing list -- devel@ovirt.org To unsubscribe send an email to devel-le...@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/devel@ovirt.org/message/HROXAM3ISRLNCSCJXMAC5QYEHUZB5RDS/