Blame SOURCES/bz2151511-01-add-warning-when-updating-a-misconfigured-resource.patch

3362d5
From 58589e47f2913276ea1c2164a3ce8ee694fb2b78 Mon Sep 17 00:00:00 2001
3362d5
From: Ondrej Mular <omular@redhat.com>
3362d5
Date: Wed, 7 Dec 2022 11:33:25 +0100
3362d5
Subject: [PATCH 1/5] add warning when updating a misconfigured resource
3362d5
3362d5
---
3362d5
 pcs/common/reports/codes.py                   |  3 +
3362d5
 pcs/common/reports/messages.py                | 19 +++++
3362d5
 pcs/lib/cib/resource/primitive.py             | 84 ++++++++++++++-----
3362d5
 pcs/lib/pacemaker/live.py                     | 38 ++-------
3362d5
 .../tier0/common/reports/test_messages.py     | 16 ++++
3362d5
 .../cib/resource/test_primitive_validate.py   | 56 +++++++------
3362d5
 pcs_test/tier0/lib/pacemaker/test_live.py     | 78 +++++------------
3362d5
 pcs_test/tier1/legacy/test_stonith.py         |  5 +-
3362d5
 8 files changed, 161 insertions(+), 138 deletions(-)
3362d5
3362d5
diff --git a/pcs/common/reports/codes.py b/pcs/common/reports/codes.py
3362d5
index deecc626..48048af7 100644
3362d5
--- a/pcs/common/reports/codes.py
3362d5
+++ b/pcs/common/reports/codes.py
3362d5
@@ -40,6 +40,9 @@ AGENT_NAME_GUESS_FOUND_MORE_THAN_ONE = M("AGENT_NAME_GUESS_FOUND_MORE_THAN_ONE")
3362d5
 AGENT_NAME_GUESS_FOUND_NONE = M("AGENT_NAME_GUESS_FOUND_NONE")
3362d5
 AGENT_NAME_GUESSED = M("AGENT_NAME_GUESSED")
3362d5
 AGENT_SELF_VALIDATION_INVALID_DATA = M("AGENT_SELF_VALIDATION_INVALID_DATA")
3362d5
+AGENT_SELF_VALIDATION_SKIPPED_UPDATED_RESOURCE_MISCONFIGURED = M(
3362d5
+    "AGENT_SELF_VALIDATION_SKIPPED_UPDATED_RESOURCE_MISCONFIGURED"
3362d5
+)
3362d5
 AGENT_SELF_VALIDATION_RESULT = M("AGENT_SELF_VALIDATION_RESULT")
3362d5
 BAD_CLUSTER_STATE_FORMAT = M("BAD_CLUSTER_STATE_FORMAT")
3362d5
 BOOTH_ADDRESS_DUPLICATION = M("BOOTH_ADDRESS_DUPLICATION")
3362d5
diff --git a/pcs/common/reports/messages.py b/pcs/common/reports/messages.py
3362d5
index d27c1dee..24bb222f 100644
3362d5
--- a/pcs/common/reports/messages.py
3362d5
+++ b/pcs/common/reports/messages.py
3362d5
@@ -7584,6 +7584,25 @@ class AgentSelfValidationInvalidData(ReportItemMessage):
3362d5
         return f"Invalid validation data from agent: {self.reason}"
3362d5
 
3362d5
 
3362d5
+@dataclass(frozen=True)
3362d5
+class AgentSelfValidationSkippedUpdatedResourceMisconfigured(ReportItemMessage):
3362d5
+    """
3362d5
+    Agent self validation is skipped when updating a resource as it is
3362d5
+    misconfigured in its current state.
3362d5
+    """
3362d5
+
3362d5
+    result: str
3362d5
+    _code = codes.AGENT_SELF_VALIDATION_SKIPPED_UPDATED_RESOURCE_MISCONFIGURED
3362d5
+
3362d5
+    @property
3362d5
+    def message(self) -> str:
3362d5
+        return (
3362d5
+            "The resource was misconfigured before the update, therefore agent "
3362d5
+            "self-validation will not be run for the updated configuration. "
3362d5
+            "Validation output of the original configuration:\n{result}"
3362d5
+        ).format(result="\n".join(indent(self.result.splitlines())))
3362d5
+
3362d5
+
3362d5
 @dataclass(frozen=True)
3362d5
 class BoothAuthfileNotUsed(ReportItemMessage):
