diff --git a/SOURCES/bz2042433-01-fix-creating-empty-cib.patch b/SOURCES/bz2042433-01-fix-creating-empty-cib.patch new file mode 100644 index 0000000..df3f45e --- /dev/null +++ b/SOURCES/bz2042433-01-fix-creating-empty-cib.patch @@ -0,0 +1,94 @@ +From eae00a30e6eb682e60ec1ace4ec6633591254e15 Mon Sep 17 00:00:00 2001 +From: Tomas Jelinek +Date: Thu, 13 Jan 2022 17:32:38 +0100 +Subject: [PATCH] fix creating empty cib + +--- + pcs/utils.py | 21 +++++++++++---------- + pcs_test/tier1/test_misc.py | 25 ++++++++++++++++++++++++- + 2 files changed, 35 insertions(+), 11 deletions(-) + +diff --git a/pcs/utils.py b/pcs/utils.py +index ad2d4452..423ffc43 100644 +--- a/pcs/utils.py ++++ b/pcs/utils.py +@@ -2067,16 +2067,17 @@ def write_empty_cib(cibfile): + """ + Commandline options: no options + """ +- empty_xml = """ +- +- +- +- +- +- +- +- +-""" ++ empty_xml = """ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ """ + with open(cibfile, "w") as f: + f.write(empty_xml) + +diff --git a/pcs_test/tier1/test_misc.py b/pcs_test/tier1/test_misc.py +index 29ca6a71..6e6f72fb 100644 +--- a/pcs_test/tier1/test_misc.py ++++ b/pcs_test/tier1/test_misc.py +@@ -1,8 +1,10 @@ ++import os + from unittest import TestCase + + from pcs_test.tools.assertions import AssertPcsMixin + from pcs_test.tools.misc import ( + get_test_resource as rc, ++ get_tmp_dir, + get_tmp_file, + outdent, + write_file_to_tmpfile, +@@ -19,7 +21,7 @@ class ParseArgvDashDash(TestCase, AssertPcsMixin): + cmd = "constraint colocation add R1 with R2".split() + + def setUp(self): +- self.temp_cib = get_tmp_file("tier1_misc") ++ self.temp_cib = get_tmp_file("tier1_misc_dashdash") + write_file_to_tmpfile(rc("cib-empty.xml"), self.temp_cib) + self.pcs_runner = PcsRunner(self.temp_cib.name) + self.allowed_roles = format_list(const.PCMK_ROLES) +@@ -89,3 +91,24 @@ class ParseArgvDashDash(TestCase, AssertPcsMixin): + """ + ), + ) ++ ++ ++class EmptyCibIsPcmk2Compatible(TestCase, AssertPcsMixin): ++ # This test verifies that a default empty CIB created by pcs when -f points ++ # to an empty file conforms to minimal schema version supported by ++ # pacemaker 2.0. If pcs prints a message that CIB schema has been upgraded, ++ # then the test fails and shows there is a bug. Bundle with promoted-max ++ # requires CIB compliant with schema 3.1, which was introduced in pacemaker ++ # 2.0.0. ++ def setUp(self): ++ self.cib_dir = get_tmp_dir("tier1_misc_empty_cib") ++ self.pcs_runner = PcsRunner(os.path.join(self.cib_dir.name, "cib.xml")) ++ ++ def tearDown(self): ++ self.cib_dir.cleanup() ++ ++ def test_success(self): ++ self.assert_pcs_success( ++ "resource bundle create b container docker image=my.img promoted-max=1".split(), ++ "", ++ ) +-- +2.31.1 + diff --git a/SPECS/pcs.spec b/SPECS/pcs.spec index aa28ddc..d43ce81 100644 --- a/SPECS/pcs.spec +++ b/SPECS/pcs.spec @@ -1,6 +1,6 @@ Name: pcs Version: 0.10.10 -Release: 4%{?dist} +Release: 4%{?dist}.1 # https://docs.fedoraproject.org/en-US/packaging-guidelines/LicensingGuidelines/ # https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Good_Licenses # GPLv2: pcs @@ -124,6 +124,7 @@ Patch4: bz1991654-01-fix-unfencing-in-pcs-stonith-update-scsi-devices.patch # Downstream patches do not come from upstream. They adapt pcs for specific # RHEL needs. Patch101: do-not-support-cluster-setup-with-udp-u-transport.patch +Patch102: bz2042433-01-fix-creating-empty-cib.patch # git for patches BuildRequires: git-core @@ -311,6 +312,7 @@ update_times_patch %{PATCH2} update_times_patch %{PATCH3} update_times_patch %{PATCH4} update_times_patch %{PATCH101} +update_times_patch %{PATCH102} cp -f %SOURCE1 %{pcsd_public_dir}/images # prepare dirs/files necessary for building web ui @@ -573,6 +575,10 @@ remove_all_tests %license pyagentx_LICENSE.txt %changelog +* Wed Jan 26 2022 Miroslav Lisik - 0.10.10-4.el8_5.1 +- Fixed creating empty cib +- Resolves: rhbz#bz2042433 + * Fri Sep 24 2021 Miroslav Lisik - 0.10.10-4 - Fixed unfencing in `pcs stonith update-scsi-devices` - Resolves: rhbz#bz1991654