neil / rpms / python-blivet

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