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