From 3513d70d7fa7e3739f88f7d8128b98409ad193e3 Mon Sep 17 00:00:00 2001 From: Tao Liu Date: Thu, 27 Oct 2022 17:47:19 +0800 Subject: [PATCH] Output the serial string of virtio disks Previously, the serial string of virtio disks is not outputted. For example we can observe the issue if we have the following virtio disk configuration: vblk1 Before: description: Virtual I/O device physical id: 0 bus info: virtio@3 logical name: /dev/vda size: 8GiB (8589MB) capabilities: partitioned partitioned:dos After: description: Virtual I/O device physical id: 0 bus info: virtio@3 logical name: /dev/vda serial: vblk1 size: 8GiB (8589MB) capabilities: partitioned partitioned:dos Signed-off-by: Tao Liu --- src/core/virtio.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/virtio.cc b/src/core/virtio.cc index 91d1196e..b8d1cb86 100644 --- a/src/core/virtio.cc +++ b/src/core/virtio.cc @@ -26,6 +26,10 @@ static void scan_virtio_block(hwNode & device, const sysfs::entry & entry) if (devname.empty()) return; device.setLogicalName(devname); + vector e = entry.devices(); + if (e.size() == 1) { + device.setSerial(e[0].string_attr("serial")); + } scan_disk(device); device.claim(); }