5c7b2d
From 8ece3da18b1abb89320d02f4475002e6a3ed7875 Mon Sep 17 00:00:00 2001
5c7b2d
From: Vojtech Trefny <vtrefny@redhat.com>
5c7b2d
Date: Thu, 20 May 2021 13:40:26 +0200
5c7b2d
Subject: [PATCH] Fix activating old style LVM snapshots
5c7b2d
5c7b2d
The old style snapshots are activated together with the origin LV
5c7b2d
so we need to make sure it is activated to be able to remove the
5c7b2d
snapshot or its format.
5c7b2d
5c7b2d
Resolves: rhbz#1961739
5c7b2d
---
5c7b2d
 blivet/devices/lvm.py | 10 +++++++---
5c7b2d
 1 file changed, 7 insertions(+), 3 deletions(-)
5c7b2d
5c7b2d
diff --git a/blivet/devices/lvm.py b/blivet/devices/lvm.py
5c7b2d
index a55515fcb..fb57804d9 100644
5c7b2d
--- a/blivet/devices/lvm.py
5c7b2d
+++ b/blivet/devices/lvm.py
5c7b2d
@@ -1461,9 +1461,13 @@ def _set_format(self, fmt):  # pylint: disable=unused-argument
5c7b2d
             self._update_format_from_origin()
5c7b2d
 
5c7b2d
     @old_snapshot_specific
5c7b2d
-    def setup(self, orig=False):
5c7b2d
-        # the old snapshot cannot be setup and torn down
5c7b2d
-        pass
5c7b2d
+    def setup(self, orig=False):  # pylint: disable=unused-argument
5c7b2d
+        # the old snapshot is activated together with the origin
5c7b2d
+        if self.origin and not self.origin.status:
5c7b2d
+            try:
5c7b2d
+                self.origin.setup()
5c7b2d
+            except blockdev.LVMError as lvmerr:
5c7b2d
+                log.error("failed to activate origin LV: %s", lvmerr)
5c7b2d
 
5c7b2d
     @old_snapshot_specific
5c7b2d
     def teardown(self, recursive=False):