python-blivet/0005-Fix-activating-old-style-LVM-snapshots.patch

36 lines
1.3 KiB
Diff

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):