Skip to content

Conversation

illustris
Copy link

Virtio devices don't have ID_SERIAL_SHORT but do have ID_SERIAL. For example:

$ cat /run/udev/data/b253\:16
S:disk/by-id/virtio-data
S:disk/by-path/pci-0000:00:0b.0
S:disk/by-diskseq/2
S:disk/by-path/virtio-pci-0000:00:0b.0
E:ID_SERIAL=data
E:ID_PATH=pci-0000:00:0b.0
E:ID_PATH_TAG=pci-0000_00_0b_0
...
E:ID_PART_TABLE_TYPE=gpt
G:systemd
Q:systemd
V:1

This change adds a fallback to use ID_SERIAL when ID_SERIAL_SHORT is not available.

Virtio devices don't have ID_SERIAL_SHORT but do have ID_SERIAL.
This change adds a fallback to use ID_SERIAL when ID_SERIAL_SHORT
is not available, allowing serial numbers to be properly exposed
for virtio block devices.

Also updates test expectations to reflect that devices with only
ID_SERIAL (like mmcblk devices in fixtures) now report their serial
numbers instead of empty strings.

Signed-off-by: illustris <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant