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