neil / rpms / python-blivet

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