diff --git a/0014-Do-not-remove-PVs-from-devices-file-if-disabled-or-doesnt-exist.patch b/0014-Do-not-remove-PVs-from-devices-file-if-disabled-or-doesnt-exist.patch new file mode 100644 index 0000000..44d60a3 --- /dev/null +++ b/0014-Do-not-remove-PVs-from-devices-file-if-disabled-or-doesnt-exist.patch @@ -0,0 +1,103 @@ +From 30782ea4482e8118996ffa69f967531515761179 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Mon, 20 Jan 2025 13:02:50 +0100 +Subject: [PATCH] Do not remove PVs from devices file if disabled or doesn't + exists + +When the file doesn't exists the 'lvmdevices --deldev' call will +fail but it will still create the devices file. This means we now +have an empty devices file and all subsequent LVM calls will fail. + +Resolves: RHEL-65846 +--- + blivet/formats/lvmpv.py | 10 +++++++ + tests/unit_tests/formats_tests/lvmpv_test.py | 28 ++++++++++++++++++++ + 2 files changed, 38 insertions(+) + +diff --git a/blivet/formats/lvmpv.py b/blivet/formats/lvmpv.py +index 982233878..aa5cc0a5a 100644 +--- a/blivet/formats/lvmpv.py ++++ b/blivet/formats/lvmpv.py +@@ -171,6 +171,16 @@ def lvmdevices_remove(self): + if not lvm.HAVE_LVMDEVICES: + raise PhysicalVolumeError("LVM devices file feature is not supported") + ++ if not os.path.exists(lvm.LVM_DEVICES_FILE): ++ log.debug("Not removing %s from devices file: %s doesn't exist", ++ self.device, lvm.LVM_DEVICES_FILE) ++ return ++ ++ if not flags.lvm_devices_file: ++ log.debug("Not removing %s from devices file: 'lvm_devices_file' flag is set to False", ++ self.device) ++ return ++ + try: + blockdev.lvm.devices_delete(self.device) + except blockdev.LVMError as e: +diff --git a/tests/unit_tests/formats_tests/lvmpv_test.py b/tests/unit_tests/formats_tests/lvmpv_test.py +index 8d410f4fd..890e3cb19 100644 +--- a/tests/unit_tests/formats_tests/lvmpv_test.py ++++ b/tests/unit_tests/formats_tests/lvmpv_test.py +@@ -38,6 +38,11 @@ def test_lvm_devices(self): + + mock["blockdev"].lvm.devices_add.assert_not_called() + ++ # LVM devices file not enabled/supported -> devices_delete should not be called ++ fmt._destroy() ++ ++ mock["blockdev"].lvm.devices_delete.assert_not_called() ++ + with self.patches() as mock: + # LVM devices file enabled and devices file exists -> devices_add should be called + mock["lvm"].HAVE_LVMDEVICES = True +@@ -47,6 +52,11 @@ def test_lvm_devices(self): + + mock["blockdev"].lvm.devices_add.assert_called_with("/dev/test") + ++ # LVM devices file enabled and devices file exists -> devices_delete should be called ++ fmt._destroy() ++ ++ mock["blockdev"].lvm.devices_delete.assert_called_with("/dev/test") ++ + with self.patches() as mock: + # LVM devices file enabled and devices file doesn't exist + # and no existing VGs present -> devices_add should be called +@@ -58,6 +68,12 @@ def test_lvm_devices(self): + + mock["blockdev"].lvm.devices_add.assert_called_with("/dev/test") + ++ # LVM devices file enabled but devices file doesn't exist ++ # -> devices_delete should not be called ++ fmt._destroy() ++ ++ mock["blockdev"].lvm.devices_delete.assert_not_called() ++ + with self.patches() as mock: + # LVM devices file enabled and devices file doesn't exist + # and existing VGs present -> devices_add should not be called +@@ -69,6 +85,12 @@ def test_lvm_devices(self): + + mock["blockdev"].lvm.devices_add.assert_not_called() + ++ # LVM devices file enabled but devices file doesn't exist ++ # -> devices_delete should not be called ++ fmt._destroy() ++ ++ mock["blockdev"].lvm.devices_delete.assert_not_called() ++ + with self.patches() as mock: + # LVM devices file enabled and devices file exists + # but flag set to false -> devices_add should not be called +@@ -81,5 +103,11 @@ def test_lvm_devices(self): + + mock["blockdev"].lvm.devices_add.assert_not_called() + ++ # LVM devices file enabled and devices file exists ++ # but flag set to false -> devices_delete should not be called ++ fmt._destroy() ++ ++ mock["blockdev"].lvm.devices_delete.assert_not_called() ++ + # reset the flag back + flags.lvm_devices_file = True diff --git a/0015-iscsi-Use-node-startup-onboot-option-for-Login.patch b/0015-iscsi-Use-node-startup-onboot-option-for-Login.patch new file mode 100644 index 0000000..eaad4ba --- /dev/null +++ b/0015-iscsi-Use-node-startup-onboot-option-for-Login.patch @@ -0,0 +1,23 @@ +From c16a44b6627a6b4c1cb178f4c2127f21a53344ec Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Mon, 3 Mar 2025 12:33:34 +0100 +Subject: [PATCH] iscsi: Use node.startup=onboot option for Login + +Resolves: RHEL-53719 +--- + blivet/iscsi.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/blivet/iscsi.py b/blivet/iscsi.py +index 95674665b..f66c38934 100644 +--- a/blivet/iscsi.py ++++ b/blivet/iscsi.py +@@ -278,7 +278,7 @@ def _login(self, node_info, extra=None): + + if extra is None: + extra = dict() +- extra["node.startup"] = GLib.Variant("s", "automatic") ++ extra["node.startup"] = GLib.Variant("s", "onboot") + extra["node.session.auth.chap_algs"] = GLib.Variant("s", "SHA1,MD5") + + args = GLib.Variant("(sisisa{sv})", node_info.conn_info + (extra,)) diff --git a/0016-Make-sure-selinux_test-doesnt-try-to-create-mountpoints.patch b/0016-Make-sure-selinux_test-doesnt-try-to-create-mountpoints.patch new file mode 100644 index 0000000..bcea9c9 --- /dev/null +++ b/0016-Make-sure-selinux_test-doesnt-try-to-create-mountpoints.patch @@ -0,0 +1,26 @@ +From 8195fb13faa587737780f174651964c4f074f482 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Wed, 3 Jul 2024 15:49:34 +0200 +Subject: [PATCH] tests: Make sure selinux_test doesn't try to create + mountpoints + +This is a unit test so it shouldn't try to create directories +anywhere. + +Resolves: RHEL-78988 +--- + tests/unit_tests/formats_tests/selinux_test.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tests/unit_tests/formats_tests/selinux_test.py b/tests/unit_tests/formats_tests/selinux_test.py +index 484e745a4..ea2f516be 100644 +--- a/tests/unit_tests/formats_tests/selinux_test.py ++++ b/tests/unit_tests/formats_tests/selinux_test.py +@@ -23,6 +23,7 @@ def setUp(self): + @patch("blivet.tasks.fsmount.BlockDev.fs.mount", return_value=True) + @patch.object(fs.FS, "_pre_setup", return_value=True) + @patch("os.access", return_value=True) ++ @patch("os.path.isdir", return_value=True) + # pylint: disable=unused-argument + def exec_mount_selinux_format(self, formt, *args): + """ Test of correct selinux context parameter value when mounting """ diff --git a/python-blivet.spec b/python-blivet.spec index f34cfe7..b0b0d40 100644 --- a/python-blivet.spec +++ b/python-blivet.spec @@ -5,7 +5,7 @@ Version: 3.10.0 #%%global prerelease .b2 # prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2 -Release: 16%{?prerelease}%{?dist} +Release: 17%{?prerelease}%{?dist} Epoch: 1 License: LGPL-2.1-or-later %global realname blivet @@ -28,6 +28,9 @@ 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 Patch11: 0013-Set-persistent-allow-discards-flag-for-new-LUKS-devices.patch +Patch12: 0014-Do-not-remove-PVs-from-devices-file-if-disabled-or-doesnt-exist.patch +Patch13: 0015-iscsi-Use-node-startup-onboot-option-for-Login.patch +Patch14: 0016-Make-sure-selinux_test-doesnt-try-to-create-mountpoints.patch # Versions of required components (done so we make sure the buildrequires # match the requires versions of things). @@ -122,6 +125,14 @@ make DESTDIR=%{buildroot} install %{python3_sitelib}/* %changelog +* Thu Mar 27 2025 Vojtech Trefny - 3.10.0-17 +- Do not remove PVs from devices file if disabled or doesn't exist + Resolves: RHEL-65846 +- iscsi: Use node.startup=onboot option for Login + Resolves: RHEL-53719 +- tests: Make sure selinux_test doesn't try to create mountpoints + Resolves: RHEL-78988 + * Tue Mar 11 2025 Vojtech Trefny - 3.10.0-16 - Set persistent allow-discards flag for newly created LUKS devices Resolves: RHEL-82884