[blivet][master/rhel7-branch] Prefer ID_SERIAL over ID_SERIAL_SHORT (#1138254)

Vratislav Podzimek vpodzime at redhat.com
Fri Sep 5 07:53:57 UTC 2014


While there are devices that export multiple block devices with the same
ID_SERIAL_SHORT (e.g. card readers) they use different ID_SERIAL values for
those block devices. Using ID_SERIAL_SHORT instead of ID_SERIAL results in all
the card reader's block devices being considered "obvious multipath devices"
where multipathd lost the race condition game and didn't assemble them
correctly. Which is terribly wrong.

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 blivet/devices.py | 3 ++-
 blivet/udev.py    | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/blivet/devices.py b/blivet/devices.py
index 016f61a..8340b8f 100644
--- a/blivet/devices.py
+++ b/blivet/devices.py
@@ -1192,7 +1192,8 @@ class DiskDevice(StorageDevice):
             :type sysfsPath: str
             :keyword removable: whether or not this is a removable device
             :type removable: bool
-            :keyword serial: the ID_SERIAL_SHORT for this device
+            :keyword serial: the ID_SERIAL_RAW, ID_SERIAL or ID_SERIAL_SHORT for
+                             this device (which one is available)
             :type serial: str
             :keyword vendor: the manufacturer of this Device
             :type vendor: str
diff --git a/blivet/udev.py b/blivet/udev.py
index 107d12e..5755d0c 100644
--- a/blivet/udev.py
+++ b/blivet/udev.py
@@ -262,7 +262,7 @@ def device_is_loop(info):
 
 def device_get_serial(udev_info):
     """ Get the serial number/UUID from the device as reported by udev. """
-    return udev_info.get("ID_SERIAL_RAW", udev_info.get("ID_SERIAL_SHORT", udev_info.get("ID_SERIAL")))
+    return udev_info.get("ID_SERIAL_RAW", udev_info.get("ID_SERIAL", udev_info.get("ID_SERIAL_SHORT")))
 
 def device_get_wwid(udev_info):
     """ The WWID of a device is typically just its serial number, but with
-- 
1.9.3



More information about the anaconda-patches mailing list