[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH 4/4] Handle 16 digit hex strings for ID_SERIAL_SHORT (#611554)



Modification to udev_device_get_wwid() patch from Masahiro Matsuya
<mmatsuya redhat com> to handle 16 digit hex strings for
ID_SERIAL_SHORT.
---
 storage/udev.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/storage/udev.py b/storage/udev.py
index 738cea0..f780c09 100644
--- a/storage/udev.py
+++ b/storage/udev.py
@@ -267,10 +267,11 @@ def udev_device_get_wwid(udev_info):
     """ The WWID of a device is typically just its serial number, but with
         colons in the name to make it more readable. """
     serial = udev_device_get_serial(udev_info)
+    serial_len = len(serial)
 
-    if serial and len(serial) == 32:
+    if serial and (serial_len == 32 or serial_len == 16):
         retval = ""
-        for i in range(0, 16):
+        for i in range(0, (serial_len / 2)):
             retval += serial[i*2:i*2+2] + ":"
 
         return retval[0:-1]
-- 
1.7.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]