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 0000000000000000000000000000000000000000..54d6927ffd8e9873c9021223c90e663a2d246ee2 --- /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 0000000000000000000000000000000000000000..7c58d72709f1e5e2b9059e2cb47e194b45e83eac --- /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/python-blivet.spec b/python-blivet.spec index 29d786c354ff223ebcbe95d8fae9680a03da6ec1..6b32ce45acb29c759fba5ced2eecc56dd9cf4872 100644 --- a/python-blivet.spec +++ b/python-blivet.spec @@ -3,7 +3,7 @@ Name: python-blivet Version: 3.2.2 -Release: 6 +Release: 7 Epoch: 1 Summary: A python module for system storage configuration License: LGPLv2+ @@ -25,6 +25,9 @@ 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 storage configuration. @@ -124,6 +127,13 @@ make PYTHON=%{__python2} DESTDIR=%{buildroot} install %doc README %changelog +* 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 + * Sat Jul 24 2021 liuyumeng - 3.2.2-6 - Type:bugfix - ID:NA