neil / rpms / python-blivet

Forked from rpms/python-blivet a year ago
Clone
93a1d2
From f6490c469904f4808c63a170210e53acc908b018 Mon Sep 17 00:00:00 2001
ee28bf
From: Vojtech Trefny <vtrefny@redhat.com>
ee28bf
Date: Wed, 17 Aug 2022 14:24:21 +0200
93a1d2
Subject: [PATCH 1/2] Use MD populator instead of DM to handle DDF RAID format
ee28bf
ee28bf
---
ee28bf
 blivet/formats/dmraid.py | 2 +-
ee28bf
 blivet/formats/mdraid.py | 2 +-
ee28bf
 2 files changed, 2 insertions(+), 2 deletions(-)
ee28bf
ee28bf
diff --git a/blivet/formats/dmraid.py b/blivet/formats/dmraid.py
93a1d2
index 2ba9dcfe..ce15905d 100644
ee28bf
--- a/blivet/formats/dmraid.py
ee28bf
+++ b/blivet/formats/dmraid.py
ee28bf
@@ -43,7 +43,7 @@ class DMRaidMember(DeviceFormat):
ee28bf
     #
ee28bf
     #     One problem that presents is the possibility of someone passing
ee28bf
     #     a dmraid member to the MDRaidArrayDevice constructor.
ee28bf
-    _udev_types = ["adaptec_raid_member", "ddf_raid_member",
ee28bf
+    _udev_types = ["adaptec_raid_member",
ee28bf
                    "hpt37x_raid_member", "hpt45x_raid_member",
ee28bf
                    "isw_raid_member",
ee28bf
                    "jmicron_raid_member", "lsi_mega_raid_member",
ee28bf
diff --git a/blivet/formats/mdraid.py b/blivet/formats/mdraid.py
93a1d2
index 41ddef81..4aa3f3b0 100644
ee28bf
--- a/blivet/formats/mdraid.py
ee28bf
+++ b/blivet/formats/mdraid.py
ee28bf
@@ -41,7 +41,7 @@ class MDRaidMember(DeviceFormat):
ee28bf
     """ An mdraid member disk. """
ee28bf
     _type = "mdmember"
ee28bf
     _name = N_("software RAID")
ee28bf
-    _udev_types = ["linux_raid_member"]
ee28bf
+    _udev_types = ["linux_raid_member", "ddf_raid_member"]
ee28bf
     parted_flag = PARTITION_RAID
ee28bf
     _formattable = True                 # can be formatted
ee28bf
     _supported = True                   # is supported
93a1d2
-- 
93a1d2
2.38.1
ee28bf
93a1d2
93a1d2
From 5fadd850aae217d7692a6c8a50b2dcd5e61a63cd Mon Sep 17 00:00:00 2001
ee28bf
From: Vojtech Trefny <vtrefny@redhat.com>
ee28bf
Date: Wed, 17 Aug 2022 14:24:58 +0200
93a1d2
Subject: [PATCH 2/2] Do not read DDF RAID UUID from udev
ee28bf
ee28bf
The UUID we get from udev isn't the array UUID, we need to get
ee28bf
that using libblockdev.
ee28bf
---
ee28bf
 blivet/populator/helpers/mdraid.py | 16 ++++++++++------
ee28bf
 1 file changed, 10 insertions(+), 6 deletions(-)
ee28bf
ee28bf
diff --git a/blivet/populator/helpers/mdraid.py b/blivet/populator/helpers/mdraid.py
93a1d2
index 3479e3f7..a7602d20 100644
ee28bf
--- a/blivet/populator/helpers/mdraid.py
ee28bf
+++ b/blivet/populator/helpers/mdraid.py
ee28bf
@@ -98,17 +98,21 @@ class MDFormatPopulator(FormatPopulator):
ee28bf
 
ee28bf
     def _get_kwargs(self):
ee28bf
         kwargs = super(MDFormatPopulator, self)._get_kwargs()
ee28bf
-        try:
ee28bf
-            # ID_FS_UUID contains the array UUID
ee28bf
-            kwargs["md_uuid"] = udev.device_get_uuid(self.data)
ee28bf
-        except KeyError:
ee28bf
-            log.warning("mdraid member %s has no md uuid", udev.device_get_name(self.data))
ee28bf
+        kwargs["biosraid"] = udev.device_is_biosraid_member(self.data)
ee28bf
+        if not kwargs["biosraid"]:
ee28bf
+            try:
ee28bf
+                # ID_FS_UUID contains the array UUID
ee28bf
+                kwargs["md_uuid"] = udev.device_get_uuid(self.data)
ee28bf
+            except KeyError:
ee28bf
+                log.warning("mdraid member %s has no md uuid", udev.device_get_name(self.data))
ee28bf
+        else:
ee28bf
+            # for BIOS RAIDs we can't get the UUID from udev, we'll get it from mdadm in `run` below
ee28bf
+            kwargs["md_uuid"] = None
ee28bf
 
ee28bf
         # reset the uuid to the member-specific value
ee28bf
         # this will be None for members of v0 metadata arrays
ee28bf
         kwargs["uuid"] = udev.device_get_md_device_uuid(self.data)
ee28bf
 
ee28bf
-        kwargs["biosraid"] = udev.device_is_biosraid_member(self.data)
ee28bf
         return kwargs
ee28bf
 
ee28bf
     def run(self):
93a1d2
-- 
93a1d2
2.38.1
ee28bf