From 45cf2ee29cb3cc06c885a61fbe800325faa60c4a Mon Sep 17 00:00:00 2001 From: Vojtech Trefny Date: Aug 18 2022 13:58:31 +0000 Subject: DDF RAID support using mdadm Resolves: rhbz#2109030 --- diff --git a/0027-DDF-RAID-support-using-mdadm.patch b/0027-DDF-RAID-support-using-mdadm.patch new file mode 100644 index 0000000..80709fe --- /dev/null +++ b/0027-DDF-RAID-support-using-mdadm.patch @@ -0,0 +1,107 @@ +From 3a64795bdb94f525b55375bd89e7e5c8bc3a8921 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Wed, 17 Aug 2022 14:24:21 +0200 +Subject: [PATCH 1/3] Use MD populator instead of DM to handle DDF RAID format + +--- + blivet/formats/dmraid.py | 2 +- + blivet/formats/mdraid.py | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/blivet/formats/dmraid.py b/blivet/formats/dmraid.py +index 2ba9dcfe5..ce15905dc 100644 +--- a/blivet/formats/dmraid.py ++++ b/blivet/formats/dmraid.py +@@ -43,7 +43,7 @@ class DMRaidMember(DeviceFormat): + # + # One problem that presents is the possibility of someone passing + # a dmraid member to the MDRaidArrayDevice constructor. +- _udev_types = ["adaptec_raid_member", "ddf_raid_member", ++ _udev_types = ["adaptec_raid_member", + "hpt37x_raid_member", "hpt45x_raid_member", + "isw_raid_member", + "jmicron_raid_member", "lsi_mega_raid_member", +diff --git a/blivet/formats/mdraid.py b/blivet/formats/mdraid.py +index 41ddef810..4aa3f3b07 100644 +--- a/blivet/formats/mdraid.py ++++ b/blivet/formats/mdraid.py +@@ -41,7 +41,7 @@ class MDRaidMember(DeviceFormat): + """ An mdraid member disk. """ + _type = "mdmember" + _name = N_("software RAID") +- _udev_types = ["linux_raid_member"] ++ _udev_types = ["linux_raid_member", "ddf_raid_member"] + parted_flag = PARTITION_RAID + _formattable = True # can be formatted + _supported = True # is supported + +From 3ea946fa7ae18dbc413c17f1cd5a6eb23aaf1ea8 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Wed, 17 Aug 2022 14:24:58 +0200 +Subject: [PATCH 2/3] Do not read DDF RAID UUID from udev + +The UUID we get from udev isn't the array UUID, we need to get +that using libblockdev. +--- + blivet/populator/helpers/mdraid.py | 16 ++++++++++------ + 1 file changed, 10 insertions(+), 6 deletions(-) + +diff --git a/blivet/populator/helpers/mdraid.py b/blivet/populator/helpers/mdraid.py +index 3479e3f78..a7602d209 100644 +--- a/blivet/populator/helpers/mdraid.py ++++ b/blivet/populator/helpers/mdraid.py +@@ -98,17 +98,21 @@ class MDFormatPopulator(FormatPopulator): + + def _get_kwargs(self): + kwargs = super(MDFormatPopulator, self)._get_kwargs() +- try: +- # ID_FS_UUID contains the array UUID +- kwargs["md_uuid"] = udev.device_get_uuid(self.data) +- except KeyError: +- log.warning("mdraid member %s has no md uuid", udev.device_get_name(self.data)) ++ kwargs["biosraid"] = udev.device_is_biosraid_member(self.data) ++ if not kwargs["biosraid"]: ++ try: ++ # ID_FS_UUID contains the array UUID ++ kwargs["md_uuid"] = udev.device_get_uuid(self.data) ++ except KeyError: ++ log.warning("mdraid member %s has no md uuid", udev.device_get_name(self.data)) ++ else: ++ # for BIOS RAIDs we can't get the UUID from udev, we'll get it from mdadm in `run` below ++ kwargs["md_uuid"] = None + + # reset the uuid to the member-specific value + # this will be None for members of v0 metadata arrays + kwargs["uuid"] = udev.device_get_md_device_uuid(self.data) + +- kwargs["biosraid"] = udev.device_is_biosraid_member(self.data) + return kwargs + + def run(self): + +From 4e766bb6f2bb487003ed4fa9b8415760c436af81 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Thu, 17 Mar 2022 15:48:25 +0100 +Subject: [PATCH 3/3] Do not crash when a disk populator doesn't return kwargs + +This happens when trying to use Blivet on a system with a BIOS +RAID without dmraid installed. Because we don't fully support +BIOS RAIDs using MD the MDBiosRaidDevicePopulator helper fails +to get kwargs for the BIOS RAID "disk" and populate fails. +--- + blivet/populator/helpers/disk.py | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/blivet/populator/helpers/disk.py b/blivet/populator/helpers/disk.py +index 2e5026f7e..9db7b810d 100644 +--- a/blivet/populator/helpers/disk.py ++++ b/blivet/populator/helpers/disk.py +@@ -68,6 +68,8 @@ def run(self): + log_method_call(self, name=name) + + kwargs = self._get_kwargs() ++ if not kwargs: ++ return + device = self._device_class(name, **kwargs) + self._devicetree._add_device(device) + return device diff --git a/python-blivet.spec b/python-blivet.spec index 289b9f1..c533539 100644 --- a/python-blivet.spec +++ b/python-blivet.spec @@ -23,7 +23,7 @@ Version: 3.4.0 #%%global prerelease .b2 # prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2 -Release: 15%{?prerelease}%{?dist} +Release: 16%{?prerelease}%{?dist} Epoch: 1 License: LGPLv2+ %global realname blivet @@ -55,6 +55,7 @@ Patch21: 0023-Use-LVM-PV-format-current_size-in-LVMVolumeGroupDevi.patch Patch22: 0024-tests-Mark-fake-disks-in-test_get_related_disks-as-n.patch Patch23: 0025-Add-support-for-NPIV-enabled-zFCP-devices.patch Patch24: 0026-Add-a-very-simple-NVMe-module.patch +Patch25: 0027-DDF-RAID-support-using-mdadm.patch # Versions of required components (done so we make sure the buildrequires # match the requires versions of things). @@ -217,6 +218,10 @@ configuration. %endif %changelog +* Thu Aug 18 2022 Vojtech Trefny - 3.4.0-16 +- DDF RAID support using mdadm + Resolves: rhbz#2109030 + * Mon Jun 20 2022 Jan Pokorny - 3.4.0-15 - Add a very simple NVMe module Resolves: rhbz#2073008