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