[2.x] Consider using ID_SERIAL if ID_SERIAL_SHORT is not set for virtio storage devices
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Opinion
|
Undecided
|
Newell Jensen |
Bug Description
Created a domain with a number of different devices (virtio-blk, virtio-scsi, sata, NVMe) and added <serial/> tag to all of them for testing of lp:1735839. Querying udev, I can see that ID_SERIAL is set but MAAS does not use it to populate the "serial" field during commissioning.
The reason is that only ID_SERIAL_SHORT is collected by MAAS, not ID_SERIAL and it is not present for virtio-blk devices (even if it is provided via QEMU).
https:/
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/
<
<target dev='vda' bus='virtio'/>
<
<alias name='virtio-
<address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/
<
<target dev='vdb' bus='virtio'/>
<
<alias name='virtio-
<address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
</disk>
ubuntu@
ID_SERIAL=disk2
ubuntu@
ID_SERIAL=disk3
Looking at the full output I can see that in the udev output there is no ID_SERIAL_SHORT for virtio devices:
udevadm info --query=property --name /dev/vda
DEVLINKS=
DEVNAME=/dev/vda
DEVPATH=
DEVTYPE=disk
ID_PATH=
ID_PATH_
ID_SERIAL=disk2
MAJOR=252
MINOR=0
SUBSYSTEM=block
TAGS=:systemd:
USEC_INITIALIZE
And ID_SERIAL_SHORT is something that MAAS collects in provisioning scripts for block devices:
https:/
# Grab the device path, serial number, and sata connection.
UDEV_MAPPINGS = {
"DEVNAME": "PATH",
"DEVPATH": "DEVPATH",
As a result the serial field is empty for virtio devices (noticed first by looking at the UI):
https:/
{
"name": "vda",
# ...
"path": "/dev/disk/
# ...
description: | updated |
description: | updated |
Changed in maas: | |
milestone: | 2.5.1 → 2.5.2 |
Changed in maas: | |
assignee: | nobody → Newell Jensen (newell-jensen) |
Changed in maas: | |
milestone: | 2.5.2 → 2.5.3 |
Changed in maas: | |
milestone: | 2.5.3 → 2.5.4 |
Changed in maas: | |
milestone: | 2.5.4 → none |
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 /dev/disk/ by-path/ pci-0000: 06:00.0 /dev/disk/ by-path/ virtio- pci-0000: 06:00.0 /devices/ pci0000: 00/0000: 00:02.5/ 0000:06: 00.0/virtio5/ block/vda pci-0000: 06:00.0 TAG=pci- 0000_06_ 00_0 D=69719445
DEVLINKS=
DEVNAME=/dev/vda
DEVPATH=
DEVTYPE=disk
ID_PATH=
ID_PATH_
MAJOR=252
MINOR=0
SUBSYSTEM=block
TAGS=:systemd:
USEC_INITIALIZE
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 maas-vhost6: ~$ udevadm info --query=property --name /dev/sda | grep ID_SERIAL 0QEMU_QEMU_ HARDDISK_ drive-scsi0- 0-0-0 SHORT=drive- scsi0-0- 0-0
ubuntu@
ID_SERIAL=
ID_SERIAL_
<disk type='file' device='disk'> mnt/sec1/ libvirt- images/ vhost6. qcow2'/ >
<driver name='qemu' type='qcow2'/>
<source file='/
<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 maas-vhost6: ~$ udevadm info --query=property --name /dev/sdb | grep ID_SERIAL 0QEMU_QEMU_ HARDDISK_ disk0 SHORT=disk0
ubuntu@
ID_SERIAL=
ID_SERIAL_
<disk type='file' device='disk'> mnt/sec1/ libvirt- images/ maas-vhost6. qcow2'/ > serial> disk0</ serial>
<driver name='qemu' type='qcow2'/>
<source file='/
<target dev='sdb' bus='scsi'/>
<
<address type='drive' controller='0' bus='0' target='0' unit='1'/>
</disk>