neil / rpms / python-blivet

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