Identifying VirtIO disks in RHEV

When you have a lot of disks attached to a single VM, it can be cumbersome to identify which VM disk is what inside the VM. For example, you might have several 100 GB disks named vde, vdf, vdg and have no obvious way to properly detect which one is the right one.

Say you want to remove your vdd disk, and have it removed from your RHEV environment.

You can check their VirtIO identifier with:

# find /dev/disk/by-id "(" -name "virtio*" -and -not -name "*part*" ")"  -exec ls -l "{}" +
lrwxrwxrwx. 1 root root 9 Mar  8 09:18 /dev/disk/by-id/virtio-38ebb33e-db1c-4048-b -> ../../vdb
lrwxrwxrwx. 1 root root 9 Mar  8 09:18 /dev/disk/by-id/virtio-4d18901c-1dea-414d-b -> ../../vda
lrwxrwxrwx. 1 root root 9 Mar  8 09:18 /dev/disk/by-id/virtio-69c3688d-f8b3-464c-8 -> ../../vdc
lrwxrwxrwx. 1 root root 9 Mar  8 09:18 /dev/disk/by-id/virtio-b1666304-fba1-44a2-a -> ../../vdd

We can confirm the VirtIO identifier for vdd is b1666304-fba1-44a2 .

Now we need to map this to the human-readable names available in the RHEV Web UI. This can be done by leveraging the URL as follows :

# curl --silent -k -u "admin@internal:password" https://server:port/api/vms/UUID/disks | grep -P 'disk href|alias'

    <disk href="/api/vms/VM-UUID/disks/38ebb33e-db1c-4048-a345-e381abc7f8cc" id="c8aad46c-9373-4670-a345-e381abc7f8cc">
    <disk href="/api/vms/VM-UUID/disks/4d18901c-1dea-414d-9cca-811dac616443" id="b7840cff-8f55-4dbb-9cca-811dac616443">
    <disk href="/api/vms/VM-UUID/disks/69c3688d-f8b3-464c-87e1-000e19d85c79" id="e9938a29-b792-4f6e-87e1-000e19d85c79">
    <disk href="/api/vms/VM-UUID/disks/b1666304-fba1-44a2-9cb1-fb4cfcbc19dd" id="9c2df047-343e-484a-9cb1-fb4cfcbc19dd">

The UUID for the instance can be checked in the RHEV Web UI by opening the VMs tab and clicking in the VM name.

Happy hacking! :-)