Blame SOURCES/0009-Catch-BlockDevNotImplementedError-for-btrfs-plugin-c.patch

f37345
From fed62af06eb1584adbacd821dfe79c2df52c6aa4 Mon Sep 17 00:00:00 2001
f37345
From: Vojtech Trefny <vtrefny@redhat.com>
f37345
Date: Wed, 2 Nov 2022 12:14:28 +0100
f37345
Subject: [PATCH] Catch BlockDevNotImplementedError for btrfs plugin calls
f37345
f37345
This is a workaround for RHEL where the btrfs plugin is not
f37345
available and where we might still try to call some libblockdev
f37345
functions to gather information about preexisting btrfs devices.
f37345
---
f37345
 blivet/devices/btrfs.py | 8 ++++----
f37345
 1 file changed, 4 insertions(+), 4 deletions(-)
f37345
f37345
diff --git a/blivet/devices/btrfs.py b/blivet/devices/btrfs.py
f37345
index 0e029715..1ae6a04d 100644
f37345
--- a/blivet/devices/btrfs.py
f37345
+++ b/blivet/devices/btrfs.py
f37345
@@ -362,7 +362,7 @@ class BTRFSVolumeDevice(BTRFSDevice, ContainerDevice, RaidDevice):
f37345
         try:
f37345
             subvols = blockdev.btrfs.list_subvolumes(mountpoint,
f37345
                                                      snapshots_only=snapshots_only)
f37345
-        except blockdev.BtrfsError as e:
f37345
+        except (blockdev.BtrfsError, blockdev.BlockDevNotImplementedError) as e:
f37345
             log.debug("failed to list subvolumes: %s", e)
f37345
         else:
f37345
             self._get_default_subvolume_id()
f37345
@@ -400,7 +400,7 @@ class BTRFSVolumeDevice(BTRFSDevice, ContainerDevice, RaidDevice):
f37345
         with self._do_temp_mount() as mountpoint:
f37345
             try:
f37345
                 subvolid = blockdev.btrfs.get_default_subvolume_id(mountpoint)
f37345
-            except blockdev.BtrfsError as e:
f37345
+            except (blockdev.BtrfsError, blockdev.BlockDevNotImplementedError) as e:
f37345
                 log.debug("failed to get default subvolume id: %s", e)
f37345
 
f37345
         self._default_subvolume_id = subvolid
f37345
@@ -413,7 +413,7 @@ class BTRFSVolumeDevice(BTRFSDevice, ContainerDevice, RaidDevice):
f37345
         with self._do_temp_mount() as mountpoint:
f37345
             try:
f37345
                 blockdev.btrfs.set_default_subvolume(mountpoint, vol_id)
f37345
-            except blockdev.BtrfsError as e:
f37345
+            except (blockdev.BtrfsError, blockdev.BlockDevNotImplementedError) as e:
f37345
                 log.error("failed to set new default subvolume id (%s): %s",
f37345
                           vol_id, e)
f37345
                 # The only time we set a new default subvolume is so we can remove
f37345
@@ -471,7 +471,7 @@ class BTRFSVolumeDevice(BTRFSDevice, ContainerDevice, RaidDevice):
f37345
         if not self.format.vol_uuid:
f37345
             try:
f37345
                 bd_info = blockdev.btrfs.filesystem_info(self.parents[0].path)
f37345
-            except blockdev.BtrfsError as e:
f37345
+            except (blockdev.BtrfsError, blockdev.BlockDevNotImplementedError) as e:
f37345
                 log.error("failed to get filesystem info for new btrfs volume %s", e)
f37345
             else:
f37345
                 self.format.vol_uuid = bd_info.uuid
f37345
-- 
f37345
2.38.1
f37345