1c4b60
From 3a64795bdb94f525b55375bd89e7e5c8bc3a8921 Mon Sep 17 00:00:00 2001
1c4b60
From: Vojtech Trefny <vtrefny@redhat.com>
1c4b60
Date: Wed, 17 Aug 2022 14:24:21 +0200
1c4b60
Subject: [PATCH 1/3] Use MD populator instead of DM to handle DDF RAID format
1c4b60
1c4b60
---
1c4b60
 blivet/formats/dmraid.py | 2 +-
1c4b60
 blivet/formats/mdraid.py | 2 +-
1c4b60
 2 files changed, 2 insertions(+), 2 deletions(-)
1c4b60
1c4b60
diff --git a/blivet/formats/dmraid.py b/blivet/formats/dmraid.py
1c4b60
index 2ba9dcfe5..ce15905dc 100644
1c4b60
--- a/blivet/formats/dmraid.py
1c4b60
+++ b/blivet/formats/dmraid.py
1c4b60
@@ -43,7 +43,7 @@ class DMRaidMember(DeviceFormat):
1c4b60
     #
1c4b60
     #     One problem that presents is the possibility of someone passing
1c4b60
     #     a dmraid member to the MDRaidArrayDevice constructor.
1c4b60
-    _udev_types = ["adaptec_raid_member", "ddf_raid_member",
1c4b60
+    _udev_types = ["adaptec_raid_member",
1c4b60
                    "hpt37x_raid_member", "hpt45x_raid_member",
1c4b60
                    "isw_raid_member",
1c4b60
                    "jmicron_raid_member", "lsi_mega_raid_member",
1c4b60
diff --git a/blivet/formats/mdraid.py b/blivet/formats/mdraid.py
1c4b60
index 41ddef810..4aa3f3b07 100644
1c4b60
--- a/blivet/formats/mdraid.py
1c4b60
+++ b/blivet/formats/mdraid.py
1c4b60
@@ -41,7 +41,7 @@ class MDRaidMember(DeviceFormat):
1c4b60
     """ An mdraid member disk. """
1c4b60
     _type = "mdmember"
1c4b60
     _name = N_("software RAID")
1c4b60
-    _udev_types = ["linux_raid_member"]
1c4b60
+    _udev_types = ["linux_raid_member", "ddf_raid_member"]
1c4b60
     parted_flag = PARTITION_RAID
1c4b60
     _formattable = True                 # can be formatted
1c4b60
     _supported = True                   # is supported
1c4b60
1c4b60
From 3ea946fa7ae18dbc413c17f1cd5a6eb23aaf1ea8 Mon Sep 17 00:00:00 2001
1c4b60
From: Vojtech Trefny <vtrefny@redhat.com>
1c4b60
Date: Wed, 17 Aug 2022 14:24:58 +0200
1c4b60
Subject: [PATCH 2/3] Do not read DDF RAID UUID from udev
1c4b60
1c4b60
The UUID we get from udev isn't the array UUID, we need to get
1c4b60
that using libblockdev.
1c4b60
---
1c4b60
 blivet/populator/helpers/mdraid.py | 16 ++++++++++------
1c4b60
 1 file changed, 10 insertions(+), 6 deletions(-)
1c4b60
1c4b60
diff --git a/blivet/populator/helpers/mdraid.py b/blivet/populator/helpers/mdraid.py
1c4b60
index 3479e3f78..a7602d209 100644
1c4b60
--- a/blivet/populator/helpers/mdraid.py
1c4b60
+++ b/blivet/populator/helpers/mdraid.py
1c4b60
@@ -98,17 +98,21 @@ class MDFormatPopulator(FormatPopulator):
1c4b60
 
1c4b60
     def _get_kwargs(self):
1c4b60
         kwargs = super(MDFormatPopulator, self)._get_kwargs()
1c4b60
-        try:
1c4b60
-            # ID_FS_UUID contains the array UUID
1c4b60
-            kwargs["md_uuid"] = udev.device_get_uuid(self.data)
1c4b60
-        except KeyError:
1c4b60
-            log.warning("mdraid member %s has no md uuid", udev.device_get_name(self.data))
1c4b60
+        kwargs["biosraid"] = udev.device_is_biosraid_member(self.data)
1c4b60
+        if not kwargs["biosraid"]:
1c4b60
+            try:
1c4b60
+                # ID_FS_UUID contains the array UUID
1c4b60
+                kwargs["md_uuid"] = udev.device_get_uuid(self.data)
1c4b60
+            except KeyError:
1c4b60
+                log.warning("mdraid member %s has no md uuid", udev.device_get_name(self.data))
1c4b60
+        else:
1c4b60
+            # for BIOS RAIDs we can't get the UUID from udev, we'll get it from mdadm in `run` below
1c4b60
+            kwargs["md_uuid"] = None
1c4b60
 
1c4b60
         # reset the uuid to the member-specific value
1c4b60
         # this will be None for members of v0 metadata arrays
1c4b60
         kwargs["uuid"] = udev.device_get_md_device_uuid(self.data)
1c4b60
 
1c4b60
-        kwargs["biosraid"] = udev.device_is_biosraid_member(self.data)
1c4b60
         return kwargs
1c4b60
 
1c4b60
     def run(self):
1c4b60
1c4b60
From 4e766bb6f2bb487003ed4fa9b8415760c436af81 Mon Sep 17 00:00:00 2001
1c4b60
From: Vojtech Trefny <vtrefny@redhat.com>
1c4b60
Date: Thu, 17 Mar 2022 15:48:25 +0100
1c4b60
Subject: [PATCH 3/3] Do not crash when a disk populator doesn't return kwargs
1c4b60
1c4b60
This happens when trying to use Blivet on a system with a BIOS
1c4b60
RAID without dmraid installed. Because we don't fully support
1c4b60
BIOS RAIDs using MD the MDBiosRaidDevicePopulator helper fails
1c4b60
to get kwargs for the BIOS RAID "disk" and populate fails.
1c4b60
---
1c4b60
 blivet/populator/helpers/disk.py | 2 ++
1c4b60
 1 file changed, 2 insertions(+)
1c4b60
1c4b60
diff --git a/blivet/populator/helpers/disk.py b/blivet/populator/helpers/disk.py
1c4b60
index 2e5026f7e..9db7b810d 100644
1c4b60
--- a/blivet/populator/helpers/disk.py
1c4b60
+++ b/blivet/populator/helpers/disk.py
1c4b60
@@ -68,6 +68,8 @@ def run(self):
1c4b60
         log_method_call(self, name=name)
1c4b60
 
1c4b60
         kwargs = self._get_kwargs()
1c4b60
+        if not kwargs:
1c4b60
+            return
1c4b60
         device = self._device_class(name, **kwargs)
1c4b60
         self._devicetree._add_device(device)
1c4b60
         return device