neil / rpms / python-blivet

Forked from rpms/python-blivet a year ago
Clone
a9158f
From 4ad6f485a1e569feb5fd23ffcf78e08a7756e084 Mon Sep 17 00:00:00 2001
d891b6
From: Vojtech Trefny <vtrefny@redhat.com>
d891b6
Date: Wed, 17 Aug 2022 14:24:21 +0200
a9158f
Subject: [PATCH 1/2] 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
a9158f
index 2ba9dcfe..ce15905d 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
a9158f
index 41ddef81..4aa3f3b0 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
a9158f
-- 
a9158f
2.37.3
d891b6
a9158f
a9158f
From abc7e018f43976cdab286d67207d515a74693d16 Mon Sep 17 00:00:00 2001
d891b6
From: Vojtech Trefny <vtrefny@redhat.com>
d891b6
Date: Wed, 17 Aug 2022 14:24:58 +0200
a9158f
Subject: [PATCH 2/2] 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
a9158f
index 3479e3f7..a7602d20 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):
a9158f
-- 
a9158f
2.37.3
d891b6