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