On Fri, Mar 18, 2022 at 10:13 AM Sandro Bonazzola <sbona...@redhat.com>

> 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 =
  VG                                   LV
  aecec81f-d464-4a35-9a91-6acf2ca4938c dea573e4-734c-405c-9c2c-590dac63122c

141 is the first extent used by the disk on the device

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.

Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-le...@ovirt.org
Privacy Statement: https://www.ovirt.org/privacy-policy.html
oVirt Code of Conduct: 
List Archives: 

Reply via email to