From 607a1edfd384191c075b44c7dfa3a583d6fcce3c Mon Sep 17 00:00:00 2001 From: Vojtech Trefny Date: Wed, 7 Jul 2021 14:57:16 +0200 Subject: [PATCH] Fix activating old style LVM snapshots Resolves: rhbz#1961944 --- ...x-activating-old-style-LVM-snapshots.patch | 35 +++++++++++++++++++ python-blivet.spec | 7 +++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 0007-Fix-activating-old-style-LVM-snapshots.patch diff --git a/0007-Fix-activating-old-style-LVM-snapshots.patch b/0007-Fix-activating-old-style-LVM-snapshots.patch new file mode 100644 index 0000000..e07ea1e --- /dev/null +++ b/0007-Fix-activating-old-style-LVM-snapshots.patch @@ -0,0 +1,35 @@ +From 8ece3da18b1abb89320d02f4475002e6a3ed7875 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Thu, 20 May 2021 13:40:26 +0200 +Subject: [PATCH] Fix activating old style LVM snapshots + +The old style snapshots are activated together with the origin LV +so we need to make sure it is activated to be able to remove the +snapshot or its format. + +Resolves: rhbz#1961739 +--- + blivet/devices/lvm.py | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/blivet/devices/lvm.py b/blivet/devices/lvm.py +index a55515fcb..fb57804d9 100644 +--- a/blivet/devices/lvm.py ++++ b/blivet/devices/lvm.py +@@ -1461,9 +1461,13 @@ def _set_format(self, fmt): # pylint: disable=unused-argument + self._update_format_from_origin() + + @old_snapshot_specific +- def setup(self, orig=False): +- # the old snapshot cannot be setup and torn down +- pass ++ def setup(self, orig=False): # pylint: disable=unused-argument ++ # the old snapshot is activated together with the origin ++ if self.origin and not self.origin.status: ++ try: ++ self.origin.setup() ++ except blockdev.LVMError as lvmerr: ++ log.error("failed to activate origin LV: %s", lvmerr) + + @old_snapshot_specific + def teardown(self, recursive=False): diff --git a/python-blivet.spec b/python-blivet.spec index 873d560..7d0ad38 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: 1%{?prerelease}%{?dist} +Release: 2%{?prerelease}%{?dist} Epoch: 1 License: LGPLv2+ %global realname blivet @@ -36,6 +36,7 @@ Patch2: 0003-Revert-More-consistent-lvm-errors.patch Patch3: 0004-Revert-Terminology-cleanups.patch Patch4: 0005-Fix-unify-importing-mock-module-in-tests.patch Patch5: 0006-Fix-util.virt_detect-on-Xen.patch +Patch6: 0007-Fix-activating-old-style-LVM-snapshots.patch # Versions of required components (done so we make sure the buildrequires # match the requires versions of things). @@ -198,6 +199,10 @@ configuration. %endif %changelog +* Wed Jul 7 2021 Vojtech Trefny - 3.4.0-2 +- Fix activating old style LVM snapshots + Resolves: rhbz#1961944 + * Wed Jun 9 2021 Vojtech Trefny - 3.4.0-1 - Rebase to latest upstream release 3.4.0 Resolves: rhbz#1964341