From 61c09c6922748877595272479d68270fe442f3d4 Mon Sep 17 00:00:00 2001 From: Vojtech Trefny Date: Thu, 13 Jan 2022 16:53:30 +0100 Subject: [PATCH] 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 Conflict:NA Reference:https://github.com/storaged-project/blivet/commit/61c09c6922748877595272479d68270fe442f3d4 --- blivet/devicefactory.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py index e6b8c1fad..2499484bf 100644 --- a/blivet/devicefactory.py +++ b/blivet/devicefactory.py @@ -1065,6 +1065,24 @@ def _get_new_device(self, *args, **kwargs): **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[:]