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

[PATCH 2/2] Properly identify device-mapper partitions set up by kpartx. (#644616)



The "partN-" prefix is actually kpartx's poorly chosen device-mapper
subsystem prefix string, so we have to learn to live with it.
---
 pyanaconda/storage/udev.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/pyanaconda/storage/udev.py b/pyanaconda/storage/udev.py
index 20f3a88..02290c5 100644
--- a/pyanaconda/storage/udev.py
+++ b/pyanaconda/storage/udev.py
@@ -395,7 +395,13 @@ def udev_device_get_lv_attr(info):
 def udev_device_dm_subsystem_match(info, subsystem):
     """ Return True if the device matches a given device-mapper subsystem. """
     uuid = info.get("DM_UUID", "")
-    _subsystem = uuid.split("-")[0]
+    uuid_fields = uuid.split("-")
+    _subsystem = uuid_fields[0]
+    if _subsystem.lower().startswith("part") and len(uuid_fields) > 1:
+        # kpartx uses partN- as a subsystem prefix, which we ignore because
+        # we only care about the subsystem of the partitions' parent device.
+        _subsystem = uuid_fields[1]
+
     if _subsystem == uuid or not _subsystem:
         return False
 
-- 
1.7.2.3


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