Merge branch 'c8' into a8

This commit is contained in:
eabdullin 2022-03-24 14:01:47 +00:00 committed by Stepan Oksanichenko
commit 54b26303d7
2 changed files with 102 additions and 2 deletions

View File

@ -0,0 +1,94 @@
From eae00a30e6eb682e60ec1ace4ec6633591254e15 Mon Sep 17 00:00:00 2001
From: Tomas Jelinek <tojeline@redhat.com>
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 = """<?xml version="1.0" encoding="UTF-8"?>
-<cib admin_epoch="0" epoch="1" num_updates="1" validate-with="pacemaker-1.2">
- <configuration>
- <crm_config/>
- <nodes/>
- <resources/>
- <constraints/>
- </configuration>
- <status/>
-</cib>"""
+ empty_xml = """
+ <cib admin_epoch="0" epoch="1" num_updates="1" validate-with="pacemaker-3.1">
+ <configuration>
+ <crm_config/>
+ <nodes/>
+ <resources/>
+ <constraints/>
+ </configuration>
+ <status/>
+ </cib>
+ """
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

View File

@ -1,6 +1,6 @@
Name: pcs Name: pcs
Version: 0.10.10 Version: 0.10.10
Release: 4%{?dist}.alma Release: 4%{?dist}.1.alma
# https://docs.fedoraproject.org/en-US/packaging-guidelines/LicensingGuidelines/ # https://docs.fedoraproject.org/en-US/packaging-guidelines/LicensingGuidelines/
# https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Good_Licenses # https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Good_Licenses
# GPLv2: pcs # 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 # Downstream patches do not come from upstream. They adapt pcs for specific
# RHEL needs. # RHEL needs.
Patch101: do-not-support-cluster-setup-with-udp-u-transport.patch Patch101: do-not-support-cluster-setup-with-udp-u-transport.patch
Patch102: bz2042433-01-fix-creating-empty-cib.patch
# git for patches # git for patches
BuildRequires: git-core BuildRequires: git-core
@ -311,6 +312,7 @@ update_times_patch %{PATCH2}
update_times_patch %{PATCH3} update_times_patch %{PATCH3}
update_times_patch %{PATCH4} update_times_patch %{PATCH4}
update_times_patch %{PATCH101} update_times_patch %{PATCH101}
update_times_patch %{PATCH102}
cp -f %SOURCE1 %{pcsd_public_dir}/images cp -f %SOURCE1 %{pcsd_public_dir}/images
# prepare dirs/files necessary for building web ui # prepare dirs/files necessary for building web ui
@ -573,9 +575,13 @@ remove_all_tests
%license pyagentx_LICENSE.txt %license pyagentx_LICENSE.txt
%changelog %changelog
* Tue Nov 09 2021 Andrew Lukoshko <alukoshko@almalinux.org> - 0.10.10-4.alma * Thu Mar 24 2022 Andrew Lukoshko <alukoshko@almalinux.org> - 0.10.10-4.el8_5.1.alma
- Debrand logo - Debrand logo
* Wed Jan 26 2022 Miroslav Lisik <mlisik@redhat.com> - 0.10.10-4.el8_5.1
- Fixed creating empty cib
- Resolves: rhbz#bz2042433
* Fri Sep 24 2021 Miroslav Lisik <mlisik@redhat.com> - 0.10.10-4 * Fri Sep 24 2021 Miroslav Lisik <mlisik@redhat.com> - 0.10.10-4
- Fixed unfencing in `pcs stonith update-scsi-devices` - Fixed unfencing in `pcs stonith update-scsi-devices`
- Resolves: rhbz#bz1991654 - Resolves: rhbz#bz1991654