diff --git a/0001-add-loongarch64-support-for-blivet.patch b/0001-add-loongarch64-support-for-blivet.patch deleted file mode 100644 index 490624886a6b115ba70a925b68164f76edec7c75..0000000000000000000000000000000000000000 --- a/0001-add-loongarch64-support-for-blivet.patch +++ /dev/null @@ -1,34 +0,0 @@ -From eb09799f88ac34011854556406fd13d59299ed75 Mon Sep 17 00:00:00 2001 -From: Wenlong Zhang -Date: Thu, 31 Aug 2023 07:38:53 +0000 -Subject: [PATCH] add loongarch64 support for blivet - ---- - blivet/arch.py | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/blivet/arch.py b/blivet/arch.py -index 2cd978e..bc76031 100644 ---- a/blivet/arch.py -+++ b/blivet/arch.py -@@ -333,6 +333,8 @@ def is_ipseries(): - def is_powernv(): - return is_ppc() and get_ppc_machine() == "PowerNV" - -+def is_loongarch(): -+ return os.uname()[4] == 'loongarch64' - - def get_arch(): - """ -@@ -349,6 +351,8 @@ def get_arch(): - elif is_ppc(bits=64): - # ppc64 and ppc64le are distinct architectures - return os.uname()[4] -+ elif is_loongarch(): -+ return os.uname()[4] - elif is_aarch64(): - return 'aarch64' - elif is_alpha(): --- -2.40.1 - diff --git a/0001-remove-btrfs-plugin.patch b/0001-remove-btrfs-plugin.patch new file mode 100644 index 0000000000000000000000000000000000000000..601517fea5f1e8fb69cd4d017030f2901ac54229 --- /dev/null +++ b/0001-remove-btrfs-plugin.patch @@ -0,0 +1,28 @@ +From 8b527ee85b6594d506d445ff4c30579cccef8ae6 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Wed, 11 Nov 2020 13:24:55 +0100 +Subject: [PATCH] Remove btrfs from requested libblockdev plugins + +--- + blivet/__init__.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/blivet/__init__.py b/blivet/__init__.py +index 14bd5c61..1410d78e 100644 +--- a/blivet/__init__.py ++++ b/blivet/__init__.py +@@ -63,9 +63,9 @@ gi.require_version("BlockDev", "3.0") + from gi.repository import GLib + from gi.repository import BlockDev as blockdev + if arch.is_s390(): +- _REQUESTED_PLUGIN_NAMES = set(("lvm", "btrfs", "swap", "crypto", "loop", "mdraid", "mpath", "dm", "s390", "nvme", "fs")) ++ _REQUESTED_PLUGIN_NAMES = set(("lvm", "swap", "crypto", "loop", "mdraid", "mpath", "dm", "s390", "nvme", "fs")) + else: +- _REQUESTED_PLUGIN_NAMES = set(("lvm", "btrfs", "swap", "crypto", "loop", "mdraid", "mpath", "dm", "nvme", "fs")) ++ _REQUESTED_PLUGIN_NAMES = set(("lvm", "swap", "crypto", "loop", "mdraid", "mpath", "dm", "nvme", "fs")) + + _requested_plugins = blockdev.plugin_specs_from_names(_REQUESTED_PLUGIN_NAMES) + try: +-- +2.26.2 + diff --git a/0002-Fix-skipping-btrfs-calls-when-libblockdev-btrfs-plugin-is-missing.patch b/0002-Fix-skipping-btrfs-calls-when-libblockdev-btrfs-plugin-is-missing.patch new file mode 100644 index 0000000000000000000000000000000000000000..cd9bf02d6f385fce2f858a0cb9f2d348d42b74de --- /dev/null +++ b/0002-Fix-skipping-btrfs-calls-when-libblockdev-btrfs-plugin-is-missing.patch @@ -0,0 +1,49 @@ +From 95f565d56d21dd7e0d9033236a20be735665e0af Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Tue, 14 May 2024 12:35:12 +0200 +Subject: [PATCH] Fix skipping btrfs calls when libblockdev btrfs plugin is + missing + +We need to check for the btrfs plugin in the set of available +plugins, not in the missing plugins, because on RHEL the plugin is +not missing, it's not even requested. +--- + blivet/devices/btrfs.py | 4 ++-- + tests/unit_tests/devices_test/btrfs_test.py | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/blivet/devices/btrfs.py b/blivet/devices/btrfs.py +index c446e7e59..0cbaa44d9 100644 +--- a/blivet/devices/btrfs.py ++++ b/blivet/devices/btrfs.py +@@ -40,7 +40,7 @@ + from ..formats import get_format, DeviceFormat + from ..size import Size + from ..mounts import mounts_cache +-from .. import missing_plugs ++from .. import avail_plugs + + import logging + log = logging.getLogger("blivet") +@@ -382,7 +382,7 @@ def _list_subvolumes(self, mountpoint, snapshots_only=False): + def list_subvolumes(self, snapshots_only=False): + subvols = [] + +- if "btrfs" in missing_plugs: ++ if "btrfs" not in avail_plugs: + log.debug("not listing btrfs subvolumes, libblockdev btrfs plugin is missing") + return subvols + +diff --git a/tests/unit_tests/devices_test/btrfs_test.py b/tests/unit_tests/devices_test/btrfs_test.py +index 785afd209..41731e91e 100644 +--- a/tests/unit_tests/devices_test/btrfs_test.py ++++ b/tests/unit_tests/devices_test/btrfs_test.py +@@ -83,7 +83,7 @@ def test_btrfs_list_subvolumes(self): + + # mounted but libblockdev btrfs plugin not available + blockdev.reset_mock() +- with patch("blivet.devices.btrfs.missing_plugs", new={"btrfs"}): ++ with patch("blivet.devices.btrfs.avail_plugs", new={"lvm"}): + vol.list_subvolumes() + blockdev.list_subvolumes.assert_not_called() + blockdev.get_default_subvolume_id.assert_not_called() diff --git a/0003-XFS-resize-test-fix.patch b/0003-XFS-resize-test-fix.patch new file mode 100644 index 0000000000000000000000000000000000000000..b36d8c64cfc5d7063f0a8d0f1fa3b0220a32ed98 --- /dev/null +++ b/0003-XFS-resize-test-fix.patch @@ -0,0 +1,32 @@ +From b7940496b4f8efdccb9b4097b496b0d9b2af1eea Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Tue, 18 Jun 2024 14:47:39 +0200 +Subject: [PATCH] tests: Try waiting after partition creation for XFS resize + test + +The test randomly fails to find the newly created partition so +lets try waiting a bit with udev settle. +--- + tests/storage_tests/formats_test/fs_test.py | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/tests/storage_tests/formats_test/fs_test.py b/tests/storage_tests/formats_test/fs_test.py +index f3c9fef5a..5da4a9339 100644 +--- a/tests/storage_tests/formats_test/fs_test.py ++++ b/tests/storage_tests/formats_test/fs_test.py +@@ -11,6 +11,7 @@ + from blivet.devices import PartitionDevice, DiskDevice + from blivet.flags import flags + from blivet.util import capture_output ++from blivet import udev + + from .loopbackedtestcase import LoopBackedTestCase + +@@ -149,6 +150,7 @@ def _create_partition(self, disk, size): + pend = pstart + int(Size(size) / disk.format.parted_device.sectorSize) + disk.format.add_partition(pstart, pend, parted.PARTITION_NORMAL) + disk.format.parted_disk.commit() ++ udev.settle() + part = disk.format.parted_disk.getPartitionBySector(pstart) + + device = PartitionDevice(os.path.basename(part.path)) diff --git a/0004-Run-mkfs-xfs-with-force-option-by-default.patch b/0004-Run-mkfs-xfs-with-force-option-by-default.patch new file mode 100644 index 0000000000000000000000000000000000000000..5473e0504b4e8b89e6d94d660193d0e67c9a9392 --- /dev/null +++ b/0004-Run-mkfs-xfs-with-force-option-by-default.patch @@ -0,0 +1,43 @@ +From 52c9699ecad592e35e0cd3841744f8cb8e2b2364 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Wed, 12 Jun 2024 16:51:43 +0200 +Subject: [PATCH] Run mkfs.xfs with the force (-f) option by default + +We stopped adding the force option when switching to libblockdev +in fa3add214ba8edf1965bc851b85f2f2a6a3ea107. This was not +intentional and the missing force option is already causing issues +when running mkfs.xfs on misaligned devices. +--- + blivet/tasks/fsmkfs.py | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/blivet/tasks/fsmkfs.py b/blivet/tasks/fsmkfs.py +index 096b02295..45314ea89 100644 +--- a/blivet/tasks/fsmkfs.py ++++ b/blivet/tasks/fsmkfs.py +@@ -241,6 +241,7 @@ class FSBlockDevMkfs(task.BasicApplication, FSMkfsTask, metaclass=abc.ABCMeta): + can_set_uuid = False + can_label = False + fstype = None ++ force = False + + def do_task(self, options=None, label=False, set_uuid=False, nodiscard=False): + """Create the format on the device and label if possible and desired. +@@ -277,7 +278,8 @@ def do_task(self, options=None, label=False, set_uuid=False, nodiscard=False): + try: + bd_options = BlockDev.FSMkfsOptions(label=self.fs.label if label else None, + uuid=self.fs.uuid if set_uuid else None, +- no_discard=self.fs._mkfs_nodiscard if nodiscard else False) ++ no_discard=self.fs._mkfs_nodiscard if nodiscard else False, ++ force=self.force) + BlockDev.fs.mkfs(self.fs.device, self.fstype, bd_options, extra={k: '' for k in create_options}) + except BlockDev.FSError as e: + raise FSError(str(e)) +@@ -331,6 +333,7 @@ class XFSMkfs(FSBlockDevMkfs): + can_nodiscard = True + can_set_uuid = True + can_label = True ++ force = True + + + class F2FSMkfs(FSBlockDevMkfs): diff --git a/0005-consolidated-s390-device-configuration.patch b/0005-consolidated-s390-device-configuration.patch new file mode 100644 index 0000000000000000000000000000000000000000..4ad6bb8de40affbd8760b4551d279f9e3b94c9b6 --- /dev/null +++ b/0005-consolidated-s390-device-configuration.patch @@ -0,0 +1,742 @@ +From 492122f34fe0ee5d0c7bce7f3dd2ce0ca6e3e9f2 Mon Sep 17 00:00:00 2001 +From: Steffen Maier +Date: Fri, 27 Jan 2023 22:01:23 +0100 +Subject: [PATCH 1/7] blivet/zfcp: drop modprobe alias, which is superfluous + since udev in RHEL6 + +Signed-off-by: Steffen Maier +--- + blivet/zfcp.py | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/blivet/zfcp.py b/blivet/zfcp.py +index a2b7facb..cd765d82 100644 +--- a/blivet/zfcp.py ++++ b/blivet/zfcp.py +@@ -555,9 +555,6 @@ class zFCP: + f.write("%s\n" % (d,)) + f.close() + +- f = open(root + "/etc/modprobe.conf", "a") +- f.write("alias scsi_hostadapter zfcp\n") +- f.close() + + + # Create ZFCP singleton +-- +2.45.2 + + +From a49fdf291acad957675472f5c27be9e5269c199a Mon Sep 17 00:00:00 2001 +From: Steffen Maier +Date: Tue, 28 Feb 2023 17:23:32 +0100 +Subject: [PATCH 2/7] blivet/zfcp: remove code broken since zfcp automatic LUN + scan + +The old existing test preceding the removed code was only designed for the +old zfcp before it got automatic LUN scan. Hence, the test is incomplete. +With zfcp auto LUN scan, zfcp can just have SCSI devices without any +zfcp unit representation in sysfs. +Do not bother cleaning up an unused FCP device and just remove the code. + +Note: Do not confuse zfcp auto port scan with zfcp auto LUN scan. + +Signed-off-by: Steffen Maier +--- + blivet/zfcp.py | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/blivet/zfcp.py b/blivet/zfcp.py +index cd765d82..e2c0dc2d 100644 +--- a/blivet/zfcp.py ++++ b/blivet/zfcp.py +@@ -384,9 +384,6 @@ class ZFCPDeviceFullPath(ZFCPDeviceBase): + self.devnum, luns[0]) + return True + +- # no other WWPNs/LUNs exists for this device number, it's safe to bring it offline +- self._set_zfcp_device_offline() +- + return True + + +-- +2.45.2 + + +From 19285bb785ccbfcd72fd1f3242c56e9d06ba74d8 Mon Sep 17 00:00:00 2001 +From: Steffen Maier +Date: Fri, 27 Jan 2023 22:17:45 +0100 +Subject: [PATCH 3/7] blivet/zfcp: drop old zfcp port handling gone from the + kernel long ago + +Gone since 2008 Linux kernel v2.6.27 commit 235f7f25f492 ("[SCSI] zfcp: +Remove sysfs attribute port_add"). + +Signed-off-by: Steffen Maier +--- + blivet/zfcp.py | 65 -------------------------------------------------- + 1 file changed, 65 deletions(-) + +diff --git a/blivet/zfcp.py b/blivet/zfcp.py +index e2c0dc2d..82751382 100644 +--- a/blivet/zfcp.py ++++ b/blivet/zfcp.py +@@ -240,7 +240,6 @@ class ZFCPDeviceFullPath(ZFCPDeviceBase): + + super().online_device() + +- portadd = "%s/%s/port_add" % (zfcpsysfs, self.devnum) + portdir = "%s/%s/%s" % (zfcpsysfs, self.devnum, self.wwpn) + unitadd = "%s/unit_add" % (portdir) + unitdir = "%s/%s" % (portdir, self.fcplun) +@@ -253,31 +252,6 @@ class ZFCPDeviceFullPath(ZFCPDeviceBase): + log.warning("zFCP device %s in NPIV mode brought online. All LUNs will be activated " + "automatically although WWPN and LUN have been provided.", self.devnum) + +- # create the sysfs directory for the WWPN/port +- if not os.path.exists(portdir): +- if os.path.exists(portadd): +- # older zfcp sysfs interface +- try: +- logged_write_line_to_file(portadd, self.wwpn) +- udev.settle() +- except OSError as e: +- raise ValueError(_("Could not add WWPN %(wwpn)s to zFCP " +- "device %(devnum)s (%(e)s).") +- % {'wwpn': self.wwpn, +- 'devnum': self.devnum, +- 'e': e}) +- else: +- # newer zfcp sysfs interface with auto port scan +- raise ValueError(_("WWPN %(wwpn)s not found at zFCP device " +- "%(devnum)s.") % {'wwpn': self.wwpn, +- 'devnum': self.devnum}) +- else: +- if os.path.exists(portadd): +- # older zfcp sysfs interface +- log.info("WWPN %(wwpn)s at zFCP device %(devnum)s already " +- "there.", {'wwpn': self.wwpn, +- 'devnum': self.devnum}) +- + # create the sysfs directory for the LUN/unit + if not os.path.exists(unitdir): + try: +@@ -323,10 +297,7 @@ class ZFCPDeviceFullPath(ZFCPDeviceBase): + def offline_device(self): + """Remove the zFCP device from the system.""" + +- portadd = "%s/%s/port_add" % (zfcpsysfs, self.devnum) +- portremove = "%s/%s/port_remove" % (zfcpsysfs, self.devnum) + unitremove = "%s/%s/%s/unit_remove" % (zfcpsysfs, self.devnum, self.wwpn) +- portdir = "%s/%s/%s" % (zfcpsysfs, self.devnum, self.wwpn) + devdir = "%s/%s" % (zfcpsysfs, self.devnum) + + try: +@@ -348,42 +319,6 @@ class ZFCPDeviceFullPath(ZFCPDeviceBase): + % {'fcplun': self.fcplun, 'wwpn': self.wwpn, + 'devnum': self.devnum, 'e': e}) + +- # remove the WWPN only if there are no other LUNs attached +- if os.path.exists(portadd): +- # only try to remove ports with older zfcp sysfs interface +- for lun in os.listdir(portdir): +- if lun.startswith("0x") and \ +- os.path.isdir(os.path.join(portdir, lun)): +- log.info("Not removing WWPN %s at zFCP device %s since port still has other LUNs, e.g. %s.", +- self.wwpn, self.devnum, lun) +- return True +- +- try: +- logged_write_line_to_file(portremove, self.wwpn) +- except OSError as e: +- raise ValueError(_("Could not remove WWPN %(wwpn)s on zFCP " +- "device %(devnum)s (%(e)s).") +- % {'wwpn': self.wwpn, +- 'devnum': self.devnum, 'e': e}) +- +- # check if there are other WWPNs existing for the zFCP device number +- if os.path.exists(portadd): +- # older zfcp sysfs interface +- for port in os.listdir(devdir): +- if port.startswith("0x") and \ +- os.path.isdir(os.path.join(devdir, port)): +- log.info("Not setting zFCP device %s offline since it still has other ports, e.g. %s.", +- self.devnum, port) +- return True +- else: +- # newer zfcp sysfs interface with auto port scan +- luns = glob.glob("%s/0x????????????????/0x????????????????" +- % (devdir,)) +- if len(luns) != 0: +- log.info("Not setting zFCP device %s offline since it still has other LUNs, e.g. %s.", +- self.devnum, luns[0]) +- return True +- + return True + + +-- +2.45.2 + + +From cc67470805d871ff6ec09d554fb4b65a375e5b59 Mon Sep 17 00:00:00 2001 +From: Steffen Maier +Date: Tue, 16 Jul 2024 10:21:00 +0200 +Subject: [PATCH 4/7] blivet/zfcp: change to consolidated persistent device + config by zdev (#1802482,#1937049) + +Implements the zfcp part of referenced bugs. + +https://github.com/ibm-s390-linux/s390-tools/tree/master/zdev/ +handles everything as of +ibm-s390-linux/s390-tools@06a30ae +("zdev/dracut: add rd.zfcp cmdline option handling"). + +It is no longer necessary to perform individual pre-req steps, such as +setting an FCP device online, when we want to attach a LUN. Just call +chzdev to configure zfcp LUNs and let it do what is necessary, including +cio_ignore handling and udev settle. + +The spec file update reflects the new dependency on `chzdev` from the +s390 architecture specific sub-package s390utils-core. Actually, this +commit here only depends on `chzdev` in older versions already packaged +and shipped, so no version comparison necessary here. + +Since chzdev now implicitly sets the FCP device online +and there is no more preceding explicit FCP device online, +move the path over-specification warning after the call to chzdev. +Otherwise, the FCP device could still be offline and its +port_type unknown, so has_auto_lun_scan() would get wrong information +regarding the port_type being NPIV. + +Anaconda handles the persistent config of all s390 device types as of +commit ("write persistent config of any (dasd,zfcp,znet) s390 devices to +sysroot"), so drop the special handling in zfcp.write(). + +Signed-off-by: Steffen Maier +--- + blivet/zfcp.py | 99 +++++++++------------------------------------- + python-blivet.spec | 1 + + 2 files changed, 20 insertions(+), 80 deletions(-) + +diff --git a/blivet/zfcp.py b/blivet/zfcp.py +index 82751382..38ab5668 100644 +--- a/blivet/zfcp.py ++++ b/blivet/zfcp.py +@@ -104,8 +104,6 @@ class ZFCPDeviceBase(ABC): + if not self.devnum: + raise ValueError(_("You have not specified a device number or the number is invalid")) + +- self._device_online_path = os.path.join(zfcpsysfs, self.devnum, "online") +- + # Force str and unicode types in case any of the properties are unicode + def _to_string(self): + return str(self.devnum) +@@ -113,20 +111,6 @@ class ZFCPDeviceBase(ABC): + def __str__(self): + return self._to_string() + +- def _free_device(self): +- """Remove the device from the I/O ignore list to make it visible to the system. +- +- :raises: ValueError if the device cannot be removed from the I/O ignore list +- """ +- +- if not os.path.exists(self._device_online_path): +- log.info("Freeing zFCP device %s", self.devnum) +- util.run_program(["zfcp_cio_free", "-d", self.devnum]) +- +- if not os.path.exists(self._device_online_path): +- raise ValueError(_("zFCP device %s not found, not even in device ignore list.") % +- (self.devnum,)) +- + def _set_zfcp_device_online(self): + """Set the zFCP device online. + +@@ -134,10 +118,8 @@ class ZFCPDeviceBase(ABC): + """ + + try: +- with open(self._device_online_path) as f: +- devonline = f.readline().strip() +- if devonline != "1": +- logged_write_line_to_file(self._device_online_path, "1") ++ util.run_program(["chzdev", "--enable", "zfcp-host", self.devnum, ++ "--yes", "--no-root-update", "--force"]) + except OSError as e: + raise ValueError(_("Could not set zFCP device %(devnum)s " + "online (%(e)s).") +@@ -150,7 +132,8 @@ class ZFCPDeviceBase(ABC): + """ + + try: +- logged_write_line_to_file(self._device_online_path, "0") ++ util.run_program(["chzdev", "--disable", "zfcp-host", self.devnum, ++ "--yes", "--no-root-update", "--force"]) + except OSError as e: + raise ValueError(_("Could not set zFCP device %(devnum)s " + "offline (%(e)s).") +@@ -163,6 +146,7 @@ class ZFCPDeviceBase(ABC): + :returns: True or False + """ + ++ @abstractmethod + def online_device(self): + """Initialize the device and make its storage block device(s) ready to use. + +@@ -170,10 +154,6 @@ class ZFCPDeviceBase(ABC): + :raises: ValueError if the device cannot be initialized + """ + +- self._free_device() +- self._set_zfcp_device_online() +- return True +- + def offline_scsi_device(self): + """Find SCSI devices associated to the zFCP device and remove them from the system.""" + +@@ -238,25 +218,15 @@ class ZFCPDeviceFullPath(ZFCPDeviceBase): + :raises: ValueError if the device cannot be initialized + """ + +- super().online_device() +- + portdir = "%s/%s/%s" % (zfcpsysfs, self.devnum, self.wwpn) +- unitadd = "%s/unit_add" % (portdir) + unitdir = "%s/%s" % (portdir, self.fcplun) +- failed = "%s/failed" % (unitdir) +- +- # Activating using devnum, WWPN, and LUN despite available zFCP auto LUN scan should still +- # be possible as this method was used as a workaround until the support for zFCP auto LUN +- # scan devices has been implemented. Just log a warning message and continue. +- if has_auto_lun_scan(self.devnum): +- log.warning("zFCP device %s in NPIV mode brought online. All LUNs will be activated " +- "automatically although WWPN and LUN have been provided.", self.devnum) + + # create the sysfs directory for the LUN/unit + if not os.path.exists(unitdir): + try: +- logged_write_line_to_file(unitadd, self.fcplun) +- udev.settle() ++ util.run_program(["chzdev", "--enable", "zfcp-lun", ++ "%s:%s:%s" % (self.devnum, self.wwpn, self.fcplun), ++ "--yes", "--no-root-update", "--force"]) + except OSError as e: + raise ValueError(_("Could not add LUN %(fcplun)s to WWPN " + "%(wwpn)s on zFCP device %(devnum)s " +@@ -270,48 +240,23 @@ class ZFCPDeviceFullPath(ZFCPDeviceBase): + 'wwpn': self.wwpn, + 'devnum': self.devnum}) + +- # check the state of the LUN +- fail = "0" +- try: +- f = open(failed, "r") +- fail = f.readline().strip() +- f.close() +- except OSError as e: +- raise ValueError(_("Could not read failed attribute of LUN " +- "%(fcplun)s at WWPN %(wwpn)s on zFCP device " +- "%(devnum)s (%(e)s).") +- % {'fcplun': self.fcplun, +- 'wwpn': self.wwpn, +- 'devnum': self.devnum, +- 'e': e}) +- if fail != "0": +- self.offline_device() +- raise ValueError(_("Failed LUN %(fcplun)s at WWPN %(wwpn)s on " +- "zFCP device %(devnum)s removed again.") +- % {'fcplun': self.fcplun, +- 'wwpn': self.wwpn, +- 'devnum': self.devnum}) ++ # Activating using devnum, WWPN, and LUN despite available zFCP auto LUN scan should still ++ # be possible as this method was used as a workaround until the support for zFCP auto LUN ++ # scan devices has been implemented. Just log a warning message and continue. ++ if has_auto_lun_scan(self.devnum): ++ log.warning("zFCP device %s in NPIV mode brought online. All LUNs will be activated " ++ "automatically although WWPN and LUN have been provided.", self.devnum) + + return True + + def offline_device(self): + """Remove the zFCP device from the system.""" + +- unitremove = "%s/%s/%s/unit_remove" % (zfcpsysfs, self.devnum, self.wwpn) +- devdir = "%s/%s" % (zfcpsysfs, self.devnum) +- +- try: +- self.offline_scsi_device() +- except OSError as e: +- raise ValueError(_("Could not correctly delete SCSI device of " +- "zFCP %(devnum)s %(wwpn)s %(fcplun)s " +- "(%(e)s).") +- % {'devnum': self.devnum, 'wwpn': self.wwpn, +- 'fcplun': self.fcplun, 'e': e}) +- + # remove the LUN + try: +- logged_write_line_to_file(unitremove, self.fcplun) ++ util.run_program(["chzdev", "--disable", "zfcp-lun", ++ "%s:%s:%s" % (self.devnum, self.wwpn, self.fcplun), ++ "--yes", "--no-root-update", "--force"]) + except OSError as e: + raise ValueError(_("Could not remove LUN %(fcplun)s at WWPN " + "%(wwpn)s on zFCP device %(devnum)s " +@@ -340,7 +285,7 @@ class ZFCPDeviceAutoLunScan(ZFCPDeviceBase): + :raises: ValueError if the device cannot be initialized + """ + +- super().online_device() ++ self._set_zfcp_device_online() + + if not has_auto_lun_scan(self.devnum): + raise ValueError(_("zFCP device %s cannot use auto LUN scan.") % self) +@@ -480,13 +425,7 @@ class zFCP: + log.warning("%s", str(e)) + + def write(self, root): +- if len(self.fcpdevs) == 0: +- return +- f = open(root + zfcpconf, "w") +- for d in self.fcpdevs: +- f.write("%s\n" % (d,)) +- f.close() +- ++ pass + + + # Create ZFCP singleton +diff --git a/python-blivet.spec b/python-blivet.spec +index 38a389ae..ac8d2841 100644 +--- a/python-blivet.spec ++++ b/python-blivet.spec +@@ -70,6 +70,7 @@ Recommends: libblockdev-swap >= %{libblockdevver} + + %ifarch s390 s390x + Recommends: libblockdev-s390 >= %{libblockdevver} ++Requires: s390utils-core + %endif + + Requires: python3-bytesize >= %{libbytesizever} +-- +2.45.2 + + +From 6c4e57d78562962f014970c32381891c71f05e3b Mon Sep 17 00:00:00 2001 +From: Steffen Maier +Date: Tue, 31 Jan 2023 12:01:31 +0100 +Subject: [PATCH 5/7] blivet/zfcp: remove no longer used read_config + functionality (#1802482,#1937049) + +Implements the zfcp part of referenced bugs. + +Since +https://github.com/rhinstaller/anaconda/commit/87ab1ab2a3aa8b95cd75b2f37e0881e5f57656a5 +("Support cio_ignore functionality for zFCP devices (#533492)"), +/etc/zfcp.conf replaced /tmp/fcpconfig. + +Since +https://github.com/rhinstaller/anaconda/commit/011ea0a1779459ed20990ddf52166aa75a9c1382 +("Remove linuxrc.s390"), /etc/zfcp.conf only exists if the user specified +dracut cmdline parameter rd.zfcp=. + +https://github.com/ibm-s390-linux/s390-tools/tree/master/zdev/ +handles parsing of rd.zfcp= without /etc/zfcp.conf as of +https://github.com/ibm-s390-linux/s390-tools/commit/06a30ae529a5d6ad2369ed81da056bf3a6147bb6 +("zdev/dracut: add rd.zfcp cmdline option handling"). + +https://src.fedoraproject.org/rpms/s390utils.git +no longer writes /etc/zfcp.conf during deprecated parsing of rd.zfcp= +as of commit +("zfcp: migrate to consolidated persistent device config with zdev") + +Hence, nothing populates /etc/zfcp.conf during installer boot anymore. + +Anaconda imports configuration for all s390 device types as of +commit ("write persistent config of any (dasd,zfcp,znet) s390 devices to +sysroot"). The only remaining import source is from dracut boot parameters. + +Signed-off-by: Steffen Maier +--- + blivet/zfcp.py | 60 ++++++++------------------------------------------ + 1 file changed, 9 insertions(+), 51 deletions(-) + +diff --git a/blivet/zfcp.py b/blivet/zfcp.py +index 38ab5668..a33eb48b 100644 +--- a/blivet/zfcp.py ++++ b/blivet/zfcp.py +@@ -45,7 +45,6 @@ def logged_write_line_to_file(fn, value): + + zfcpsysfs = "/sys/bus/ccw/drivers/zfcp" + scsidevsysfs = "/sys/bus/scsi/devices" +-zfcpconf = "/etc/zfcp.conf" + + + def _is_lun_scan_allowed(): +@@ -323,18 +322,22 @@ class zFCP: + + """ ZFCP utility class. + +- This class will automatically online to ZFCP drives configured in +- /tmp/fcpconfig when the startup() method gets called. It can also be +- used to manually configure ZFCP devices through the add_fcp() method. ++ This class is used to manually configure ZFCP devices through the ++ add_fcp() method, which is used by the anaconda GUI or by kickstart. + +- As this class needs to make sure that /tmp/fcpconfig configured ++ As this class needs to make sure that configured + drives are only onlined once and as it keeps a global list of all ZFCP + devices it is implemented as a Singleton. ++ ++ In particular, this class does not create objects for any other method ++ that enables ZFCP devices such as rd.zfcp= or any device auto ++ configuration. These methods make zfcp-attached SCSI disk block devices ++ available, which ZFCPDiskDevice [devices/disk.py] can directly ++ discover. + """ + + def __init__(self): + self.fcpdevs = set() +- self.has_read_config = False + self.down = True + + # So that users can write zfcp() to get the singleton instance +@@ -345,46 +348,6 @@ class zFCP: + # pylint: disable=unused-argument + return self + +- def read_config(self): +- try: +- f = open(zfcpconf, "r") +- except OSError: +- log.info("no %s; not configuring zfcp", zfcpconf) +- return +- +- lines = [x.strip().lower() for x in f.readlines()] +- f.close() +- +- for line in lines: +- if line.startswith("#") or line == '': +- continue +- +- fields = line.split() +- +- # zFCP auto LUN scan available +- if len(fields) == 1: +- devnum = fields[0] +- wwpn = None +- fcplun = None +- elif len(fields) == 3: +- devnum = fields[0] +- wwpn = fields[1] +- fcplun = fields[2] +- elif len(fields) == 5: +- # support old syntax of: +- # devno scsiid wwpn scsilun fcplun +- devnum = fields[0] +- wwpn = fields[2] +- fcplun = fields[4] +- else: +- log.warning("Invalid line found in %s: %s", zfcpconf, line) +- continue +- +- try: +- self.add_fcp(devnum, wwpn, fcplun) +- except ValueError as e: +- log.warning("%s", str(e)) +- + def add_fcp(self, devnum, wwpn=None, fcplun=None): + if wwpn and fcplun: + d = ZFCPDeviceFullPath(devnum, wwpn, fcplun) +@@ -410,11 +373,6 @@ class zFCP: + if not self.down: + return + self.down = False +- if not self.has_read_config: +- self.read_config() +- self.has_read_config = True +- # read_config calls add_fcp which calls online_device already +- return + + if len(self.fcpdevs) == 0: + return +-- +2.45.2 + + +From e119e1e48a8a8bc83ec42d3c6ab31fac7c4a98eb Mon Sep 17 00:00:00 2001 +From: Steffen Maier +Date: Tue, 28 Feb 2023 17:48:04 +0100 +Subject: [PATCH 6/7] respect explicit user choice for full path in zfcp + dracut_setup_args + +Complements RHBZ#1937030. + +Signed-off-by: Steffen Maier +--- + blivet/devices/disk.py | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/blivet/devices/disk.py b/blivet/devices/disk.py +index 4ae4a845..edbf41c4 100644 +--- a/blivet/devices/disk.py ++++ b/blivet/devices/disk.py +@@ -498,7 +498,12 @@ class ZFCPDiskDevice(DiskDevice): + from ..zfcp import has_auto_lun_scan + + # zFCP auto LUN scan needs only the device ID +- if has_auto_lun_scan(self.hba_id): ++ # If the user explicitly over-specified with a full path configuration ++ # respect this choice and emit a full path specification nonetheless. ++ errorlevel = util.run_program(["lszdev", "zfcp-lun", "--configured", ++ "%s:%s:%s" % (self.hba_id, self.wwpn, ++ self.fcp_lun)]) ++ if has_auto_lun_scan(self.hba_id) and errorlevel != 0: + dracut_args = set(["rd.zfcp=%s" % self.hba_id]) + else: + dracut_args = set(["rd.zfcp=%s,%s,%s" % (self.hba_id, self.wwpn, self.fcp_lun,)]) +-- +2.45.2 + + +From 4c2d39c4fcea9361b60d99327a9eb8b9d89078fb Mon Sep 17 00:00:00 2001 +From: Steffen Maier +Date: Tue, 16 Jul 2024 10:22:55 +0200 +Subject: [PATCH 7/7] DASDDevice: dracut_setup_args() without deprecated + dasd.conf (#1802482,#1937049) + +Implements the dasd part of referenced bugs. + +Depends on +ibm-s390-linux/s390-tools@689b894 +("zdev: add helper to convert from zdev config to dasd_mod.dasd"). +The spec file update reflects the new dependency on `zdev-to-dasd_mod.dasd` +in the new v2.31.0 of the s390 architecture specific sub-package +s390utils-core. + +Delegate the generation of rd.dasd statements to a helper tool from +s390-tools, which gets its low-level config information from the +consolidated persistent configuration mechanism using chzdev. + +Signed-off-by: Steffen Maier +--- + blivet/devices/disk.py | 56 +++----------------------------- + blivet/populator/helpers/disk.py | 3 -- + python-blivet.spec | 3 +- + 3 files changed, 6 insertions(+), 56 deletions(-) + +diff --git a/blivet/devices/disk.py b/blivet/devices/disk.py +index edbf41c4..a849e7ac 100644 +--- a/blivet/devices/disk.py ++++ b/blivet/devices/disk.py +@@ -530,67 +530,19 @@ class DASDDevice(DiskDevice): + :type format: :class:`~.formats.DeviceFormat` or a subclass of it + :keyword str wwn: the disk's WWN + :keyword busid: bus ID +- :keyword opts: options +- :type opts: dict with option name keys and option value values + """ + self.busid = kwargs.pop('busid') +- self.opts = kwargs.pop('opts') + DiskDevice.__init__(self, device, **kwargs) + + @property + def description(self): + return "DASD device %s" % self.busid + +- def get_opts(self): +- return ["%s=%s" % (k, v) for k, v in self.opts.items() if v == '1'] +- + def dracut_setup_args(self): +- conf = "/etc/dasd.conf" +- line = None +- if os.path.isfile(conf): +- f = open(conf) +- # grab the first line that starts with our bus_id +- for l in f.readlines(): +- if l.startswith(self.busid): +- line = l.rstrip() +- break +- +- f.close() +- +- # See if we got a line. If not, grab our get_opts +- if not line: +- line = self.busid +- for devopt in self.get_opts(): +- line += " %s" % devopt +- +- # Create a translation mapping from dasd.conf format to module format +- translate = {'use_diag': 'diag', +- 'readonly': 'ro', +- 'erplog': 'erplog', +- 'failfast': 'failfast'} +- +- # this is a really awkward way of determining if the +- # feature found is actually desired (1, not 0), plus +- # translating that feature into the actual kernel module +- # value +- opts = [] +- parts = line.split() +- for chunk in parts[1:]: +- try: +- feat, val = chunk.split('=') +- if int(val): +- opts.append(translate[feat]) +- except (ValueError, KeyError): +- # If we don't know what the feature is (feat not in translate +- # or if we get a val that doesn't cleanly convert to an int +- # we can't do anything with it. +- log.warning("failed to parse dasd feature %s", chunk) +- +- if opts: +- return set(["rd.dasd=%s(%s)" % (self.busid, +- ":".join(opts))]) +- else: +- return set(["rd.dasd=%s" % self.busid]) ++ devspec = util.capture_output(["/lib/s390-tools/zdev-to-dasd_mod.dasd", ++ "persistent", self.busid]).strip() ++ # strip to remove trailing newline, which must not appear in zipl BLS ++ return set(["rd.dasd=%s" % devspec]) + + + NVMeController = namedtuple("NVMeController", ["name", "serial", "nvme_ver", "id", "subsysnqn", +diff --git a/blivet/populator/helpers/disk.py b/blivet/populator/helpers/disk.py +index 3ac3f408..fc47f62a 100644 +--- a/blivet/populator/helpers/disk.py ++++ b/blivet/populator/helpers/disk.py +@@ -204,9 +204,6 @@ class DASDDevicePopulator(DiskDevicePopulator): + def _get_kwargs(self): + kwargs = super(DASDDevicePopulator, self)._get_kwargs() + kwargs["busid"] = udev.device_get_dasd_bus_id(self.data) +- kwargs["opts"] = {} +- for attr in ['readonly', 'use_diag', 'erplog', 'failfast']: +- kwargs["opts"][attr] = udev.device_get_dasd_flag(self.data, attr) + + log.info("%s is a dasd device", udev.device_get_name(self.data)) + return kwargs +diff --git a/python-blivet.spec b/python-blivet.spec +index ac8d2841..81177020 100644 +--- a/python-blivet.spec ++++ b/python-blivet.spec +@@ -21,6 +21,7 @@ Source1: http://github.com/storaged-project/blivet/archive/%{realname}-%{realver + %global libblockdevver 3.0 + %global libbytesizever 0.3 + %global pyudevver 0.18 ++%global s390utilscorever 2.31.0 + + BuildArch: noarch + +@@ -70,7 +71,7 @@ Recommends: libblockdev-swap >= %{libblockdevver} + + %ifarch s390 s390x + Recommends: libblockdev-s390 >= %{libblockdevver} +-Requires: s390utils-core ++Requires: s390utils-core >= %{s390utilscorever} + %endif + + Requires: python3-bytesize >= %{libbytesizever} +-- +2.45.2 + diff --git a/0007-Fix-checking-for-NVMe-plugin-availability.patch b/0007-Fix-checking-for-NVMe-plugin-availability.patch new file mode 100644 index 0000000000000000000000000000000000000000..55fb74015bc04eb04f8f878325d8b93f880c2119 --- /dev/null +++ b/0007-Fix-checking-for-NVMe-plugin-availability.patch @@ -0,0 +1,27 @@ +From 7677fc312b821a9c67750220f2494d06f2357780 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Wed, 18 Sep 2024 15:30:05 +0200 +Subject: [PATCH] Fix checking for NVMe plugin availability + +--- + blivet/nvme.py | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/blivet/nvme.py b/blivet/nvme.py +index 4309dea3..72a47070 100644 +--- a/blivet/nvme.py ++++ b/blivet/nvme.py +@@ -76,6 +76,10 @@ class NVMe(object): + return False + if not hasattr(blockdev.NVMETech, "FABRICS"): + return False ++ try: ++ blockdev.nvme.is_tech_avail(blockdev.NVMETech.FABRICS, 0) # pylint: disable=no-member ++ except (blockdev.BlockDevNotImplementedError, blockdev.NVMEError): ++ return False + return True + + def startup(self): +-- +2.46.1 + diff --git a/0008-Align-sizes-up-for-growable-LVs.patch b/0008-Align-sizes-up-for-growable-LVs.patch new file mode 100644 index 0000000000000000000000000000000000000000..dba8652643bffe53ef77e710139e2e0fa1c4123d --- /dev/null +++ b/0008-Align-sizes-up-for-growable-LVs.patch @@ -0,0 +1,30 @@ +From ad7966a456224f22729c55616f2c8c73321654c7 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Thu, 24 Oct 2024 12:18:58 +0200 +Subject: [PATCH] Align sizes up for growable LVs + +Growable LVs usually start at minimum size so adjusting it down +can change the size below allowed minimum. + +Resolves: RHEL-45180 +Resolves: RHEL-45181 +--- + blivet/devices/lvm.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/blivet/devices/lvm.py b/blivet/devices/lvm.py +index 661881ea..661dc6e0 100644 +--- a/blivet/devices/lvm.py ++++ b/blivet/devices/lvm.py +@@ -2673,7 +2673,7 @@ class LVMLogicalVolumeDevice(LVMLogicalVolumeBase, LVMInternalLogicalVolumeMixin + if not isinstance(newsize, Size): + raise AttributeError("new size must be of type Size") + +- newsize = self.vg.align(newsize) ++ newsize = self.vg.align(newsize, roundup=self.growable) + log.debug("trying to set lv %s size to %s", self.name, newsize) + # Don't refuse to set size if we think there's not enough space in the + # VG for an existing LV, since it's existence proves there is enough +-- +2.47.0 + diff --git a/0009-mod_pass_in_stratis_test.patch b/0009-mod_pass_in_stratis_test.patch new file mode 100644 index 0000000000000000000000000000000000000000..67bb1c0c003e53ad66550eed11bb65c6b540de57 --- /dev/null +++ b/0009-mod_pass_in_stratis_test.patch @@ -0,0 +1,32 @@ +From c2177aa362d20278a0ebd5c25a776f952d83e5b1 Mon Sep 17 00:00:00 2001 +From: Jan Pokorny +Date: Fri, 11 Oct 2024 17:17:41 +0200 +Subject: [PATCH] Modified passphrase in stratis test + +FIPS requires at least 8 chars long passphrase. Dummy passphrase used +in stratis test was too short causing encryption +tests with FIPS enabled to fail. + +Changed passphrase. + +fixes RHEL-45173, RHEL-8029 +--- + tests/storage_tests/devices_test/stratis_test.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/storage_tests/devices_test/stratis_test.py b/tests/storage_tests/devices_test/stratis_test.py +index 5aaa12d4..21c4d0f5 100644 +--- a/tests/storage_tests/devices_test/stratis_test.py ++++ b/tests/storage_tests/devices_test/stratis_test.py +@@ -230,7 +230,7 @@ class StratisTestCaseClevis(StratisTestCaseBase): + blivet.partitioning.do_partitioning(self.storage) + + pool = self.storage.new_stratis_pool(name="blivetTestPool", parents=[bd], +- encrypted=True, passphrase="abcde", ++ encrypted=True, passphrase="fipsneeds8chars", + clevis=StratisClevisConfig(pin="tang", + tang_url=self._tang_server, + tang_thumbprint=None)) +-- +2.45.0 + diff --git a/0010-Fix_running_tests_in_FIPS_mode.patch b/0010-Fix_running_tests_in_FIPS_mode.patch new file mode 100644 index 0000000000000000000000000000000000000000..b6bee25544db30d4e6daaba28146466f63db8ce9 --- /dev/null +++ b/0010-Fix_running_tests_in_FIPS_mode.patch @@ -0,0 +1,58 @@ +From cd9e137a2e33165a8af3a7e4a3d2615adcabf659 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Fri, 8 Nov 2024 09:19:45 +0100 +Subject: [PATCH 1/2] Fix "Modified passphrase in stratis test" + +Follow up for 68708e347ef7b2f98312c76aa80366091dd4aade, two more +places where the passphrase is too short for FIPS mode. + +Resolves: RHEL-45173 +--- + tests/storage_tests/devices_test/stratis_test.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/storage_tests/devices_test/stratis_test.py b/tests/storage_tests/devices_test/stratis_test.py +index 21c4d0f50..9792e0618 100644 +--- a/tests/storage_tests/devices_test/stratis_test.py ++++ b/tests/storage_tests/devices_test/stratis_test.py +@@ -105,7 +105,7 @@ def test_stratis_encrypted(self): + blivet.partitioning.do_partitioning(self.storage) + + pool = self.storage.new_stratis_pool(name="blivetTestPool", parents=[bd], +- encrypted=True, passphrase="abcde") ++ encrypted=True, passphrase="fipsneeds8chars") + self.storage.create_device(pool) + + self.storage.do_it() +@@ -260,7 +260,7 @@ def test_stratis_encrypted_clevis_tpm(self): + blivet.partitioning.do_partitioning(self.storage) + + pool = self.storage.new_stratis_pool(name="blivetTestPool", parents=[bd], +- encrypted=True, passphrase="abcde", ++ encrypted=True, passphrase="fipsneeds8chars", + clevis=StratisClevisConfig(pin="tpm2")) + self.storage.create_device(pool) + + +From ed10d97a5257c0f4fe8a2f53b0b2f787de91c355 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Fri, 8 Nov 2024 10:02:47 +0100 +Subject: [PATCH 2/2] tests: Fix writing key file for LUKS tests + +Related: RHEL-45173 +--- + tests/storage_tests/formats_test/luks_test.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tests/storage_tests/formats_test/luks_test.py b/tests/storage_tests/formats_test/luks_test.py +index 93c8d7524..b8ec229ba 100644 +--- a/tests/storage_tests/formats_test/luks_test.py ++++ b/tests/storage_tests/formats_test/luks_test.py +@@ -99,6 +99,7 @@ def test_setup_keyfile(self): + + with tempfile.NamedTemporaryFile(prefix="blivet_test") as temp: + temp.write(b"password2") ++ temp.flush() + + # create the luks format with both passphrase and keyfile + self.fmt._key_file = temp.name diff --git a/0011-Make-GPT-default-label-type-on-all-architectures.patch b/0011-Make-GPT-default-label-type-on-all-architectures.patch new file mode 100644 index 0000000000000000000000000000000000000000..7fba7a39c3ad408ae47f1f4deefe0137b6435a64 --- /dev/null +++ b/0011-Make-GPT-default-label-type-on-all-architectures.patch @@ -0,0 +1,122 @@ +From c8eff25e4c25183a76e97108d4607455cfc96ae2 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Thu, 14 Nov 2024 14:53:28 +0100 +Subject: [PATCH] Make GPT default label type on all architectures + +Exceptions are DASD drives on s390 and 32bit ARM. Everywhere else +GPT will be default. + +Resolves: RHEL-52200 +--- + blivet/formats/disklabel.py | 11 +++++----- + .../formats_tests/disklabel_test.py | 20 +++++++++---------- + 2 files changed, 16 insertions(+), 15 deletions(-) + +diff --git a/blivet/formats/disklabel.py b/blivet/formats/disklabel.py +index f2857f07..8b39dc79 100644 +--- a/blivet/formats/disklabel.py ++++ b/blivet/formats/disklabel.py +@@ -220,12 +220,13 @@ class DiskLabel(DeviceFormat): + + @classmethod + def get_platform_label_types(cls): +- label_types = ["msdos", "gpt"] ++ # always prefer gpt except for configurations below ++ label_types = ["gpt", "msdos"] + if arch.is_pmac(): + label_types = ["mac"] +- # always prefer gpt on aarch64, x86_64, and EFI plats except 32-bit ARM +- elif arch.is_aarch64() or arch.is_x86(bits=64) or (arch.is_efi() and not arch.is_arm()): +- label_types = ["gpt", "msdos"] ++ # prefet msdos on 32-bit ARM ++ elif arch.is_arm(): ++ label_types = ["msdos", "gpt"] + elif arch.is_s390(): + label_types += ["dasd"] + +@@ -254,7 +255,7 @@ class DiskLabel(DeviceFormat): + if arch.is_s390(): + if blockdev.s390.dasd_is_fba(self.device): + # the device is FBA DASD +- return "msdos" ++ return "gpt" + elif self.parted_device.type == parted.DEVICE_DASD: + # the device is DASD + return "dasd" +diff --git a/tests/unit_tests/formats_tests/disklabel_test.py b/tests/unit_tests/formats_tests/disklabel_test.py +index 9f6e4542..823a3663 100644 +--- a/tests/unit_tests/formats_tests/disklabel_test.py ++++ b/tests/unit_tests/formats_tests/disklabel_test.py +@@ -71,7 +71,7 @@ class DiskLabelTestCase(unittest.TestCase): + arch.is_pmac.return_value = False + arch.is_x86.return_value = False + +- self.assertEqual(disklabel_class.get_platform_label_types(), ["msdos", "gpt"]) ++ self.assertEqual(disklabel_class.get_platform_label_types(), ["gpt", "msdos"]) + + arch.is_pmac.return_value = True + self.assertEqual(disklabel_class.get_platform_label_types(), ["mac"]) +@@ -100,7 +100,7 @@ class DiskLabelTestCase(unittest.TestCase): + arch.is_efi.return_value = False + + arch.is_s390.return_value = True +- self.assertEqual(disklabel_class.get_platform_label_types(), ["msdos", "gpt", "dasd"]) ++ self.assertEqual(disklabel_class.get_platform_label_types(), ["gpt", "msdos", "dasd"]) + arch.is_s390.return_value = False + + def test_label_type_size_check(self): +@@ -121,14 +121,14 @@ class DiskLabelTestCase(unittest.TestCase): + + with patch.object(blivet.formats.disklabel.DiskLabel, "parted_device", new=PropertyMock(return_value=None)): + # no parted device -> no passing size check +- self.assertEqual(dl._label_type_size_check("msdos"), False) ++ self.assertEqual(dl._label_type_size_check("gpt"), False) + + @patch("blivet.formats.disklabel.arch") + def test_best_label_type(self, arch): + """ + 1. is always in _disklabel_types + 2. is the default unless the device is too long for the default +- 3. is msdos for fba dasd on S390 ++ 3. is gpt for fba dasd on S390 + 4. is dasd for non-fba dasd on S390 + """ + dl = blivet.formats.disklabel.DiskLabel() +@@ -144,17 +144,17 @@ class DiskLabelTestCase(unittest.TestCase): + arch.is_x86.return_value = False + + with patch.object(dl, '_label_type_size_check') as size_check: +- # size check passes for first type ("msdos") ++ # size check passes for first type ("gpt") + size_check.return_value = True +- self.assertEqual(dl._get_best_label_type(), "msdos") ++ self.assertEqual(dl._get_best_label_type(), "gpt") + + # size checks all fail -> label type is None + size_check.return_value = False + self.assertEqual(dl._get_best_label_type(), None) + +- # size check passes on second call -> label type is "gpt" (second in platform list) ++ # size check passes on second call -> label type is "msdos" (second in platform list) + size_check.side_effect = [False, True] +- self.assertEqual(dl._get_best_label_type(), "gpt") ++ self.assertEqual(dl._get_best_label_type(), "msdos") + + arch.is_pmac.return_value = True + with patch.object(dl, '_label_type_size_check') as size_check: +@@ -175,10 +175,10 @@ class DiskLabelTestCase(unittest.TestCase): + size_check.return_value = True + with patch("blivet.formats.disklabel.blockdev.s390") as _s390: + _s390.dasd_is_fba.return_value = False +- self.assertEqual(dl._get_best_label_type(), "msdos") ++ self.assertEqual(dl._get_best_label_type(), "gpt") + + _s390.dasd_is_fba.return_value = True +- self.assertEqual(dl._get_best_label_type(), "msdos") ++ self.assertEqual(dl._get_best_label_type(), "gpt") + + _s390.dasd_is_fba.return_value = False + dl._parted_device.type = parted.DEVICE_DASD +-- +2.47.0 + diff --git a/0012-Fix-crash-on-ppc64le-with-GPT.patch b/0012-Fix-crash-on-ppc64le-with-GPT.patch new file mode 100644 index 0000000000000000000000000000000000000000..b323ea90126b183ccc4b67401baa469222f359f6 --- /dev/null +++ b/0012-Fix-crash-on-ppc64le-with-GPT.patch @@ -0,0 +1,108 @@ +From 041b320003687fb6c740f429a079dd7b7c8f7f6f Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Thu, 5 Dec 2024 14:28:21 +0100 +Subject: [PATCH 1/2] Fix ppc64le name in devicelibs/gpt.py + +Resolves: RHEL-70153 +--- + blivet/devicelibs/gpt.py | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/blivet/devicelibs/gpt.py b/blivet/devicelibs/gpt.py +index 4a6d364d7..c6dbf7b23 100644 +--- a/blivet/devicelibs/gpt.py ++++ b/blivet/devicelibs/gpt.py +@@ -66,7 +66,7 @@ + "parisc": uuid.UUID("1aacdb3b-5444-4138-bd9e-e5c2239b2346"), + "ppc": uuid.UUID("1de3f1ef-fa98-47b5-8dcd-4a860a654d78"), + "ppc64": uuid.UUID("912ade1d-a839-4913-8964-a10eee08fbd2"), +- "ppc64el": uuid.UUID("c31c45e6-3f39-412e-80fb-4809c4980599"), ++ "ppc64le": uuid.UUID("c31c45e6-3f39-412e-80fb-4809c4980599"), + "riscv32": uuid.UUID("60d5a7fe-8e7d-435c-b714-3dd8162144e1"), + "riscv64": uuid.UUID("72ec70a6-cf74-40e6-bd49-4bda08e8f224"), + "s390": uuid.UUID("08a7acea-624c-4a20-91e8-6e0fa67d23f9"), +@@ -87,7 +87,7 @@ + "parisc": uuid.UUID("d212a430-fbc5-49f9-a983-a7feef2b8d0e"), + "ppc": uuid.UUID("98cfe649-1588-46dc-b2f0-add147424925"), + "ppc64": uuid.UUID("9225a9a3-3c19-4d89-b4f6-eeff88f17631"), +- "ppc64el": uuid.UUID("906bd944-4589-4aae-a4e4-dd983917446a"), ++ "ppc64le": uuid.UUID("906bd944-4589-4aae-a4e4-dd983917446a"), + "riscv32": uuid.UUID("ae0253be-1167-4007-ac68-43926c14c5de"), + "riscv64": uuid.UUID("b6ed5582-440b-4209-b8da-5ff7c419ea3d"), + "s390": uuid.UUID("7ac63b47-b25c-463b-8df8-b4a94e6c90e1"), +@@ -108,7 +108,7 @@ + "parisc": uuid.UUID("15de6170-65d3-431c-916e-b0dcd8393f25"), + "ppc": uuid.UUID("1b31b5aa-add9-463a-b2ed-bd467fc857e7"), + "ppc64": uuid.UUID("f5e2c20c-45b2-4ffa-bce9-2a60737e1aaf"), +- "ppc64el": uuid.UUID("d4a236e7-e873-4c07-bf1d-bf6cf7f1c3c6"), ++ "ppc64le": uuid.UUID("d4a236e7-e873-4c07-bf1d-bf6cf7f1c3c6"), + "riscv32": uuid.UUID("3a112a75-8729-4380-b4cf-764d79934448"), + "riscv64": uuid.UUID("efe0f087-ea8d-4469-821a-4c2a96a8386a"), + "s390": uuid.UUID("3482388e-4254-435a-a241-766a065f9960"), +@@ -129,7 +129,7 @@ + "parisc": uuid.UUID("dc4a4480-6917-4262-a4ec-db9384949f25"), + "ppc": uuid.UUID("7d14fec5-cc71-415d-9d6c-06bf0b3c3eaf"), + "ppc64": uuid.UUID("2c9739e2-f068-46b3-9fd0-01c5a9afbcca"), +- "ppc64el": uuid.UUID("15bb03af-77e7-4d4a-b12b-c0d084f7491c"), ++ "ppc64le": uuid.UUID("15bb03af-77e7-4d4a-b12b-c0d084f7491c"), + "riscv32": uuid.UUID("b933fb22-5c3f-4f91-af90-e2bb0fa50702"), + "riscv64": uuid.UUID("beaec34b-8442-439b-a40b-984381ed097d"), + "s390": uuid.UUID("cd0f869b-d0fb-4ca0-b141-9ea87cc78d66"), +@@ -150,7 +150,7 @@ + "parisc": uuid.UUID("5843d618-ec37-48d7-9f12-cea8e08768b2"), + "ppc": uuid.UUID("df765d00-270e-49e5-bc75-f47bb2118b09"), + "ppc64": uuid.UUID("bdb528a5-a259-475f-a87d-da53fa736a07"), +- "ppc64el": uuid.UUID("ee2b9983-21e8-4153-86d9-b6901a54d1ce"), ++ "ppc64le": uuid.UUID("ee2b9983-21e8-4153-86d9-b6901a54d1ce"), + "riscv32": uuid.UUID("cb1ee4e3-8cd0-4136-a0a4-aa61a32e8730"), + "riscv64": uuid.UUID("8f1056be-9b05-47c4-81d6-be53128e5b54"), + "s390": uuid.UUID("b663c618-e7bc-4d6d-90aa-11b756bb1797"), +@@ -171,7 +171,7 @@ + "parisc": uuid.UUID("450dd7d1-3224-45ec-9cf2-a43a346d71ee"), + "ppc": uuid.UUID("7007891d-d371-4a80-86a4-5cb875b9302e"), + "ppc64": uuid.UUID("0b888863-d7f8-4d9e-9766-239fce4d58af"), +- "ppc64el": uuid.UUID("c8bfbd1e-268e-4521-8bba-bf314c399557"), ++ "ppc64le": uuid.UUID("c8bfbd1e-268e-4521-8bba-bf314c399557"), + "riscv32": uuid.UUID("c3836a13-3137-45ba-b583-b16c50fe5eb4"), + "riscv64": uuid.UUID("d2f9000a-7a18-453f-b5cd-4d32f77a7b32"), + "s390": uuid.UUID("17440e4f-a8d0-467f-a46e-3912ae6ef2c5"), + +From 22740da280258990d557eb45ac90d86c4f821c05 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Thu, 5 Dec 2024 14:31:15 +0100 +Subject: [PATCH 2/2] Do not crash when we fail to get discoverable GPT type + UUID + +No need to raise an exception if we fail to get the type UUID for +whatever reason. + +Related: RHEL-70153 +--- + blivet/devices/partition.py | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/blivet/devices/partition.py b/blivet/devices/partition.py +index 2d67be81f..89470d9fb 100644 +--- a/blivet/devices/partition.py ++++ b/blivet/devices/partition.py +@@ -365,10 +365,16 @@ def part_type_uuid_req(self): + hasattr(parted.Partition, "type_uuid")) + + if discoverable: +- parttype = gpt_part_uuid_for_mountpoint(self._mountpoint) +- log.debug("Discovered partition type UUID %s for mount '%s'", +- parttype, self._mountpoint) +- return parttype ++ try: ++ parttype = gpt_part_uuid_for_mountpoint(self._mountpoint) ++ except errors.GPTVolUUIDError as e: ++ log.error("Failed to get partition type UUID for mount '%s': %s", ++ self._mountpoint, str(e)) ++ return None ++ else: ++ log.debug("Discovered partition type UUID %s for mount '%s'", ++ parttype, self._mountpoint) ++ return parttype + return None + + @property diff --git a/1001-remove-mpath-plugin.patch b/1001-remove-mpath-plugin.patch deleted file mode 100644 index daa4a6a27a19fcccf3defdb768c1f50bdebee29d..0000000000000000000000000000000000000000 --- a/1001-remove-mpath-plugin.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- blivet-3.4.3/blivet/__init__.py 2022-04-06 15:42:19.789225445 +0800 -+++ blivet-3.4.3-an23/blivet/__init__.py 2022-04-06 15:41:05.131080309 +0800 -@@ -65,7 +65,8 @@ - if arch.is_s390(): - _REQUESTED_PLUGIN_NAMES = set(("lvm", "btrfs", "swap", "crypto", "loop", "mdraid", "mpath", "dm", "s390", "nvdimm")) - else: -- _REQUESTED_PLUGIN_NAMES = set(("lvm", "btrfs", "swap", "crypto", "loop", "mdraid", "mpath", "dm", "nvdimm")) -+ # _REQUESTED_PLUGIN_NAMES = set(("lvm", "btrfs", "swap", "crypto", "loop", "mdraid", "mpath", "dm", "nvdimm")) -+ _REQUESTED_PLUGIN_NAMES = set(("lvm", "swap", "crypto", "loop", "mdraid", "dm", "nvdimm")) - - _requested_plugins = blockdev.plugin_specs_from_names(_REQUESTED_PLUGIN_NAMES) - try: - diff --git a/blivet-3.10.0-tests.tar.gz b/blivet-3.10.0-tests.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..bd473a2adbeb47098f2159786fb181d53d33344c Binary files /dev/null and b/blivet-3.10.0-tests.tar.gz differ diff --git a/blivet-3.10.0.tar.gz b/blivet-3.10.0.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..bdaeede357d6e705e5db9d37fb052934c2f458cd Binary files /dev/null and b/blivet-3.10.0.tar.gz differ diff --git a/blivet-3.6.1-tests.tar.gz b/blivet-3.6.1-tests.tar.gz deleted file mode 100644 index b5ce82f993cb6518886e49219201963c3ad6a2eb..0000000000000000000000000000000000000000 Binary files a/blivet-3.6.1-tests.tar.gz and /dev/null differ diff --git a/blivet-3.6.1.tar.gz b/blivet-3.6.1.tar.gz deleted file mode 100644 index 92d685ac53befb6ae7746a4b98fede2b49913dee..0000000000000000000000000000000000000000 Binary files a/blivet-3.6.1.tar.gz and /dev/null differ diff --git a/python-blivet.spec b/python-blivet.spec index 3b5147f0b8e12f1fd2e3180819ca480e027cdf3a..9c53c3340becf57d127fa05b4edb7038f52e3f1e 100644 --- a/python-blivet.spec +++ b/python-blivet.spec @@ -1,28 +1,36 @@ -%define anolis_release 3 +%define anolis_release 1 Summary: A python module for system storage configuration Name: python-blivet Url: https://storageapis.wordpress.com/projects/blivet -Version: 3.6.1 +Version: 3.10.0 Release: %{anolis_release}%{?dist} Epoch: 1 -License: LGPLv2+ +License: LGPL-2.1-or-later %global realname blivet %global realversion %{version} Source0: https://github.com/storaged-project/%{realname}/releases/download/%{realname}-%{realversion}/%{realname}-%{realversion}.tar.gz Source1: https://github.com/storaged-project/%{realname}/releases/download/%{realname}-%{realversion}/%{realname}-%{realversion}-tests.tar.gz -# Add by Anolis-23 -Patch1001: 1001-remove-mpath-plugin.patch -Patch1002: 0001-add-loongarch64-support-for-blivet.patch -# End +Patch0: 0001-remove-btrfs-plugin.patch + +Patch1: 0002-Fix-skipping-btrfs-calls-when-libblockdev-btrfs-plugin-is-missing.patch +Patch2: 0003-XFS-resize-test-fix.patch +Patch3: 0004-Run-mkfs-xfs-with-force-option-by-default.patch +Patch4: 0005-consolidated-s390-device-configuration.patch +Patch5: 0007-Fix-checking-for-NVMe-plugin-availability.patch +Patch6: 0008-Align-sizes-up-for-growable-LVs.patch +Patch7: 0009-mod_pass_in_stratis_test.patch +Patch8: 0010-Fix_running_tests_in_FIPS_mode.patch +Patch9: 0011-Make-GPT-default-label-type-on-all-architectures.patch +Patch10: 0012-Fix-crash-on-ppc64le-with-GPT.patch # Versions of required components (done so we make sure the buildrequires # match the requires versions of things). %global partedver 3.2 %global pypartedver 3.10.4 %global utillinuxver 2.15.1 -%global libblockdevver 2.24 +%global libblockdevver 3.0 %global libbytesizever 0.3 %global pyudevver 0.18 @@ -69,18 +77,17 @@ Requires: python3-pyudev >= %{pyudevver} Requires: parted >= %{partedver} Requires: python3-pyparted >= %{pypartedver} Requires: libselinux-python3 +Requires: python3-libmount Requires: python3-blockdev >= %{libblockdevver} Recommends: libblockdev-btrfs >= %{libblockdevver} Recommends: libblockdev-crypto >= %{libblockdevver} Recommends: libblockdev-dm >= %{libblockdevver} Recommends: libblockdev-fs >= %{libblockdevver} -Recommends: libblockdev-kbd >= %{libblockdevver} Recommends: libblockdev-loop >= %{libblockdevver} Recommends: libblockdev-lvm >= %{libblockdevver} Recommends: libblockdev-mdraid >= %{libblockdevver} Recommends: libblockdev-mpath >= %{libblockdevver} -Recommends: libblockdev-nvdimm >= %{libblockdevver} -Recommends: libblockdev-part >= %{libblockdevver} +Recommends: libblockdev-nvme >= %{libblockdevver} Recommends: libblockdev-swap >= %{libblockdevver} Recommends: libblockdev-s390 >= %{libblockdevver} Requires: python3-bytesize >= %{libbytesizever} @@ -125,6 +132,9 @@ make PYTHON=%{__python3} DESTDIR=%{buildroot} install %doc README.md ChangeLog examples %changelog +* Wed Mar 26 2025 Xiaoping Liu - 3.10.0-1 +- update to 3.10.0 from 3.6.1 + * Wed Mar 13 2024 Zhao Hang - 3.6.1-3 - Rebuild with python3.11