diff --git a/Fix-name-resolution-for-MD-devices-and-partitions-on.patch b/Fix-name-resolution-for-MD-devices-and-partitions-on.patch new file mode 100644 index 0000000000000000000000000000000000000000..bbbdf92985c1c2ce7fbe41e9253819fcf217656d --- /dev/null +++ b/Fix-name-resolution-for-MD-devices-and-partitions-on.patch @@ -0,0 +1,48 @@ +From 4bf7ef1f6b63d025dd047fe5f1c6dea4ef6c3b40 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Wed, 12 Aug 2020 10:57:19 +0200 +Subject: [PATCH] Fix name resolution for MD devices and partitions on them + +UDev data for both member disks/partitions and partitions on arrays +contain the MD_* properties we must be extra careful when deciding +what name we'll use for the device. + +Resolves: rhbz#1862904 +--- + blivet/udev.py | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/blivet/udev.py b/blivet/udev.py +index 66af9a98..32d6369a 100644 +--- a/blivet/udev.py ++++ b/blivet/udev.py +@@ -203,9 +203,16 @@ def device_get_name(udev_info): + """ Return the best name for a device based on the udev db data. """ + if "DM_NAME" in udev_info: + name = udev_info["DM_NAME"] +- elif "MD_DEVNAME" in udev_info and os.path.exists(device_get_sysfs_path(udev_info) + "/md"): ++ elif "MD_DEVNAME" in udev_info: + mdname = udev_info["MD_DEVNAME"] +- if device_is_partition(udev_info): ++ if device_is_md(udev_info): ++ # MD RAID array -> use MD_DEVNAME ++ name = mdname ++ elif device_get_format(udev_info) == "linux_raid_member": ++ # MD RAID member -> use SYS_NAME ++ name = udev_info["SYS_NAME"] ++ elif device_is_partition(udev_info): ++ # partition on RAID -> construct name from MD_DEVNAME + partition number + # for partitions on named RAID we want to use the raid name, not + # the node, e.g. "raid1" instead of "md127p1" + partnum = udev_info["ID_PART_ENTRY_NUMBER"] +@@ -214,6 +221,7 @@ def device_get_name(udev_info): + else: + name = mdname + partnum + else: ++ # something else -> default to MD_DEVNAME + name = mdname + else: + name = udev_info["SYS_NAME"] +-- +2.20.1.windows.1 + diff --git a/python-blivet.spec b/python-blivet.spec index 694f4c3436371b4a1af9ebe542921d7d42223182..75d09fa03afb466f60cc8a1849d6ea7b3d2d2ca2 100644 --- a/python-blivet.spec +++ b/python-blivet.spec @@ -2,7 +2,7 @@ Name: python-blivet Version: 3.2.2 -Release: 1 +Release: 2 Epoch: 1 Summary: A python module for system storage configuration License: LGPLv2+ @@ -17,7 +17,7 @@ BuildRequires: python2-devel python2-setuptools %endif Patch0: 0001-force-lvm-plugin.patch - +Patch1: Fix-name-resolution-for-MD-devices-and-partitions-on.patch Patch9000: fix-the-long-hostname.patch @@ -120,6 +120,12 @@ make PYTHON=%{__python2} DESTDIR=%{buildroot} install %doc README %changelog +* Thu Sep 15 2020 liuxin - 3.2.2-2 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:Fix name resolution for MD devices and partitions + * Mon Aug 24 2020 yuboyun - 3.2.2-1 - Type:enhancement - ID:NA