neil / rpms / python-blivet

Forked from rpms/python-blivet a year ago
Clone
Vojtech Trefny ba16cb
From 4ad6f485a1e569feb5fd23ffcf78e08a7756e084 Mon Sep 17 00:00:00 2001
Vojtech Trefny 45cf2e
From: Vojtech Trefny <vtrefny@redhat.com>
Vojtech Trefny 45cf2e
Date: Wed, 17 Aug 2022 14:24:21 +0200
Vojtech Trefny ba16cb
Subject: [PATCH 1/2] Use MD populator instead of DM to handle DDF RAID format
Vojtech Trefny 45cf2e
Vojtech Trefny 45cf2e
---
Vojtech Trefny 45cf2e
 blivet/formats/dmraid.py | 2 +-
Vojtech Trefny 45cf2e
 blivet/formats/mdraid.py | 2 +-
Vojtech Trefny 45cf2e
 2 files changed, 2 insertions(+), 2 deletions(-)
Vojtech Trefny 45cf2e
Vojtech Trefny 45cf2e
diff --git a/blivet/formats/dmraid.py b/blivet/formats/dmraid.py
Vojtech Trefny ba16cb
index 2ba9dcfe..ce15905d 100644
Vojtech Trefny 45cf2e
--- a/blivet/formats/dmraid.py
Vojtech Trefny 45cf2e
+++ b/blivet/formats/dmraid.py
Vojtech Trefny 45cf2e
@@ -43,7 +43,7 @@ class DMRaidMember(DeviceFormat):
Vojtech Trefny 45cf2e
     #
Vojtech Trefny 45cf2e
     #     One problem that presents is the possibility of someone passing
Vojtech Trefny 45cf2e
     #     a dmraid member to the MDRaidArrayDevice constructor.
Vojtech Trefny 45cf2e
-    _udev_types = ["adaptec_raid_member", "ddf_raid_member",
Vojtech Trefny 45cf2e
+    _udev_types = ["adaptec_raid_member",
Vojtech Trefny 45cf2e
                    "hpt37x_raid_member", "hpt45x_raid_member",
Vojtech Trefny 45cf2e
                    "isw_raid_member",
Vojtech Trefny 45cf2e
                    "jmicron_raid_member", "lsi_mega_raid_member",
Vojtech Trefny 45cf2e
diff --git a/blivet/formats/mdraid.py b/blivet/formats/mdraid.py
Vojtech Trefny ba16cb
index 41ddef81..4aa3f3b0 100644
Vojtech Trefny 45cf2e
--- a/blivet/formats/mdraid.py
Vojtech Trefny 45cf2e
+++ b/blivet/formats/mdraid.py
Vojtech Trefny 45cf2e
@@ -41,7 +41,7 @@ class MDRaidMember(DeviceFormat):
Vojtech Trefny 45cf2e
     """ An mdraid member disk. """
Vojtech Trefny 45cf2e
     _type = "mdmember"
Vojtech Trefny 45cf2e
     _name = N_("software RAID")
Vojtech Trefny 45cf2e
-    _udev_types = ["linux_raid_member"]
Vojtech Trefny 45cf2e
+    _udev_types = ["linux_raid_member", "ddf_raid_member"]
Vojtech Trefny 45cf2e
     parted_flag = PARTITION_RAID
Vojtech Trefny 45cf2e
     _formattable = True                 # can be formatted
Vojtech Trefny 45cf2e
     _supported = True                   # is supported
Vojtech Trefny ba16cb
-- 
Vojtech Trefny ba16cb
2.37.3
Vojtech Trefny 45cf2e
Vojtech Trefny ba16cb
Vojtech Trefny ba16cb
From abc7e018f43976cdab286d67207d515a74693d16 Mon Sep 17 00:00:00 2001
Vojtech Trefny 45cf2e
From: Vojtech Trefny <vtrefny@redhat.com>
Vojtech Trefny 45cf2e
Date: Wed, 17 Aug 2022 14:24:58 +0200
Vojtech Trefny ba16cb
Subject: [PATCH 2/2] Do not read DDF RAID UUID from udev
Vojtech Trefny 45cf2e
Vojtech Trefny 45cf2e
The UUID we get from udev isn't the array UUID, we need to get
Vojtech Trefny 45cf2e
that using libblockdev.
Vojtech Trefny 45cf2e
---
Vojtech Trefny 45cf2e
 blivet/populator/helpers/mdraid.py | 16 ++++++++++------
Vojtech Trefny 45cf2e
 1 file changed, 10 insertions(+), 6 deletions(-)
Vojtech Trefny 45cf2e
Vojtech Trefny 45cf2e
diff --git a/blivet/populator/helpers/mdraid.py b/blivet/populator/helpers/mdraid.py
Vojtech Trefny ba16cb
index 3479e3f7..a7602d20 100644
Vojtech Trefny 45cf2e
--- a/blivet/populator/helpers/mdraid.py
Vojtech Trefny 45cf2e
+++ b/blivet/populator/helpers/mdraid.py
Vojtech Trefny 45cf2e
@@ -98,17 +98,21 @@ class MDFormatPopulator(FormatPopulator):
Vojtech Trefny 45cf2e
 
Vojtech Trefny 45cf2e
     def _get_kwargs(self):
Vojtech Trefny 45cf2e
         kwargs = super(MDFormatPopulator, self)._get_kwargs()
Vojtech Trefny 45cf2e
-        try:
Vojtech Trefny 45cf2e
-            # ID_FS_UUID contains the array UUID
Vojtech Trefny 45cf2e
-            kwargs["md_uuid"] = udev.device_get_uuid(self.data)
Vojtech Trefny 45cf2e
-        except KeyError:
Vojtech Trefny 45cf2e
-            log.warning("mdraid member %s has no md uuid", udev.device_get_name(self.data))
Vojtech Trefny 45cf2e
+        kwargs["biosraid"] = udev.device_is_biosraid_member(self.data)
Vojtech Trefny 45cf2e
+        if not kwargs["biosraid"]:
Vojtech Trefny 45cf2e
+            try:
Vojtech Trefny 45cf2e
+                # ID_FS_UUID contains the array UUID
Vojtech Trefny 45cf2e
+                kwargs["md_uuid"] = udev.device_get_uuid(self.data)
Vojtech Trefny 45cf2e
+            except KeyError:
Vojtech Trefny 45cf2e
+                log.warning("mdraid member %s has no md uuid", udev.device_get_name(self.data))
Vojtech Trefny 45cf2e
+        else:
Vojtech Trefny 45cf2e
+            # for BIOS RAIDs we can't get the UUID from udev, we'll get it from mdadm in `run` below
Vojtech Trefny 45cf2e
+            kwargs["md_uuid"] = None
Vojtech Trefny 45cf2e
 
Vojtech Trefny 45cf2e
         # reset the uuid to the member-specific value
Vojtech Trefny 45cf2e
         # this will be None for members of v0 metadata arrays
Vojtech Trefny 45cf2e
         kwargs["uuid"] = udev.device_get_md_device_uuid(self.data)
Vojtech Trefny 45cf2e
 
Vojtech Trefny 45cf2e
-        kwargs["biosraid"] = udev.device_is_biosraid_member(self.data)
Vojtech Trefny 45cf2e
         return kwargs
Vojtech Trefny 45cf2e
 
Vojtech Trefny 45cf2e
     def run(self):
Vojtech Trefny ba16cb
-- 
Vojtech Trefny ba16cb
2.37.3
Vojtech Trefny 45cf2e