!92 Exclude unusable disks from PartitionFactory
From: @han_hui_hui Reviewed-by: @t_feng Signed-off-by: @t_feng
This commit is contained in:
commit
9506a4c118
@ -0,0 +1,33 @@
|
||||
From b20753ac6db14999270d71387309baa9270aa927 Mon Sep 17 00:00:00 2001
|
||||
From: Vojtech Trefny <vtrefny@redhat.com>
|
||||
Date: Thu, 13 Jan 2022 17:27:08 +0100
|
||||
Subject: [PATCH] Show better error when using unitialized disk in
|
||||
do_partitioning
|
||||
|
||||
Now all we get is "KeyError: '/dev/sda'" for example.
|
||||
|
||||
Related: rhbz#2017432
|
||||
|
||||
Conflict:NA
|
||||
Reference:https://github.com/storaged-project/blivet/commit/b20753ac6db14999270d71387309baa9270aa927
|
||||
|
||||
---
|
||||
blivet/partitioning.py | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/blivet/partitioning.py b/blivet/partitioning.py
|
||||
index f12ec3c9e..ce77e4eb7 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:
|
||||
@ -0,0 +1,49 @@
|
||||
From 61c09c6922748877595272479d68270fe442f3d4 Mon Sep 17 00:00:00 2001
|
||||
From: Vojtech Trefny <vtrefny@redhat.com>
|
||||
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[:]
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
From 00cdf3f0ace5f4d5407dbf610f056fef667c1cd2 Mon Sep 17 00:00:00 2001
|
||||
From: bitcoffeeiux <liuxin264@huawei.com>
|
||||
Date: Fri, 4 Jun 2021 02:23:37 +0800
|
||||
Subject: [PATCH] function allocate_partitions threw an exception
|
||||
while adding /boot partitions to a RAID disk
|
||||
|
||||
---
|
||||
blivet/partitioning.py | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/blivet/partitioning.py b/blivet/partitioning.py
|
||||
index 40644f9..8219841 100644
|
||||
--- a/blivet/partitioning.py
|
||||
+++ b/blivet/partitioning.py
|
||||
@@ -758,6 +758,8 @@ def allocate_partitions(storage, disks, partitions, freespace, boot_disk=None):
|
||||
growth = 0 # in sectors
|
||||
# loop through disks
|
||||
for _disk in req_disks:
|
||||
+ if _disk.path not in disklabels:
|
||||
+ continue
|
||||
disklabel = disklabels[_disk.path]
|
||||
best = None
|
||||
current_free = free
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
Name: python-blivet
|
||||
Version: 3.2.2
|
||||
Release: 11
|
||||
Release: 12
|
||||
Epoch: 1
|
||||
Summary: A python module for system storage configuration
|
||||
License: LGPLv2+
|
||||
@ -23,7 +23,6 @@ Patch9000: fix-the-long-hostname.patch
|
||||
Patch6000: backport-Account-for-pmspare-grow-when-adjusting-thinpool-metadata.patch
|
||||
Patch6001: backport-Close-fd-if-it-fails-to-read-the-device.patch
|
||||
Patch6002: backport-Fix-UnboundLocalError.patch
|
||||
Patch9001: huawei-fix-allocate-partitions-threw-exception-when-raid.patch
|
||||
|
||||
Patch6003: backport-Convert-LVM-filter-lists-to-sets.patch
|
||||
Patch6004: backport-Remove-action-device-from-LVM-reject-list.patch
|
||||
@ -33,6 +32,9 @@ Patch6006: backport-Fix-reading-hidden-sysfs-attribute.patch
|
||||
Patch6007: backport-Fix-logging-information-about-ignoring-hidden-device.patch
|
||||
Patch9002: Incomplete-Chineseization-of-disk-mount.patch
|
||||
|
||||
Patch6008: backport-Exclude-unusable-disks-from-PartitionFactory-1.patch
|
||||
Patch6009: backport-Exclude-unusable-disks-from-PartitionFactory-2.patch
|
||||
|
||||
%description
|
||||
The python-blivet package is a python module for examining and modifying
|
||||
storage configuration.
|
||||
@ -132,6 +134,12 @@ make PYTHON=%{__python2} DESTDIR=%{buildroot} install
|
||||
%doc README
|
||||
|
||||
%changelog
|
||||
* Tue Dec 27 2022 hanhuihui<hanhuihui5@huawei.com> - 1:3.2.2-12
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:Exclude unusable disks from PartitionFactory
|
||||
|
||||
* Thu Dec 08 2022 wanglimin<wanglimin@xfusion.com> - 1:3.2.2-11
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user