neil / rpms / python-blivet

Forked from rpms/python-blivet a year ago
Clone

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

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