From fdf68af2f8abb54b4fac590cbb9d26396bb7062d Mon Sep 17 00:00:00 2001 From: Miroslav Lisik Date: Wed, 15 Dec 2021 11:05:52 +0100 Subject: [PATCH] Resolves: rhbz#1811072 rhbz#2019836 rhbz#2032473 - Fixed enabling corosync-qdevice - Fixed resource update command when unable to get agent metadata - Fixed revert of disallowing to clone a group with a stonith --- ...owing-to-clone-a-group-with-a-stonit.patch | 84 +++++++++++++++++++ ...md-when-unable-to-get-agent-metadata.patch | 73 ++++++++++++++++ ...473-01-fix-enabling-corosync-qdevice.patch | 25 ++++++ pcs.spec | 14 +++- 4 files changed, 195 insertions(+), 1 deletion(-) create mode 100644 bz1811072-01-revert-of-disallowing-to-clone-a-group-with-a-stonit.patch create mode 100644 bz2019836-01-fix-rsc-update-cmd-when-unable-to-get-agent-metadata.patch create mode 100644 bz2032473-01-fix-enabling-corosync-qdevice.patch diff --git a/bz1811072-01-revert-of-disallowing-to-clone-a-group-with-a-stonit.patch b/bz1811072-01-revert-of-disallowing-to-clone-a-group-with-a-stonit.patch new file mode 100644 index 0000000..6a5ba20 --- /dev/null +++ b/bz1811072-01-revert-of-disallowing-to-clone-a-group-with-a-stonit.patch @@ -0,0 +1,84 @@ +From e1573865543a3d59930b315a40ecd9b7a807e1c1 Mon Sep 17 00:00:00 2001 +From: Ondrej Mular +Date: Mon, 13 Dec 2021 12:48:26 +0100 +Subject: [PATCH 3/3] revert of disallowing to clone a group with a stonith + inside + +Originally, this was not fixed properly (it was possible to add a stonith +into a cloned group), therefore to stay consistent, this change is being +reverted. It will be fixed in the future by not allowing stonith to be +placed into a group. +--- + pcs/resource.py | 16 ++-------------- + .../tier1/cib_resource/test_clone_unclone.py | 8 ++------ + 2 files changed, 4 insertions(+), 20 deletions(-) + +diff --git a/pcs/resource.py b/pcs/resource.py +index 928477b2..c7cf4c7e 100644 +--- a/pcs/resource.py ++++ b/pcs/resource.py +@@ -1697,7 +1697,7 @@ def resource_clone_create( + ): + element.parentNode.parentNode.removeChild(element.parentNode) + +- def _reject_stonith_clone_report(force_flags, stonith_ids, group_id=None): ++ if element.getAttribute("class") == "stonith": + process_library_reports( + [ + reports.ReportItem( +@@ -1706,24 +1706,12 @@ def resource_clone_create( + is_forced=reports.codes.FORCE in force_flags, + ), + message=reports.messages.CloningStonithResourcesHasNoEffect( +- stonith_ids, group_id=group_id ++ [name] + ), + ) + ] + ) + +- if element.getAttribute("class") == "stonith": +- _reject_stonith_clone_report(force_flags, [name]) +- +- if element.tagName == "group": +- stonith_ids = [ +- resource.getAttribute("id") +- for resource in element.getElementsByTagName("primitive") +- if resource.getAttribute("class") == "stonith" +- ] +- if stonith_ids: +- _reject_stonith_clone_report(force_flags, stonith_ids, name) +- + parts = parse_clone_args(argv, promotable=promotable) + if not update_existing: + clone_id = parts["clone_id"] +diff --git a/pcs_test/tier1/cib_resource/test_clone_unclone.py b/pcs_test/tier1/cib_resource/test_clone_unclone.py +index 7b0e89f9..4cc4cb3e 100644 +--- a/pcs_test/tier1/cib_resource/test_clone_unclone.py ++++ b/pcs_test/tier1/cib_resource/test_clone_unclone.py +@@ -354,12 +354,9 @@ class Clone( + + def test_clone_group_with_stonith(self): + self.set_cib_file(FIXTURE_GROUP_WITH_STONITH) +- self.assert_pcs_fail( ++ self.assert_effect( + "resource clone Group".split(), +- fixture_clone_stonith_msg(group=True), +- ) +- self.assert_resources_xml_in_cib( +- fixture_resources_xml(FIXTURE_GROUP_WITH_STONITH) ++ fixture_resources_xml(FIXTURE_CLONED_GROUP_WITH_STONITH), + ) + + def test_clone_group_with_stonith_forced(self): +@@ -367,7 +364,6 @@ class Clone( + self.assert_effect( + "resource clone Group --force".split(), + fixture_resources_xml(FIXTURE_CLONED_GROUP_WITH_STONITH), +- output=fixture_clone_stonith_msg(forced=True, group=True), + ) + + def test_promotable_clone(self): +-- +2.31.1 + diff --git a/bz2019836-01-fix-rsc-update-cmd-when-unable-to-get-agent-metadata.patch b/bz2019836-01-fix-rsc-update-cmd-when-unable-to-get-agent-metadata.patch new file mode 100644 index 0000000..9611c1a --- /dev/null +++ b/bz2019836-01-fix-rsc-update-cmd-when-unable-to-get-agent-metadata.patch @@ -0,0 +1,73 @@ +From 69bfb22dbd68023069f6dae11e418f6ad455474f Mon Sep 17 00:00:00 2001 +From: Ondrej Mular +Date: Tue, 7 Dec 2021 11:14:37 +0100 +Subject: [PATCH 2/3] fix rsc update cmd when unable to get agent metadata + +`resource update` command failed with a traceback when updating a +resource with a non-existing resource agent +--- + pcs/resource.py | 14 ++++++++------ + pcs_test/tier1/legacy/test_resource.py | 21 +++++++++++++++++++++ + 2 files changed, 29 insertions(+), 6 deletions(-) + +diff --git a/pcs/resource.py b/pcs/resource.py +index b2a5e355..928477b2 100644 +--- a/pcs/resource.py ++++ b/pcs/resource.py +@@ -1075,13 +1075,15 @@ def resource_update(lib, args, modifiers, deal_with_guest_change=True): + if report_list: + process_library_reports(report_list) + except lib_ra.ResourceAgentError as e: +- severity = ( +- reports.ReportItemSeverity.WARNING +- if modifiers.get("--force") +- else reports.ReportItemSeverity.ERROR +- ) + process_library_reports( +- [lib_ra.resource_agent_error_to_report_item(e, severity)] ++ [ ++ lib_ra.resource_agent_error_to_report_item( ++ e, ++ reports.get_severity( ++ reports.codes.FORCE, modifiers.get("--force") ++ ), ++ ) ++ ] + ) + except LibraryError as e: + process_library_reports(e.args) +diff --git a/pcs_test/tier1/legacy/test_resource.py b/pcs_test/tier1/legacy/test_resource.py +index 417ca131..0f8415b4 100644 +--- a/pcs_test/tier1/legacy/test_resource.py ++++ b/pcs_test/tier1/legacy/test_resource.py +@@ -4882,6 +4882,27 @@ class UpdateInstanceAttrs( + ), + ) + ++ def test_nonexisting_agent(self): ++ agent = "ocf:pacemaker:nonexistent" ++ message = ( ++ f"Agent '{agent}' is not installed or does " ++ "not provide valid metadata: Metadata query for " ++ f"{agent} failed: Input/output error" ++ ) ++ self.assert_pcs_success( ++ f"resource create --force D0 {agent}".split(), ++ f"Warning: {message}\n", ++ ) ++ ++ self.assert_pcs_fail( ++ "resource update D0 test=testA".split(), ++ f"Error: {message}, use --force to override\n", ++ ) ++ self.assert_pcs_success( ++ "resource update --force D0 test=testA".split(), ++ f"Warning: {message}\n", ++ ) ++ + def test_update_existing(self): + xml = """ + +-- +2.31.1 + diff --git a/bz2032473-01-fix-enabling-corosync-qdevice.patch b/bz2032473-01-fix-enabling-corosync-qdevice.patch new file mode 100644 index 0000000..71a2290 --- /dev/null +++ b/bz2032473-01-fix-enabling-corosync-qdevice.patch @@ -0,0 +1,25 @@ +From 798d054db1a20b7cd2f2aed2b35b9e51835dec55 Mon Sep 17 00:00:00 2001 +From: Tomas Jelinek +Date: Mon, 6 Dec 2021 16:06:31 +0100 +Subject: [PATCH 1/3] fix enabling corosync-qdevice + +--- + pcsd/remote.rb | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/pcsd/remote.rb b/pcsd/remote.rb +index b569e249..e1923d6f 100644 +--- a/pcsd/remote.rb ++++ b/pcsd/remote.rb +@@ -2002,7 +2002,7 @@ def qdevice_client_enable(param, request, auth_user) + unless allowed_for_local_cluster(auth_user, Permissions::WRITE) + return 403, 'Permission denied' + end +- if not ServiceChecker.new('corosync', enabled: true).is_enabled?('corosync') ++ if not ServiceChecker.new(['corosync'], enabled: true).is_enabled?('corosync') + return pcsd_success('corosync is not enabled, skipping') + elsif enable_service('corosync-qdevice') + return pcsd_success('corosync-qdevice enabled') +-- +2.31.1 + diff --git a/pcs.spec b/pcs.spec index e2aa8b6..ae3719c 100644 --- a/pcs.spec +++ b/pcs.spec @@ -1,6 +1,6 @@ Name: pcs Version: 0.11.1 -Release: 6%{?dist} +Release: 7%{?dist} # https://docs.fedoraproject.org/en-US/packaging-guidelines/LicensingGuidelines/ # https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Good_Licenses # GPLv2: pcs @@ -106,6 +106,9 @@ Source101: https://github.com/ClusterLabs/pcs-web-ui/releases/download/%{ui_comm # Z-streams are exception here: they can come from upstream but should be # applied at the end to keep z-stream changes as straightforward as possible. # Patch1: bzNUMBER-01-name.patch +Patch2: bz2032473-01-fix-enabling-corosync-qdevice.patch +Patch3: bz2019836-01-fix-rsc-update-cmd-when-unable-to-get-agent-metadata.patch +Patch4: bz1811072-01-revert-of-disallowing-to-clone-a-group-with-a-stonit.patch # Downstream patches do not come from upstream. They adapt pcs for specific # RHEL needs. @@ -295,6 +298,9 @@ update_times_patch(){ %autosetup -S git -n %{pcs_source_name} -N %autopatch -p1 -M 200 update_times_patch %{PATCH1} +update_times_patch %{PATCH2} +update_times_patch %{PATCH3} +update_times_patch %{PATCH4} # prepare dirs/files necessary for building all bundles # ----------------------------------------------------- @@ -535,6 +541,12 @@ run_all_tests %license pyagentx_LICENSE.txt %changelog +* Wed Dec 15 2021 Miroslav Lisik - 0.11.1-7 +- Fixed enabling corosync-qdevice +- Fixed resource update command when unable to get agent metadata +- Fixed revert of disallowing to clone a group with a stonith +- Resolves: rhbz#1811072 rhbz#2019836 rhbz#2032473 + * Thu Dec 02 2021 Miroslav Lisik - 0.11.1-6 - Rebased to latest upstream sources (see CHANGELOG.md) - Updated pcs web ui