|
|
df3f53 |
From afe6545483a881ccde41dcaa6718c71c74b38d7b Mon Sep 17 00:00:00 2001
|
|
|
df3f53 |
From: Sven Wiltink <swiltink@transip.nl>
|
|
|
df3f53 |
Date: Fri, 1 May 2020 16:35:40 +0200
|
|
|
df3f53 |
Subject: [PATCH 46/55] lsblk: Fall back to ID_SERIAL
|
|
|
df3f53 |
|
|
|
df3f53 |
In some cases ID_SERIAL_SHORT isn't provided by libudev, but ID_SERIAL
|
|
|
df3f53 |
is. An example of this are virtio devices. See the output of udevadm
|
|
|
df3f53 |
info:
|
|
|
df3f53 |
P: /devices/pci0000:00/0000:00:06.0/virtio2/block/vdb
|
|
|
df3f53 |
N: vdb
|
|
|
df3f53 |
S: disk/by-id/virtio-08491434ee711d3420e9
|
|
|
df3f53 |
S: disk/by-path/pci-0000:00:06.0
|
|
|
df3f53 |
S: disk/by-path/virtio-pci-0000:00:06.0
|
|
|
df3f53 |
E: DEVLINKS=/dev/disk/by-id/virtio-08491434ee711d3420e9 /dev/disk/by-path/pci-0000:00:06.0 /dev/disk/by-path/virtio-pci-0000:00:06.0
|
|
|
df3f53 |
E: DEVNAME=/dev/vdb
|
|
|
df3f53 |
E: DEVPATH=/devices/pci0000:00/0000:00:06.0/virtio2/block/vdb
|
|
|
df3f53 |
E: DEVTYPE=disk
|
|
|
df3f53 |
E: ID_PATH=pci-0000:00:06.0
|
|
|
df3f53 |
E: ID_PATH_TAG=pci-0000_00_06_0
|
|
|
df3f53 |
E: ID_SERIAL=08491434ee711d3420e9
|
|
|
df3f53 |
E: MAJOR=252
|
|
|
df3f53 |
E: MINOR=16
|
|
|
df3f53 |
E: SUBSYSTEM=block
|
|
|
df3f53 |
E: TAGS=:systemd:
|
|
|
df3f53 |
E: USEC_INITIALIZED=1403804
|
|
|
df3f53 |
|
|
|
df3f53 |
[RHEL-8 backport: add ID_SERIAL and also ID_SCSI_SERIAL to be compatible with upstream]
|
|
|
df3f53 |
|
|
|
df3f53 |
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1861670
|
|
|
df3f53 |
Upstream: http://github.com/karelzak/util-linux/commit/e81d0f80068086147434fa947a4f723c00318772
|
|
|
df3f53 |
Upstream: http://github.com/karelzak/util-linux/commit/de6c2a4aec140e6086e278688d97f4655ced1a9a
|
|
|
df3f53 |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
df3f53 |
---
|
|
|
df3f53 |
misc-utils/lsblk.c | 8 +++++++-
|
|
|
df3f53 |
1 file changed, 7 insertions(+), 1 deletion(-)
|
|
|
df3f53 |
|
|
|
df3f53 |
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
|
|
|
df3f53 |
index ae97f9f05..d0369d3e7 100644
|
|
|
df3f53 |
--- a/misc-utils/lsblk.c
|
|
|
df3f53 |
+++ b/misc-utils/lsblk.c
|
|
|
df3f53 |
@@ -567,8 +567,14 @@ static int get_udev_properties(struct blkdev_cxt *cxt)
|
|
|
df3f53 |
if (data)
|
|
|
df3f53 |
cxt->wwn = xstrdup(data);
|
|
|
df3f53 |
|
|
|
df3f53 |
- if ((data = udev_device_get_property_value(dev, "ID_SERIAL_SHORT")))
|
|
|
df3f53 |
+ data = udev_device_get_property_value(dev, "ID_SCSI_SERIAL");
|
|
|
df3f53 |
+ if (!data)
|
|
|
df3f53 |
+ data = udev_device_get_property_value(dev, "ID_SERIAL_SHORT");
|
|
|
df3f53 |
+ if (!data)
|
|
|
df3f53 |
+ data = udev_device_get_property_value(dev, "ID_SERIAL");
|
|
|
df3f53 |
+ if (data)
|
|
|
df3f53 |
cxt->serial = xstrdup(data);
|
|
|
df3f53 |
+
|
|
|
df3f53 |
udev_device_unref(dev);
|
|
|
df3f53 |
cxt->probed = 1;
|
|
|
df3f53 |
DBG(DEV, ul_debugobj(cxt, "%s: found udev properties", cxt->name));
|
|
|
df3f53 |
--
|
|
|
df3f53 |
2.29.2
|
|
|
df3f53 |
|