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