Comment 3 for bug 1807505

Revision history for this message
Dmitrii Shcherbakov (dmitriis) wrote : Re: [2.5rc2] serial of a device is not populated for virtio-blk devices

For a virtio-blk device without a serial specified in domain xml, ID_SERIAL is not auto-generated based on businfo:

udevadm info --query=property --name /dev/vda
DEVLINKS=/dev/disk/by-path/pci-0000:06:00.0 /dev/disk/by-path/virtio-pci-0000:06:00.0
DEVNAME=/dev/vda
DEVPATH=/devices/pci0000:00/0000:00:02.5/0000:06:00.0/virtio5/block/vda
DEVTYPE=disk
ID_PATH=pci-0000:06:00.0
ID_PATH_TAG=pci-0000_06_00_0
MAJOR=252
MINOR=0
SUBSYSTEM=block
TAGS=:systemd:
USEC_INITIALIZED=69719445

This is in contrast to virtio-scsi devices for which it is:

# no serial - businfo based ID_SERIAL and ID_SERIAL_SHORT are generated automatically
ubuntu@maas-vhost6:~$ udevadm info --query=property --name /dev/sda | grep ID_SERIAL
ID_SERIAL=0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-0
ID_SERIAL_SHORT=drive-scsi0-0-0-0

    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/mnt/sec1/libvirt-images/vhost6.qcow2'/>
      <target dev='sda' bus='scsi'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

# has serial - ID_SERIAL and ID_SERIAL_SHORT are used based on the serial provided to qemu via libvirt
ubuntu@maas-vhost6:~$ udevadm info --query=property --name /dev/sdb | grep ID_SERIAL
ID_SERIAL=0QEMU_QEMU_HARDDISK_disk0
ID_SERIAL_SHORT=disk0

    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/mnt/sec1/libvirt-images/maas-vhost6.qcow2'/>
      <target dev='sdb' bus='scsi'/>
      <serial>disk0</serial>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>