3362d5
     """
3362d5
diff --git a/pcs/lib/cib/resource/primitive.py b/pcs/lib/cib/resource/primitive.py
3362d5
index 3ebd01c6..c5df8e58 100644
3362d5
--- a/pcs/lib/cib/resource/primitive.py
3362d5
+++ b/pcs/lib/cib/resource/primitive.py
3362d5
@@ -357,6 +357,31 @@ def _is_ocf_or_stonith_agent(resource_agent_name: ResourceAgentName) -> bool:
3362d5
     return resource_agent_name.standard in ("stonith", "ocf")
3362d5
 
3362d5
 
3362d5
+def _get_report_from_agent_self_validation(
3362d5
+    is_valid: Optional[bool],
3362d5
+    reason: str,
3362d5
+    report_severity: reports.ReportItemSeverity,
3362d5
+) -> reports.ReportItemList:
3362d5
+    report_items = []
3362d5
+    if is_valid is None:
3362d5
+        report_items.append(
3362d5
+            reports.ReportItem(
3362d5
+                report_severity,
3362d5
+                reports.messages.AgentSelfValidationInvalidData(reason),
3362d5
+            )
3362d5
+        )
3362d5
+    elif not is_valid or reason:
3362d5
+        if is_valid:
3362d5
+            report_severity = reports.ReportItemSeverity.warning()
3362d5
+        report_items.append(
3362d5
+            reports.ReportItem(
3362d5
+                report_severity,
3362d5
+                reports.messages.AgentSelfValidationResult(reason),
3362d5
+            )
3362d5
+        )
3362d5
+    return report_items
3362d5
+
3362d5
+
3362d5
 def validate_resource_instance_attributes_create(
3362d5
     cmd_runner: CommandRunner,
3362d5
     resource_agent: ResourceAgentFacade,
3362d5
@@ -402,16 +427,16 @@ def validate_resource_instance_attributes_create(
3362d5
             for report_item in report_items
3362d5
         )
3362d5
     ):
3362d5
-        (
3362d5
-            dummy_is_valid,
3362d5
-            agent_validation_reports,
3362d5
-        ) = validate_resource_instance_attributes_via_pcmk(
3362d5
-            cmd_runner,
3362d5
-            agent_name,
3362d5
-            instance_attributes,
3362d5
-            reports.get_severity(reports.codes.FORCE, force),
3362d5
+        report_items.extend(
3362d5
+            _get_report_from_agent_self_validation(
3362d5
+                *validate_resource_instance_attributes_via_pcmk(
3362d5
+                    cmd_runner,
3362d5
+                    agent_name,
3362d5
+                    instance_attributes,
3362d5
+                ),
3362d5
+                reports.get_severity(reports.codes.FORCE, force),
3362d5
+            )
3362d5
         )
3362d5
-        report_items.extend(agent_validation_reports)
3362d5
     return report_items
3362d5
 
3362d5
 
3362d5
@@ -505,25 +530,40 @@ def validate_resource_instance_attributes_update(
3362d5
         )
3362d5
     ):
3362d5
         (
3362d5
-            is_valid,
3362d5
-            dummy_reports,
3362d5
+            original_is_valid,
3362d5
+            original_reason,
3362d5
         ) = validate_resource_instance_attributes_via_pcmk(
3362d5
             cmd_runner,
3362d5
             agent_name,
3362d5
             current_instance_attrs,
3362d5
-            reports.ReportItemSeverity.error(),
3362d5
         )
3362d5
-        if is_valid:
3362d5
-            (
3362d5
-                dummy_is_valid,
3362d5
-                agent_validation_reports,
3362d5
-            ) = validate_resource_instance_attributes_via_pcmk(
3362d5
-                cmd_runner,
3362d5
-                resource_agent.metadata.name,
3362d5
-                final_attrs,
3362d5
-                reports.get_severity(reports.codes.FORCE, force),
3362d5
+        if original_is_valid:
3362d5
+            report_items.extend(
3362d5
+                _get_report_from_agent_self_validation(
3362d5
+                    *validate_resource_instance_attributes_via_pcmk(
3362d5
+                        cmd_runner,
3362d5
+                        resource_agent.metadata.name,
3362d5
+                        final_attrs,
3362d5
+                    ),
3362d5
+                    reports.get_severity(reports.codes.FORCE, force),
3362d5
+                )
3362d5
+            )
3362d5
+        elif original_is_valid is None:
3362d5
+            report_items.append(
3362d5
+                reports.ReportItem.warning(
3362d5
+                    reports.messages.AgentSelfValidationInvalidData(
3362d5
+                        original_reason
3362d5
+                    )
3362d5
+                )
3362d5
+            )
3362d5
+        else:
3362d5
+            report_items.append(
3362d5
+                reports.ReportItem.warning(
3362d5
+                    reports.messages.AgentSelfValidationSkippedUpdatedResourceMisconfigured(
3362d5
+                        original_reason
3362d5
+                    )
3362d5
+                )
3362d5
             )
3362d5
-            report_items.extend(agent_validation_reports)
3362d5
     return report_items
3362d5
 
3362d5
 
3362d5
diff --git a/pcs/lib/pacemaker/live.py b/pcs/lib/pacemaker/live.py
3362d5
index fd26dabb..726f6b67 100644
3362d5
--- a/pcs/lib/pacemaker/live.py
3362d5
+++ b/pcs/lib/pacemaker/live.py
3362d5
@@ -902,8 +902,7 @@ def _validate_stonith_instance_attributes_via_pcmk(
3362d5
     cmd_runner: CommandRunner,
3362d5
     agent_name: ResourceAgentName,
3362d5
     instance_attributes: Mapping[str, str],
3362d5
-    not_valid_severity: reports.ReportItemSeverity,
3362d5
-) -> Tuple[Optional[bool], reports.ReportItemList]:
3362d5
+) -> Tuple[Optional[bool], str]:
3362d5
     cmd = [
3362d5
         settings.stonith_admin,
3362d5
         "--validate",
3362d5
@@ -917,7 +916,6 @@ def _validate_stonith_instance_attributes_via_pcmk(
3362d5
         cmd,
3362d5
         "./validate/command/output",
3362d5
         instance_attributes,
3362d5
-        not_valid_severity,
3362d5
     )
3362d5
 
3362d5
 
3362d5
@@ -925,8 +923,7 @@ def _validate_resource_instance_attributes_via_pcmk(
3362d5
     cmd_runner: CommandRunner,
3362d5
     agent_name: ResourceAgentName,
3362d5
     instance_attributes: Mapping[str, str],
3362d5
-    not_valid_severity: reports.ReportItemSeverity,
3362d5
-) -> Tuple[Optional[bool], reports.ReportItemList]:
3362d5
+) -> Tuple[Optional[bool], str]:
3362d5
     cmd = [
3362d5
         settings.crm_resource_binary,
3362d5
         "--validate",
3362d5
@@ -944,7 +941,6 @@ def _validate_resource_instance_attributes_via_pcmk(
3362d5
         cmd,
3362d5
         "./resource-agent-action/command/output",
3362d5
         instance_attributes,
3362d5
-        not_valid_severity,
3362d5
     )
3362d5
 
3362d5
 
3362d5
@@ -953,8 +949,7 @@ def _handle_instance_attributes_validation_via_pcmk(
3362d5
     cmd: StringSequence,
3362d5
     data_xpath: str,
3362d5
     instance_attributes: Mapping[str, str],
3362d5
-    not_valid_severity: reports.ReportItemSeverity,
3362d5
-) -> Tuple[Optional[bool], reports.ReportItemList]:
3362d5
+) -> Tuple[Optional[bool], str]:
3362d5
     full_cmd = list(cmd)
3362d5
     for key, value in sorted(instance_attributes.items()):
3362d5
         full_cmd.extend(["--option", f"{key}={value}"])
3362d5
@@ -963,12 +958,7 @@ def _handle_instance_attributes_validation_via_pcmk(
3362d5
         # dom = _get_api_result_dom(stdout)
3362d5
         dom = xml_fromstring(stdout)
3362d5
     except (etree.XMLSyntaxError, etree.DocumentInvalid) as e:
3362d5
-        return None, [
3362d5
-            reports.ReportItem(
3362d5
-                not_valid_severity,
3362d5
-                reports.messages.AgentSelfValidationInvalidData(str(e)),
3362d5
-            )
3362d5
-        ]
3362d5
+        return None, str(e)
3362d5
     result = "\n".join(
3362d5
         "\n".join(
3362d5
             line.strip() for line in item.text.split("\n") if line.strip()
3362d5
@@ -976,38 +966,22 @@ def _handle_instance_attributes_validation_via_pcmk(
3362d5
         for item in dom.iterfind(data_xpath)
3362d5
         if item.get("source") == "stderr" and item.text
3362d5
     ).strip()
3362d5
-    if return_value == 0:
3362d5
-        if result:
3362d5
-            return True, [
3362d5
-                reports.ReportItem.warning(
3362d5
-                    reports.messages.AgentSelfValidationResult(result)
3362d5
-                )
3362d5
-            ]
3362d5
-        return True, []
3362d5
-    return False, [
3362d5
-        reports.ReportItem(
3362d5
-            not_valid_severity,
3362d5
-            reports.messages.AgentSelfValidationResult(result),
3362d5
-        )
3362d5
-    ]
3362d5
+    return return_value == 0, result
3362d5
 
3362d5
 
3362d5
 def validate_resource_instance_attributes_via_pcmk(
3362d5
     cmd_runner: CommandRunner,
3362d5
     resource_agent_name: ResourceAgentName,
3362d5
     instance_attributes: Mapping[str, str],
3362d5
-    not_valid_severity: reports.ReportItemSeverity,
3362d5
-) -> Tuple[Optional[bool], reports.ReportItemList]:
3362d5
+) -> Tuple[Optional[bool], str]:
3362d5
     if resource_agent_name.is_stonith:
3362d5
         return _validate_stonith_instance_attributes_via_pcmk(
3362d5
             cmd_runner,
3362d5
             resource_agent_name,
3362d5
             instance_attributes,
3362d5
-            not_valid_severity,
3362d5
         )
3362d5
     return _validate_resource_instance_attributes_via_pcmk(
3362d5
         cmd_runner,
3362d5
         resource_agent_name,
3362d5
         instance_attributes,
3362d5
-        not_valid_severity,
3362d5
     )
3362d5
diff --git a/pcs_test/tier0/common/reports/test_messages.py b/pcs_test/tier0/common/reports/test_messages.py
3362d5
index 17627b80..5fcc62fc 100644
3362d5
--- a/pcs_test/tier0/common/reports/test_messages.py
3362d5
+++ b/pcs_test/tier0/common/reports/test_messages.py
3362d5
@@ -5562,6 +5562,22 @@ class AgentSelfValidationInvalidData(NameBuildTest):
3362d5
         )
3362d5
 
3362d5
 
3362d5
+class AgentSelfValidationSkippedUpdatedResourceMisconfigured(NameBuildTest):
3362d5
+    def test_message(self):
3362d5
+        lines = list(f"line #{i}" for i in range(3))
3362d5
+        self.assert_message_from_report(
3362d5
+            (
3362d5
+                "The resource was misconfigured before the update, therefore "
3362d5
+                "agent self-validation will not be run for the updated "
3362d5
+                "configuration. Validation output of the original "
3362d5
+                "configuration:\n  {}"
3362d5
+            ).format("\n  ".join(lines)),
3362d5
+            reports.AgentSelfValidationSkippedUpdatedResourceMisconfigured(
3362d5
+                "\n".join(lines)
3362d5
+            ),
3362d5
+        )
3362d5
+
3362d5
+
3362d5
 class BoothAuthfileNotUsed(NameBuildTest):
3362d5
     def test_message(self):
3362d5
         self.assert_message_from_report(
3362d5
diff --git a/pcs_test/tier0/lib/cib/resource/test_primitive_validate.py b/pcs_test/tier0/lib/cib/resource/test_primitive_validate.py
3362d5
index 2cba7086..1bc3a5a6 100644
3362d5
--- a/pcs_test/tier0/lib/cib/resource/test_primitive_validate.py
3362d5
+++ b/pcs_test/tier0/lib/cib/resource/test_primitive_validate.py
3362d5
@@ -609,7 +609,6 @@ class ValidateResourceInstanceAttributesCreateSelfValidation(TestCase):
3362d5
             self.cmd_runner,
3362d5
             facade.metadata.name,
3362d5
             attributes,
3362d5
-            reports.ReportItemSeverity.error(reports.codes.FORCE),
3362d5
         )
3362d5
 
3362d5
     def test_force(self):
3362d5
@@ -629,15 +628,14 @@ class ValidateResourceInstanceAttributesCreateSelfValidation(TestCase):
3362d5
             self.cmd_runner,
3362d5
             facade.metadata.name,
3362d5
             attributes,
3362d5
-            reports.ReportItemSeverity.warning(),
3362d5
         )
3362d5
 
3362d5
     def test_failure(self):
3362d5
         attributes = {"required": "value"}
3362d5
         facade = _fixture_ocf_agent()
3362d5
-        failure_reports = ["report1", "report2"]
3362d5
-        self.agent_self_validation_mock.return_value = False, failure_reports
3362d5
-        self.assertEqual(
3362d5
+        failure_reason = "failure reason"
3362d5
+        self.agent_self_validation_mock.return_value = False, failure_reason
3362d5
+        assert_report_item_list_equal(
3362d5
             primitive.validate_resource_instance_attributes_create(
3362d5
                 self.cmd_runner,
3362d5
                 facade,
3362d5
@@ -645,13 +643,18 @@ class ValidateResourceInstanceAttributesCreateSelfValidation(TestCase):
3362d5
                 etree.Element("resources"),
3362d5
                 force=False,
3362d5
             ),
3362d5
-            failure_reports,
3362d5
+            [
3362d5
+                fixture.error(
3362d5
+                    reports.codes.AGENT_SELF_VALIDATION_RESULT,
3362d5
+                    result=failure_reason,
3362d5
+                    force_code=reports.codes.FORCE,
3362d5
+                )
3362d5
+            ],
3362d5
         )
3362d5
         self.agent_self_validation_mock.assert_called_once_with(
3362d5
             self.cmd_runner,
3362d5
             facade.metadata.name,
3362d5
             attributes,
3362d5
-            reports.ReportItemSeverity.error(reports.codes.FORCE),
3362d5
         )
3362d5
 
3362d5
     def test_stonith_check(self):
3362d5
@@ -671,7 +674,6 @@ class ValidateResourceInstanceAttributesCreateSelfValidation(TestCase):
3362d5
             self.cmd_runner,
3362d5
             facade.metadata.name,
3362d5
             attributes,
3362d5
-            reports.ReportItemSeverity.error(reports.codes.FORCE),
3362d5
         )
3362d5
 
3362d5
     def test_nonexisting_agent(self):
3362d5
@@ -1295,13 +1297,11 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
3362d5
                     self.cmd_runner,
3362d5
                     facade.metadata.name,
3362d5
                     old_attributes,
3362d5
-                    reports.ReportItemSeverity.error(),
3362d5
                 ),
3362d5
                 mock.call(
3362d5
                     self.cmd_runner,
3362d5
                     facade.metadata.name,
3362d5
                     new_attributes,
3362d5
-                    reports.ReportItemSeverity.error(reports.codes.FORCE),
3362d5
                 ),
3362d5
             ],
3362d5
         )
3362d5
@@ -1328,13 +1328,11 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
3362d5
                     self.cmd_runner,
3362d5
                     facade.metadata.name,
3362d5
                     old_attributes,
3362d5
-                    reports.ReportItemSeverity.error(),
3362d5
                 ),
3362d5
                 mock.call(
3362d5
                     self.cmd_runner,
3362d5
                     facade.metadata.name,
3362d5
                     new_attributes,
3362d5
-                    reports.ReportItemSeverity.warning(),
3362d5
                 ),
3362d5
             ],
3362d5
         )
3362d5
@@ -1342,13 +1340,13 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
3362d5
     def test_failure(self):
3362d5
         old_attributes = {"required": "old_value"}
3362d5
         new_attributes = {"required": "new_value"}
3362d5
-        failure_reports = ["report1", "report2"]
3362d5
+        failure_reason = "failure reason"
3362d5
         facade = _fixture_ocf_agent()
3362d5
         self.agent_self_validation_mock.side_effect = (
3362d5
-            (True, []),
3362d5
-            (False, failure_reports),
3362d5
+            (True, ""),
3362d5
+            (False, failure_reason),
3362d5
         )
3362d5
-        self.assertEqual(
3362d5
+        assert_report_item_list_equal(
3362d5
             primitive.validate_resource_instance_attributes_update(
3362d5
                 self.cmd_runner,
3362d5
                 facade,
3362d5
@@ -1357,7 +1355,13 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
3362d5
                 self._fixture_resources(old_attributes),
3362d5
                 force=False,
3362d5
             ),
3362d5
-            failure_reports,
3362d5
+            [
3362d5
+                fixture.error(
3362d5
+                    reports.codes.AGENT_SELF_VALIDATION_RESULT,
3362d5
+                    result=failure_reason,
3362d5
+                    force_code=reports.codes.FORCE,
3362d5
+                )
3362d5
+            ],
3362d5
         )
3362d5
         self.assertEqual(
3362d5
             self.agent_self_validation_mock.mock_calls,
3362d5
@@ -1366,13 +1370,11 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
3362d5
                     self.cmd_runner,
3362d5
                     facade.metadata.name,
3362d5
                     old_attributes,
3362d5
-                    reports.ReportItemSeverity.error(),
3362d5
                 ),
3362d5
                 mock.call(
3362d5
                     self.cmd_runner,
3362d5
                     facade.metadata.name,
3362d5
                     new_attributes,
3362d5
-                    reports.ReportItemSeverity.error(reports.codes.FORCE),
3362d5
                 ),
3362d5
             ],
3362d5
         )
3362d5
@@ -1399,13 +1401,11 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
3362d5
                     self.cmd_runner,
3362d5
                     facade.metadata.name,
3362d5
                     old_attributes,
3362d5
-                    reports.ReportItemSeverity.error(),
3362d5
                 ),
3362d5
                 mock.call(
3362d5
                     self.cmd_runner,
3362d5
                     facade.metadata.name,
3362d5
                     new_attributes,
3362d5
-                    reports.ReportItemSeverity.error(reports.codes.FORCE),
3362d5
                 ),
3362d5
             ],
3362d5
         )
3362d5
@@ -1471,10 +1471,10 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
3362d5
     def test_current_attributes_failure(self):
3362d5
         old_attributes = {"required": "old_value"}
3362d5
         new_attributes = {"required": "new_value"}
3362d5
-        failure_reports = ["report1", "report2"]
3362d5
+        failure_reason = "failure reason"
3362d5
         facade = _fixture_ocf_agent()
3362d5
-        self.agent_self_validation_mock.return_value = False, failure_reports
3362d5
-        self.assertEqual(
3362d5
+        self.agent_self_validation_mock.return_value = False, failure_reason
3362d5
+        assert_report_item_list_equal(
3362d5
             primitive.validate_resource_instance_attributes_update(
3362d5
                 self.cmd_runner,
3362d5
                 facade,
3362d5
@@ -1483,7 +1483,12 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
3362d5
                 self._fixture_resources(old_attributes),
3362d5
                 force=False,
3362d5
             ),
3362d5
-            [],
3362d5
+            [
3362d5
+                fixture.warn(
3362d5
+                    reports.codes.AGENT_SELF_VALIDATION_SKIPPED_UPDATED_RESOURCE_MISCONFIGURED,
3362d5
+                    result=failure_reason,
3362d5
+                )
3362d5
+            ],
3362d5
         )
3362d5
         self.assertEqual(
3362d5
             self.agent_self_validation_mock.mock_calls,
3362d5
@@ -1492,7 +1497,6 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
3362d5
                     self.cmd_runner,
3362d5
                     facade.metadata.name,
3362d5
                     old_attributes,
3362d5
-                    reports.ReportItemSeverity.error(),
3362d5
                 ),
3362d5
             ],
3362d5
         )
3362d5
diff --git a/pcs_test/tier0/lib/pacemaker/test_live.py b/pcs_test/tier0/lib/pacemaker/test_live.py
3362d5
index 5c8000cd..239a72b1 100644
3362d5
--- a/pcs_test/tier0/lib/pacemaker/test_live.py
3362d5
+++ b/pcs_test/tier0/lib/pacemaker/test_live.py
3362d5
@@ -1752,16 +1752,15 @@ class HandleInstanceAttributesValidateViaPcmkTest(TestCase):
3362d5
         base_cmd = ["some", "command"]
3362d5
         (
3362d5
             is_valid,
3362d5
-            report_list,
3362d5
+            reason,
3362d5
         ) = lib._handle_instance_attributes_validation_via_pcmk(
3362d5
             runner,
3362d5
             base_cmd,
3362d5
             "result/output",
3362d5
             {"attr1": "val1", "attr2": "val2"},
3362d5
-            not_valid_severity=Severity.info(),
3362d5
         )
3362d5
         self.assertTrue(is_valid)
3362d5
-        self.assertEqual(report_list, [])
3362d5
+        self.assertEqual(reason, "")
3362d5
         runner.run.assert_called_once_with(
3362d5
             base_cmd + ["--option", "attr1=val1", "--option", "attr2=val2"]
3362d5
         )
3362d5
@@ -1771,23 +1770,17 @@ class HandleInstanceAttributesValidateViaPcmkTest(TestCase):
3362d5
         base_cmd = ["some", "command"]
3362d5
         (
3362d5
             is_valid,
3362d5
-            report_list,
3362d5
+            reason,
3362d5
         ) = lib._handle_instance_attributes_validation_via_pcmk(
3362d5
             runner,
3362d5
             base_cmd,
3362d5
             "result/output",
3362d5
             {"attr1": "val1", "attr2": "val2"},
3362d5
-            not_valid_severity=Severity.info(),
3362d5
         )
3362d5
         self.assertIsNone(is_valid)
3362d5
-        assert_report_item_list_equal(
3362d5
-            report_list,
3362d5
-            [
3362d5
-                fixture.info(
3362d5
-                    report_codes.AGENT_SELF_VALIDATION_INVALID_DATA,
3362d5
-                    reason="Start tag expected, '<' not found, line 1, column 1 (<string>, line 1)",
3362d5
-                )
3362d5
-            ],
3362d5
+        self.assertEqual(
3362d5
+            reason,
3362d5
+            "Start tag expected, '<' not found, line 1, column 1 (<string>, line 1)",
3362d5
         )
3362d5
         runner.run.assert_called_once_with(
3362d5
             base_cmd + ["--option", "attr1=val1", "--option", "attr2=val2"]
3362d5
@@ -1806,19 +1799,15 @@ class HandleInstanceAttributesValidateViaPcmkTest(TestCase):
3362d5
         base_cmd = ["some", "command"]
3362d5
         (
3362d5
             is_valid,
3362d5
-            report_list,
3362d5
+            reason,
3362d5
         ) = lib._handle_instance_attributes_validation_via_pcmk(
3362d5
             runner,
3362d5
             base_cmd,
3362d5
             "result/output",
3362d5
             {"attr1": "val1", "attr2": "val2"},
3362d5
-            not_valid_severity=Severity.info(),
3362d5
         )
3362d5
         self.assertTrue(is_valid)
3362d5
-        assert_report_item_list_equal(
3362d5
-            report_list,
3362d5
-            [],
3362d5
-        )
3362d5
+        self.assertEqual(reason, "")
3362d5
         runner.run.assert_called_once_with(
3362d5
             base_cmd + ["--option", "attr1=val1", "--option", "attr2=val2"]
3362d5
         )
3362d5
@@ -1837,23 +1826,15 @@ class HandleInstanceAttributesValidateViaPcmkTest(TestCase):
3362d5
         base_cmd = ["some", "command"]
3362d5
         (
3362d5
             is_valid,
3362d5
-            report_list,
3362d5
+            reason,
3362d5
         ) = lib._handle_instance_attributes_validation_via_pcmk(
3362d5
             runner,
3362d5
             base_cmd,
3362d5
             "result/output",
3362d5
             {"attr1": "val1", "attr2": "val2"},
3362d5
-            not_valid_severity=Severity.info(),
3362d5
         )
3362d5
         self.assertFalse(is_valid)
3362d5
-        assert_report_item_list_equal(
3362d5
-            report_list,
3362d5
-            [
3362d5
-                fixture.info(
3362d5
-                    report_codes.AGENT_SELF_VALIDATION_RESULT, result=""
3362d5
-                )
3362d5
-            ],
3362d5
-        )
3362d5
+        self.assertEqual(reason, "")
3362d5
         runner.run.assert_called_once_with(
3362d5
             base_cmd + ["--option", "attr1=val1", "--option", "attr2=val2"]
3362d5
         )
3362d5
@@ -1881,23 +1862,17 @@ class HandleInstanceAttributesValidateViaPcmkTest(TestCase):
3362d5
         base_cmd = ["some", "command"]
3362d5
         (
3362d5
             is_valid,
3362d5
-            report_list,
3362d5
+            reason,
3362d5
         ) = lib._handle_instance_attributes_validation_via_pcmk(
3362d5
             runner,
3362d5
             base_cmd,
3362d5
             "result/output",
3362d5
             {"attr1": "val1", "attr2": "val2"},
3362d5
-            not_valid_severity=Severity.info(),
3362d5
         )
3362d5
         self.assertFalse(is_valid)
3362d5
-        assert_report_item_list_equal(
3362d5
-            report_list,
3362d5
-            [
3362d5
-                fixture.info(
3362d5
-                    report_codes.AGENT_SELF_VALIDATION_RESULT,
3362d5
-                    result="first line\nImportant output\nand another line",
3362d5
-                )
3362d5
-            ],
3362d5
+        self.assertEqual(
3362d5
+            reason,
3362d5
+            "first line\nImportant output\nand another line",
3362d5
         )
3362d5
         runner.run.assert_called_once_with(
3362d5
             base_cmd + ["--option", "attr1=val1", "--option", "attr2=val2"]
3362d5
@@ -1925,23 +1900,17 @@ class HandleInstanceAttributesValidateViaPcmkTest(TestCase):
3362d5
         base_cmd = ["some", "command"]
3362d5
         (
3362d5
             is_valid,
3362d5
-            report_list,
3362d5
+            reason,
3362d5
         ) = lib._handle_instance_attributes_validation_via_pcmk(
3362d5
             runner,
3362d5
             base_cmd,
3362d5
             "result/output",
3362d5
             {"attr1": "val1", "attr2": "val2"},
3362d5
-            not_valid_severity=Severity.info(),
3362d5
         )
3362d5
         self.assertTrue(is_valid)
3362d5
-        assert_report_item_list_equal(
3362d5
-            report_list,
3362d5
-            [
3362d5
-                fixture.warn(
3362d5
-                    report_codes.AGENT_SELF_VALIDATION_RESULT,
3362d5
-                    result="first line\nImportant output\nand another line",
3362d5
-                )
3362d5
-            ],
3362d5
+        self.assertEqual(
3362d5
+            reason,
3362d5
+            "first line\nImportant output\nand another line",
3362d5
         )
3362d5
         runner.run.assert_called_once_with(
3362d5
             base_cmd + ["--option", "attr1=val1", "--option", "attr2=val2"]
3362d5
@@ -1953,7 +1922,6 @@ class ValidateResourceInstanceAttributesViaPcmkTest(TestCase):
3362d5
     def setUp(self):
3362d5
         self.runner = mock.Mock()
3362d5
         self.attrs = dict(attra="val1", attrb="val2")
3362d5
-        self.severity = Severity.info()
3362d5
         patcher = mock.patch(
3362d5
             "pcs.lib.pacemaker.live._handle_instance_attributes_validation_via_pcmk"
3362d5
         )
3362d5
@@ -1967,7 +1935,7 @@ class ValidateResourceInstanceAttributesViaPcmkTest(TestCase):
3362d5
         )
3362d5
         self.assertEqual(
3362d5
             lib._validate_resource_instance_attributes_via_pcmk(
3362d5
-                self.runner, agent, self.attrs, self.severity
3362d5
+                self.runner, agent, self.attrs
3362d5
             ),
3362d5
             self.ret_val,
3362d5
         )
3362d5
@@ -1987,7 +1955,6 @@ class ValidateResourceInstanceAttributesViaPcmkTest(TestCase):
3362d5
             ],
3362d5
             "./resource-agent-action/command/output",
3362d5
             self.attrs,
3362d5
-            self.severity,
3362d5
         )
3362d5
 
3362d5
     def test_without_provider(self):
3362d5
@@ -1996,7 +1963,7 @@ class ValidateResourceInstanceAttributesViaPcmkTest(TestCase):
3362d5
         )
3362d5
         self.assertEqual(
3362d5
             lib._validate_resource_instance_attributes_via_pcmk(
3362d5
-                self.runner, agent, self.attrs, self.severity
3362d5
+                self.runner, agent, self.attrs
3362d5
             ),
3362d5
             self.ret_val,
3362d5
         )
3362d5
@@ -2014,7 +1981,6 @@ class ValidateResourceInstanceAttributesViaPcmkTest(TestCase):
3362d5
             ],
3362d5
             "./resource-agent-action/command/output",
3362d5
             self.attrs,
3362d5
-            self.severity,
3362d5
         )
3362d5
 
3362d5
 
3362d5
@@ -2024,7 +1990,6 @@ class ValidateStonithInstanceAttributesViaPcmkTest(TestCase):
3362d5
     def setUp(self):
3362d5
         self.runner = mock.Mock()
3362d5
         self.attrs = dict(attra="val1", attrb="val2")
3362d5
-        self.severity = Severity.info()
3362d5
         patcher = mock.patch(
3362d5
             "pcs.lib.pacemaker.live._handle_instance_attributes_validation_via_pcmk"
3362d5
         )
3362d5
@@ -2038,7 +2003,7 @@ class ValidateStonithInstanceAttributesViaPcmkTest(TestCase):
3362d5
         )
3362d5
         self.assertEqual(
3362d5
             lib._validate_stonith_instance_attributes_via_pcmk(
3362d5
-                self.runner, agent, self.attrs, self.severity
3362d5
+                self.runner, agent, self.attrs
3362d5
             ),
3362d5
             self.ret_val,
3362d5
         )
3362d5
@@ -2054,5 +2019,4 @@ class ValidateStonithInstanceAttributesViaPcmkTest(TestCase):
3362d5
             ],
3362d5
             "./validate/command/output",
3362d5
             self.attrs,
3362d5
-            self.severity,
3362d5
         )
3362d5
diff --git a/pcs_test/tier1/legacy/test_stonith.py b/pcs_test/tier1/legacy/test_stonith.py
3362d5
index 9911d604..cf430d75 100644
3362d5
--- a/pcs_test/tier1/legacy/test_stonith.py
3362d5
+++ b/pcs_test/tier1/legacy/test_stonith.py
3362d5
@@ -1294,7 +1294,10 @@ class StonithTest(TestCase, AssertPcsMixin):
3362d5
             ),
3362d5
         )
3362d5
 
3362d5
-        self.assert_pcs_success("stonith update test3 username=testA".split())
3362d5
+        self.assert_pcs_success(
3362d5
+            "stonith update test3 username=testA".split(),
3362d5
+            stdout_start="Warning: ",
3362d5
+        )
3362d5
 
3362d5
         self.assert_pcs_success(
3362d5
             "stonith config test2".split(),
3362d5
-- 
3362d5
2.39.0
3362d5