neil / rpms / python-blivet

Forked from rpms/python-blivet a year ago
Clone

Blame SOURCES/0005-Fix-activating-old-style-LVM-snapshots.patch

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