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