diff --git a/0016-Fix-log-message-for-the-LVM-devices-filter.patch b/0016-Fix-log-message-for-the-LVM-devices-filter.patch new file mode 100644 index 0000000..df27558 --- /dev/null +++ b/0016-Fix-log-message-for-the-LVM-devices-filter.patch @@ -0,0 +1,33 @@ +From 52019b19caaf383daa5f2f0437e0c9e262adb45e Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Mon, 13 Dec 2021 14:18:12 +0100 +Subject: [PATCH] Fix log message for the LVM devices filter + +--- + blivet/devicelibs/lvm.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/blivet/devicelibs/lvm.py b/blivet/devicelibs/lvm.py +index 3ab1540b..bbde6303 100644 +--- a/blivet/devicelibs/lvm.py ++++ b/blivet/devicelibs/lvm.py +@@ -133,14 +133,14 @@ def needs_config_refresh(fn): + @needs_config_refresh + def lvm_devices_add(path): + """ Add a device (PV) to the list of devices LVM is allowed to use """ +- log.debug("lvm filter: device %s added to the list of allowed devices") ++ log.debug("lvm filter: device %s added to the list of allowed devices", path) + _lvm_devices.add(path) + + + @needs_config_refresh + def lvm_devices_remove(path): + """ Remove a device (PV) to the list of devices LVM is allowed to use """ +- log.debug("lvm filter: device %s removed from the list of allowed devices") ++ log.debug("lvm filter: device %s removed from the list of allowed devices", path) + try: + _lvm_devices.remove(path) + except KeyError: +-- +2.34.1 + diff --git a/0017-Exclude-unusable-disks-from-PartitionFactory.patch b/0017-Exclude-unusable-disks-from-PartitionFactory.patch new file mode 100644 index 0000000..6557f72 --- /dev/null +++ b/0017-Exclude-unusable-disks-from-PartitionFactory.patch @@ -0,0 +1,81 @@ +From f02dbed9143664246d400b0f5654062dff5383fc Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Thu, 13 Jan 2022 16:53:30 +0100 +Subject: [PATCH 1/2] Exclude unusable disks from PartitionFactory + +We already remove disks that are too small or not partitionable +in the PartitionSetFactory which allows us to create partitions +on multipath devices where Anaconda tells us to use both the mpath +device and the backing disks, we should do the same for the +PartitionFactory. + +Resolves: rhbz#2017432 +--- + blivet/devicefactory.py | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py +index 0f7fdfa1..45b38b0f 100644 +--- a/blivet/devicefactory.py ++++ b/blivet/devicefactory.py +@@ -1056,6 +1056,24 @@ class PartitionFactory(DeviceFactory): + **kwargs) + return device + ++ def _configure(self): ++ disks = [] ++ for disk in self.disks: ++ if not disk.partitioned: ++ log.debug("removing unpartitioned disk %s", disk.name) ++ elif not disk.format.supported: ++ log.debug("removing disk with unsupported format %s", disk.name) ++ else: ++ disks.append(disk) ++ ++ if not disks: ++ raise DeviceFactoryError("no usable disks specified for partition") ++ ++ log.debug("setting new factory disks to %s", [d.name for d in disks]) ++ self.disks = disks # pylint: disable=attribute-defined-outside-init ++ ++ super(PartitionFactory, self)._configure() ++ + def _set_disks(self): + self.raw_device.req_disks = self.disks[:] + +-- +2.34.1 + + +From a9adcb050a16ab8231c81ced68302d6ad685ccf4 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Thu, 13 Jan 2022 17:27:08 +0100 +Subject: [PATCH 2/2] Show better error when using unitialized disk in + do_partitioning + +Now all we get is "KeyError: '/dev/sda'" for example. + +Related: rhbz#2017432 +--- + blivet/partitioning.py | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/blivet/partitioning.py b/blivet/partitioning.py +index 53f9cc3f..23b150f9 100644 +--- a/blivet/partitioning.py ++++ b/blivet/partitioning.py +@@ -764,7 +764,10 @@ def allocate_partitions(storage, disks, partitions, freespace, boot_disk=None): + growth = 0 # in sectors + # loop through disks + for _disk in req_disks: +- disklabel = disklabels[_disk.path] ++ try: ++ disklabel = disklabels[_disk.path] ++ except KeyError: ++ raise PartitioningError("Requested disk %s doesn't have a usable disklabel for partitioning" % _disk.name) + best = None + current_free = free + try: +-- +2.34.1 + diff --git a/python-blivet.spec b/python-blivet.spec index f30bbe4..f9685a1 100644 --- a/python-blivet.spec +++ b/python-blivet.spec @@ -23,7 +23,7 @@ Version: 3.4.0 #%%global prerelease .b2 # prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2 -Release: 11%{?prerelease}%{?dist} +Release: 12%{?prerelease}%{?dist} Epoch: 1 License: LGPLv2+ %global realname blivet @@ -44,6 +44,8 @@ Patch10: 0012-Improve-error-message-printed-for-missing-dependecie.patch Patch11: 0013-Use-bigger-chunk-size-for-thinpools-bigger-than-15.8.patch Patch12: 0014-LVM-devices-file-support.patch Patch13: 0015-iscsi-Replace-all-log_exception_info-calls-with-log.patch +Patch14: 0016-Fix-log-message-for-the-LVM-devices-filter.patch +Patch15: 0017-Exclude-unusable-disks-from-PartitionFactory.patch # Versions of required components (done so we make sure the buildrequires # match the requires versions of things). @@ -206,6 +208,12 @@ configuration. %endif %changelog +* Tue Feb 01 2022 Vojtech Trefny - 3.4.0-12 +- Fix log message for the LVM devices filter + Resolves: rhbz#2034277 +- Exclude unusable disks from PartitionFactory + Resolves: rhbz#2017432 + * Tue Dec 14 2021 Vojtech Trefny - 3.4.0-11 - Replace all log_exception_info calls with log.info Resolves: rhbz#2028391