From 09b27419d818b72056c072c3d838af6ab57192a0 Mon Sep 17 00:00:00 2001 From: yanan-rock Date: Fri, 29 Oct 2021 12:48:55 -0400 Subject: [PATCH] Convert LVM filter lists to sets and Remove action device from LVM reject list Signed-off-by: yanan-rock --- ...ort-Convert-LVM-filter-lists-to-sets.patch | 57 +++++++++++++++++++ ...e-action-device-from-LVM-reject-list.patch | 24 ++++++++ ...partitions-threw-exception-when-raid.patch | 26 +++++++++ python-blivet.spec | 21 ++++++- 4 files changed, 126 insertions(+), 2 deletions(-) create mode 100644 backport-Convert-LVM-filter-lists-to-sets.patch create mode 100644 backport-Remove-action-device-from-LVM-reject-list.patch create mode 100644 huawei-fix-allocate-partitions-threw-exception-when-raid.patch diff --git a/backport-Convert-LVM-filter-lists-to-sets.patch b/backport-Convert-LVM-filter-lists-to-sets.patch new file mode 100644 index 0000000..54d6927 --- /dev/null +++ b/backport-Convert-LVM-filter-lists-to-sets.patch @@ -0,0 +1,57 @@ +From 18167263c3bfd3a99a38fc88a7e139a313c249e7 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Mon, 24 May 2021 14:49:12 +0200 +Subject: [PATCH] Convert LVM filter lists to sets + +To prevent devices being added multiple times and removed only +once. + +Related: rhbz#1955942 +--- + blivet/devicelibs/lvm.py | 12 ++++++------ + tests/devicetree_test.py | 6 +++--- + 2 files changed, 9 insertions(+), 9 deletions(-) + +diff --git a/blivet/devicelibs/lvm.py b/blivet/devicelibs/lvm.py +index d56a76edc..c4b237a2c 100644 +--- a/blivet/devicelibs/lvm.py ++++ b/blivet/devicelibs/lvm.py +@@ -70,8 +70,8 @@ + # Theoretically we can handle all that can be handled with the LVM --config + # argument. For every time we call an lvm_cc (lvm compose config) funciton + # we regenerate the config_args with all global info. +-config_args_data = {"filterRejects": [], # regular expressions to reject. +- "filterAccepts": []} # regexp to accept ++config_args_data = {"filterRejects": set(), # regular expressions to reject. ++ "filterAccepts": set()} # regexp to accept + + + def _set_global_config(): +@@ -119,7 +119,7 @@ def fn_with_refresh(*args, **kwargs): + def lvm_cc_addFilterRejectRegexp(regexp): + """ Add a regular expression to the --config string.""" + log.debug("lvm filter: adding %s to the reject list", regexp) +- config_args_data["filterRejects"].append(regexp) ++ config_args_data["filterRejects"].add(regexp) + + + @needs_config_refresh +@@ -128,15 +128,15 @@ def lvm_cc_removeFilterRejectRegexp(regexp): + log.debug("lvm filter: removing %s from the reject list", regexp) + try: + config_args_data["filterRejects"].remove(regexp) +- except ValueError: ++ except KeyError: + log.debug("%s wasn't in the reject list", regexp) + return + + + @needs_config_refresh + def lvm_cc_resetFilter(): +- config_args_data["filterRejects"] = [] +- config_args_data["filterAccepts"] = [] ++ config_args_data["filterRejects"] = set() ++ config_args_data["filterAccepts"] = set() + + + def determine_parent_lv(internal_lv, lvs, lv_info): diff --git a/backport-Remove-action-device-from-LVM-reject-list.patch b/backport-Remove-action-device-from-LVM-reject-list.patch new file mode 100644 index 0000000..7c58d72 --- /dev/null +++ b/backport-Remove-action-device-from-LVM-reject-list.patch @@ -0,0 +1,24 @@ +From f0862e211eb9949dea1a5ccb151e7d099b9585e6 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Mon, 24 May 2021 13:35:39 +0200 +Subject: [PATCH] Remove action device from LVM reject list + +Because the device doesn't depend on itself the existing code +won't remove the device we are trying to modify from the list. + +Resolves: rhbz#1955942 +--- + blivet/actionlist.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/blivet/actionlist.py b/blivet/actionlist.py +index d03e32b95..2de3fed33 100644 +--- a/blivet/actionlist.py ++++ b/blivet/actionlist.py +@@ -260,6 +260,7 @@ def _pre_process(self, devices=None): + log.debug("action: %s", action) + + # Remove lvm filters for devices we are operating on ++ lvm.lvm_cc_removeFilterRejectRegexp(action.device.name) + for device in (d for d in devices if d.depends_on(action.device)): + lvm.lvm_cc_removeFilterRejectRegexp(device.name) diff --git a/huawei-fix-allocate-partitions-threw-exception-when-raid.patch b/huawei-fix-allocate-partitions-threw-exception-when-raid.patch new file mode 100644 index 0000000..8fdb59b --- /dev/null +++ b/huawei-fix-allocate-partitions-threw-exception-when-raid.patch @@ -0,0 +1,26 @@ +From 00cdf3f0ace5f4d5407dbf610f056fef667c1cd2 Mon Sep 17 00:00:00 2001 +From: bitcoffeeiux +Date: Fri, 4 Jun 2021 02:23:37 +0800 +Subject: [PATCH] function allocate_partitions threw an exception + while adding /boot partitions to a RAID disk + +--- + blivet/partitioning.py | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/blivet/partitioning.py b/blivet/partitioning.py +index 40644f9..8219841 100644 +--- a/blivet/partitioning.py ++++ b/blivet/partitioning.py +@@ -758,6 +758,8 @@ def allocate_partitions(storage, disks, partitions, freespace, boot_disk=None): + growth = 0 # in sectors + # loop through disks + for _disk in req_disks: ++ if _disk.path not in disklabels: ++ continue + disklabel = disklabels[_disk.path] + best = None + current_free = free +-- +2.27.0 + diff --git a/python-blivet.spec b/python-blivet.spec index 82810fc..4130173 100644 --- a/python-blivet.spec +++ b/python-blivet.spec @@ -3,7 +3,7 @@ Name: python-blivet Version: 3.2.2 -Release: 5 +Release: 7 Epoch: 1 Summary: A python module for system storage configuration License: LGPLv2+ @@ -23,6 +23,10 @@ Patch9000: fix-the-long-hostname.patch Patch6000: backport-Account-for-pmspare-grow-when-adjusting-thinpool-metadata.patch Patch6001: backport-Close-fd-if-it-fails-to-read-the-device.patch Patch6002: backport-Fix-UnboundLocalError.patch +Patch9001: huawei-fix-allocate-partitions-threw-exception-when-raid.patch + +Patch6003: backport-Convert-LVM-filter-lists-to-sets.patch +Patch6004: backport-Remove-action-device-from-LVM-reject-list.patch %description The python-blivet package is a python module for examining and modifying @@ -123,12 +127,25 @@ make PYTHON=%{__python2} DESTDIR=%{buildroot} install %doc README %changelog -* Tue Jun 08 2021 liuyumeng - 3.2.2-5 +* Sat Oct 30 2021 yanan - 3.2.2-7 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:Convert LVM filter lists to sets + Remove action device from LVM reject list + +* Tue Jun 08 2021 liuyumeng - 3.2.2-6 - Type:bugfix - ID:NA - SUG:NA - DESC:Close fd if fails to read the device,Fix UnboundLocalError +* Thu Jun 10 2021 liuxin - 3.2.2-5 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:fix allocate_partitions threw an exception while adding /boot to RAID disk + * Tue May 25 2021 yanan - 3.2.2-4 - Type:bugfix - ID:NA -- Gitee