Blame SOURCES/bz1811072-01-revert-of-disallowing-to-clone-a-group-with-a-stonit.patch

beaa2e
From e1573865543a3d59930b315a40ecd9b7a807e1c1 Mon Sep 17 00:00:00 2001
beaa2e
From: Ondrej Mular <omular@redhat.com>
beaa2e
Date: Mon, 13 Dec 2021 12:48:26 +0100
beaa2e
Subject: [PATCH 3/3] revert of disallowing to clone a group with a stonith
beaa2e
 inside
beaa2e
beaa2e
Originally, this was not fixed properly (it was possible to add a stonith
beaa2e
into a cloned group), therefore to stay consistent, this change is being
beaa2e
reverted. It will be fixed in the future by not allowing stonith to be
beaa2e
placed into a group.
beaa2e
---
beaa2e
 pcs/resource.py                                  | 16 ++--------------
beaa2e
 .../tier1/cib_resource/test_clone_unclone.py     |  8 ++------
beaa2e
 2 files changed, 4 insertions(+), 20 deletions(-)
beaa2e
beaa2e
diff --git a/pcs/resource.py b/pcs/resource.py
beaa2e
index 928477b2..c7cf4c7e 100644
beaa2e
--- a/pcs/resource.py
beaa2e
+++ b/pcs/resource.py
beaa2e
@@ -1697,7 +1697,7 @@ def resource_clone_create(
beaa2e
     ):
beaa2e
         element.parentNode.parentNode.removeChild(element.parentNode)
beaa2e
 
beaa2e
-    def _reject_stonith_clone_report(force_flags, stonith_ids, group_id=None):
beaa2e
+    if element.getAttribute("class") == "stonith":
beaa2e
         process_library_reports(
beaa2e
             [
beaa2e
                 reports.ReportItem(
beaa2e
@@ -1706,24 +1706,12 @@ def resource_clone_create(
beaa2e
                         is_forced=reports.codes.FORCE in force_flags,
beaa2e
                     ),
beaa2e
                     message=reports.messages.CloningStonithResourcesHasNoEffect(
beaa2e
-                        stonith_ids, group_id=group_id
beaa2e
+                        [name]
beaa2e
                     ),
beaa2e
                 )
beaa2e
             ]
beaa2e
         )
beaa2e
 
beaa2e
-    if element.getAttribute("class") == "stonith":
beaa2e
-        _reject_stonith_clone_report(force_flags, [name])
beaa2e
-
beaa2e
-    if element.tagName == "group":
beaa2e
-        stonith_ids = [
beaa2e
-            resource.getAttribute("id")
beaa2e
-            for resource in element.getElementsByTagName("primitive")
beaa2e
-            if resource.getAttribute("class") == "stonith"
beaa2e
-        ]
beaa2e
-        if stonith_ids:
beaa2e
-            _reject_stonith_clone_report(force_flags, stonith_ids, name)
beaa2e
-
beaa2e
     parts = parse_clone_args(argv, promotable=promotable)
beaa2e
     if not update_existing:
beaa2e
         clone_id = parts["clone_id"]
beaa2e
diff --git a/pcs_test/tier1/cib_resource/test_clone_unclone.py b/pcs_test/tier1/cib_resource/test_clone_unclone.py
beaa2e
index 7b0e89f9..4cc4cb3e 100644
beaa2e
--- a/pcs_test/tier1/cib_resource/test_clone_unclone.py
beaa2e
+++ b/pcs_test/tier1/cib_resource/test_clone_unclone.py
beaa2e
@@ -354,12 +354,9 @@ class Clone(
beaa2e
 
beaa2e
     def test_clone_group_with_stonith(self):
beaa2e
         self.set_cib_file(FIXTURE_GROUP_WITH_STONITH)
beaa2e
-        self.assert_pcs_fail(
beaa2e
+        self.assert_effect(
beaa2e
             "resource clone Group".split(),
beaa2e
-            fixture_clone_stonith_msg(group=True),
beaa2e
-        )
beaa2e
-        self.assert_resources_xml_in_cib(
beaa2e
-            fixture_resources_xml(FIXTURE_GROUP_WITH_STONITH)
beaa2e
+            fixture_resources_xml(FIXTURE_CLONED_GROUP_WITH_STONITH),
beaa2e
         )
beaa2e
 
beaa2e
     def test_clone_group_with_stonith_forced(self):
beaa2e
@@ -367,7 +364,6 @@ class Clone(
beaa2e
         self.assert_effect(
beaa2e
             "resource clone Group --force".split(),
beaa2e
             fixture_resources_xml(FIXTURE_CLONED_GROUP_WITH_STONITH),
beaa2e
-            output=fixture_clone_stonith_msg(forced=True, group=True),
beaa2e
         )
beaa2e
 
beaa2e
     def test_promotable_clone(self):
beaa2e
-- 
beaa2e
2.31.1
beaa2e