From 78a5e839fe5213f0f447fde8514951314f7d38b7 Mon Sep 17 00:00:00 2001 From: han_hui_hui Date: Wed, 4 Jan 2023 01:43:46 +0000 Subject: [PATCH] sync master branch --- Incomplete-Chineseization-of-disk-mount.patch | 60 +++++++++++++++++++ ...usable-disks-from-PartitionFactory-1.patch | 33 ++++++++++ ...usable-disks-from-PartitionFactory-2.patch | 49 +++++++++++++++ ...partitions-threw-exception-when-raid.patch | 26 -------- python-blivet.spec | 21 +++++-- 5 files changed, 159 insertions(+), 30 deletions(-) create mode 100644 Incomplete-Chineseization-of-disk-mount.patch create mode 100644 backport-Exclude-unusable-disks-from-PartitionFactory-1.patch create mode 100644 backport-Exclude-unusable-disks-from-PartitionFactory-2.patch delete mode 100644 fix-allocate-partitions-threw-exception-when-raid.patch diff --git a/Incomplete-Chineseization-of-disk-mount.patch b/Incomplete-Chineseization-of-disk-mount.patch new file mode 100644 index 0000000..7e93840 --- /dev/null +++ b/Incomplete-Chineseization-of-disk-mount.patch @@ -0,0 +1,60 @@ +diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py +index efadd25..7b9243a 100644 +--- a/blivet/devicefactory.py ++++ b/blivet/devicefactory.py +@@ -39,6 +39,7 @@ from .partitioning import TotalSizeSet + from .partitioning import do_partitioning + from .size import Size + from .static_data import luks_data ++from .i18n import _ + + import gi + gi.require_version("BlockDev", "2.0") +@@ -714,7 +715,7 @@ class DeviceFactory(object): + # the container + size = self._get_device_size() + if size <= Size(0): +- raise DeviceFactoryError("not enough free space for new device") ++ raise DeviceFactoryError(_("not enough free space for new device")) + + parents = self._get_parent_devices() + +@@ -1322,7 +1323,7 @@ class LVMFactory(DeviceFactory): + self.size += self.device.size + + if self.size == Size(0): +- raise DeviceFactoryError("not enough free space for new device") ++ raise DeviceFactoryError(_("not enough free space for new device")) + else: + super(LVMFactory, self)._handle_no_size() + +diff --git a/po/blivet.pot b/po/blivet.pot +index 40ef843..7d49527 100644 +--- a/po/blivet.pot ++++ b/po/blivet.pot +@@ -126,6 +126,10 @@ msgstr "" + msgid "FCoE not available" + msgstr "" + ++#: ../blivet/devicefactory.py:718 ../blivet/devicefactory.py:1326 ++msgid "not enough free space for new device" ++msgstr "" ++ + #: ../blivet/iscsi.py:217 + msgid "Unable to change iSCSI initiator name once set" + msgstr "" +diff --git a/po/zh_CN.po b/po/zh_CN.po +index aad3d0f..31f7017 100644 +--- a/po/zh_CN.po ++++ b/po/zh_CN.po +@@ -150,6 +150,10 @@ msgstr "" + msgid "FCoE not available" + msgstr "FCoE 不可用" + ++#: ../blivet/devicefactory.py:718 ../blivet/devicefactory.py:1326 ++msgid "not enough free space for new device" ++msgstr "新设备没有足够的剩余空间" ++ + #: ../blivet/iscsi.py:217 + msgid "Unable to change iSCSI initiator name once set" + msgstr "设定后就无法更改 iSCSI 启动程序名称" diff --git a/backport-Exclude-unusable-disks-from-PartitionFactory-1.patch b/backport-Exclude-unusable-disks-from-PartitionFactory-1.patch new file mode 100644 index 0000000..ab29983 --- /dev/null +++ b/backport-Exclude-unusable-disks-from-PartitionFactory-1.patch @@ -0,0 +1,33 @@ +From b20753ac6db14999270d71387309baa9270aa927 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +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: diff --git a/backport-Exclude-unusable-disks-from-PartitionFactory-2.patch b/backport-Exclude-unusable-disks-from-PartitionFactory-2.patch new file mode 100644 index 0000000..7c8d681 --- /dev/null +++ b/backport-Exclude-unusable-disks-from-PartitionFactory-2.patch @@ -0,0 +1,49 @@ +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[:] + diff --git a/fix-allocate-partitions-threw-exception-when-raid.patch b/fix-allocate-partitions-threw-exception-when-raid.patch deleted file mode 100644 index ca322b5..0000000 --- a/fix-allocate-partitions-threw-exception-when-raid.patch +++ /dev/null @@ -1,26 +0,0 @@ -From c9ddcf46a10738017fb442025c25863c25c20142 Mon Sep 17 00:00:00 2001 -From: bitcoffeeiux -Date: Fri, 4 Jun 2021 04:27:53 +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 53f9cc3..0b544be 100644 ---- a/blivet/partitioning.py -+++ b/blivet/partitioning.py -@@ -764,6 +764,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 - diff --git a/python-blivet.spec b/python-blivet.spec index e9ba19b..62764df 100644 --- a/python-blivet.spec +++ b/python-blivet.spec @@ -3,7 +3,7 @@ Name: python-blivet Version: 3.4.2 -Release: 3 +Release: 5 Epoch: 1 Summary: A python module for system storage configuration License: LGPLv2+ @@ -19,13 +19,14 @@ BuildRequires: python2-devel python2-setuptools Patch0: 0001-force-lvm-plugin.patch Patch1: fix-the-long-hostname.patch -Patch9000: fix-allocate-partitions-threw-exception-when-raid.patch Patch9001: 0001-Make-sure-we-mount-the-top-level-subvolume-when-moun.patch %ifarch sw_64 Patch9002: blivet-3.4.2-sw.patch %endif +patch9003: Incomplete-Chineseization-of-disk-mount.patch - +patch6001: backport-Exclude-unusable-disks-from-PartitionFactory-1.patch +patch6002: backport-Exclude-unusable-disks-from-PartitionFactory-2.patch %description The python-blivet package is a python module for examining and modifying @@ -126,6 +127,18 @@ make PYTHON=%{__python2} DESTDIR=%{buildroot} install %doc README.md %changelog +* Tue Dec 27 2022 hanhuihui - 1:3.4.2-5 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:Exclude unusable disks from PartitionFactory + +* Fri Dec 09 2022 wanglimin - 1:3.4.2-4 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC: Incomplete Chineseization of disk mount + * Tue Oct 18 2022 wuzx - 3.4.2-3 - add sw64 patch @@ -133,7 +146,7 @@ make PYTHON=%{__python2} DESTDIR=%{buildroot} install - Fix remove subvolumes error on brtfs during installation. * Wed Dec 15 2021 yangcheng - 3.4.2-1 -- Upgrade to 3.4.2 +- DESC:Upgrade to 3.4.2 * Fri Dec 10 2021 yanan - 3.3.2-4 - Type:bugfix -- Gitee