My Oracle Support Banner

OLVM: How To Retrieve Disk Device Names from a Virtual Machine using Qemu Guest Agent (Doc ID 2924176.1)

Last updated on MARCH 07, 2023

Applies to:

Linux OS - Version Oracle Linux 7.9 and later
Linux x86-64

Goal

In OLVM (and non-OLVM KVM), the disk device names on a VM are not in sync with the VM configuration file or the output of "virsh -r domblklist"

In OLVM there are no persistent VM configuration files readily available. The VM configuration is in the PostgreSQL DB and the VM XML is created when a VM is started.
During the VM runtime, there will be a VM XML in a /var/run subdirectory and in/ etc/libvirt/qemu but those are temporary and will be deleted as soon the VM is stopped.

The VM XML device order or the output of domblklist is one-sided, it is from the VM configuration perspective, and has no relationship to how the devices were assigned to the VM.
The only thing the disk device names are used for is to act as a configuration index and sort the disks in the XML document, it does not reflect the way the kernel assigns the device names.
Linux OS Kernel will assign device names somehow orderly, through PCI addresses (if using virtio-blk), or SCSI bus slots (virtio-scsi), the vm.cfg tries to influence the guest OS kernel in how he should assign the device names.
In a non-OLVM KVM, the VM XML can be freely edited, and the disk PCI Address or SCSI Bus/Slot can be assigned, but in OLVM there is no control over it whatsoever.
Things will become even more disparate when using multiple disks and when hotplugging/unplugging, do not expect the device names inside the guest OS to match the device names in the output of "virsh dumpxml" or "virsh domblklist".

So how can we do it? How can we retrieve how devices are being mounted and are being used by a VM guest OS?

 

Solution

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Goal
Solution


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.