Fix activating old style LVM snapshots

Resolves: rhbz#1961944
This commit is contained in:
Vojtech Trefny 2021-07-07 14:57:16 +02:00
parent 66ecf7e795
commit 607a1edfd3
2 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,35 @@
From 8ece3da18b1abb89320d02f4475002e6a3ed7875 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
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):

View File

@ -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 <vtrefny@redhat.com> - 3.4.0-2
- Fix activating old style LVM snapshots
Resolves: rhbz#1961944
* Wed Jun 9 2021 Vojtech Trefny <vtrefny@redhat.com> - 3.4.0-1
- Rebase to latest upstream release 3.4.0
Resolves: rhbz#1964341