9183b6
From f60b24d7c70f63ceef0020a0a3b8a885aeccbdd1 Mon Sep 17 00:00:00 2001
9183b6
From: Ondrej Mular <omular@redhat.com>
9183b6
Date: Tue, 10 Jan 2023 15:57:33 +0100
9183b6
Subject: [PATCH 1/2] add '--agent-validation' option for enabling agent
9183b6
 self-validation feature
9183b6
9183b6
---
9183b6
 CHANGELOG.md                                  |   7 +
9183b6
 pcs/cli/common/parse_args.py                  |   3 +
9183b6
 pcs/lib/cib/resource/primitive.py             |  12 +-
9183b6
 pcs/lib/cib/resource/remote_node.py           |   1 +
9183b6
 pcs/lib/commands/booth.py                     |   1 +
9183b6
 pcs/lib/commands/resource.py                  |  16 ++
9183b6
 pcs/lib/commands/stonith.py                   |   8 +
9183b6
 pcs/pcs.8.in                                  |  16 +-
9183b6
 pcs/resource.py                               |  12 +-
9183b6
 pcs/stonith.py                                |   3 +
9183b6
 pcs/usage.py                                  |  32 ++--
9183b6
 .../cib/resource/test_primitive_validate.py   |  49 ++++++
9183b6
 .../commands/resource/test_resource_create.py | 156 ++++++++++++------
9183b6
 pcs_test/tier0/lib/commands/test_booth.py     |  49 ------
9183b6
 pcs_test/tier0/lib/commands/test_stonith.py   |  24 +--
9183b6
 pcs_test/tier1/cib_resource/test_create.py    |   2 +
9183b6
 .../tier1/cib_resource/test_stonith_create.py |   2 -
9183b6
 pcs_test/tier1/legacy/test_resource.py        |   8 +-
9183b6
 pcs_test/tier1/legacy/test_stonith.py         |  25 ++-
9183b6
 19 files changed, 280 insertions(+), 146 deletions(-)
9183b6
9183b6
diff --git a/CHANGELOG.md b/CHANGELOG.md
9183b6
index 378cca50..47212f00 100644
9183b6
--- a/CHANGELOG.md
9183b6
+++ b/CHANGELOG.md
9183b6
@@ -12,9 +12,16 @@
9183b6
 - Displaying bool and integer values in `pcs resource config` command
9183b6
   ([rhbz#2151164], [ghissue#604])
9183b6
 
9183b6
+### Changed
9183b6
+- Resource/stonith agent self-validation of instance attributes is now
9183b6
+  disabled by default, as many agents do not work with it properly.
9183b6
+  Use flag '--agent-validation' to enable it in supported commands.
9183b6
+  ([rhbz#2159454])
9183b6
+
9183b6
 [ghissue#604]: https://github.com/ClusterLabs/pcs/issues/604
9183b6
 [rhbz#2151164]: https://bugzilla.redhat.com/show_bug.cgi?id=2151164
9183b6
 [rhbz#2151524]: https://bugzilla.redhat.com/show_bug.cgi?id=2151524
9183b6
+[rhbz#2159454]: https://bugzilla.redhat.com/show_bug.cgi?id=2159454
9183b6
 
9183b6
 
9183b6
 ## [0.11.4] - 2022-11-21
9183b6
diff --git a/pcs/cli/common/parse_args.py b/pcs/cli/common/parse_args.py
9183b6
index 663751aa..1c75f406 100644
9183b6
--- a/pcs/cli/common/parse_args.py
9183b6
+++ b/pcs/cli/common/parse_args.py
9183b6
@@ -93,6 +93,8 @@ PCS_LONG_OPTIONS = [
9183b6
     f"{_OUTPUT_FORMAT_OPTION_STR}=",
9183b6
     # auth token
9183b6
     "token=",
9183b6
+    # enable agent self validation
9183b6
+    "agent-validation",
9183b6
 ]
9183b6
 
9183b6
 
9183b6
@@ -484,6 +486,7 @@ class InputModifiers:
9183b6
             {
9183b6
                 # boolean values
9183b6
                 "--all": "--all" in options,
9183b6
+                "--agent-validation": "--agent-validation" in options,
9183b6
                 "--autodelete": "--autodelete" in options,
9183b6
                 "--brief": "--brief" in options,
9183b6
                 "--config": "--config" in options,
9183b6
diff --git a/pcs/lib/cib/resource/primitive.py b/pcs/lib/cib/resource/primitive.py
9183b6
index f9d52b9b..8d6e4c05 100644
9183b6
--- a/pcs/lib/cib/resource/primitive.py
9183b6
+++ b/pcs/lib/cib/resource/primitive.py
9183b6
@@ -137,6 +137,7 @@ def create(
9183b6
     resource_type: str = "resource",
9183b6
     # TODO remove this arg
9183b6
     do_not_report_instance_attribute_server_exists: bool = False,
9183b6
+    enable_agent_self_validation: bool = False,
9183b6
 ):
9183b6
     # pylint: disable=too-many-arguments
9183b6
     # pylint: disable=too-many-locals
9183b6
@@ -159,6 +160,8 @@ def create(
9183b6
     resource_type -- describes the resource for reports
9183b6
     do_not_report_instance_attribute_server_exists -- dirty fix due to
9183b6
         suboptimal architecture, TODO: fix the architecture and remove the param
9183b6
+    enable_agent_self_validation -- if True, use agent self-validation feature
9183b6
+        to validate instance attributes
9183b6
     """
9183b6
     if raw_operation_list is None:
9183b6
         raw_operation_list = []
9183b6
@@ -200,6 +203,7 @@ def create(
9183b6
         instance_attributes,
9183b6
         resources_section,
9183b6
         force=allow_invalid_instance_attributes,
9183b6
+        enable_agent_self_validation=enable_agent_self_validation,
9183b6
     )
9183b6
     # TODO remove this "if", see pcs.lib.cib.remote_node.create for details
9183b6
     if do_not_report_instance_attribute_server_exists:
9183b6
@@ -388,6 +392,7 @@ def validate_resource_instance_attributes_create(
9183b6
     instance_attributes: Mapping[str, str],
9183b6
     resources_section: _Element,
9183b6
     force: bool = False,
9183b6
+    enable_agent_self_validation: bool = False,
9183b6
 ) -> reports.ReportItemList:
9183b6
     report_items: reports.ReportItemList = []
9183b6
     report_items += validate.ValidatorAll(
9183b6
@@ -422,7 +427,8 @@ def validate_resource_instance_attributes_create(
9183b6
         )
9183b6
 
9183b6
     if (
9183b6
-        _is_ocf_or_stonith_agent(agent_name)
9183b6
+        enable_agent_self_validation
9183b6
+        and _is_ocf_or_stonith_agent(agent_name)
9183b6
         and resource_agent.metadata.agent_exists
9183b6
         and resource_agent.metadata.provides_self_validation
9183b6
         and not any(
9183b6
@@ -450,6 +456,7 @@ def validate_resource_instance_attributes_update(
9183b6
     resource_id: str,
9183b6
     resources_section: _Element,
9183b6
     force: bool = False,
9183b6
+    enable_agent_self_validation: bool = False,
9183b6
 ) -> reports.ReportItemList:
9183b6
     # pylint: disable=too-many-locals
9183b6
     # TODO This function currently accepts the updated resource as a string and
9183b6
@@ -524,7 +531,8 @@ def validate_resource_instance_attributes_update(
9183b6
         )
9183b6
 
9183b6
     if (
9183b6
-        _is_ocf_or_stonith_agent(agent_name)
9183b6
+        enable_agent_self_validation
9183b6
+        and _is_ocf_or_stonith_agent(agent_name)
9183b6
         and resource_agent.metadata.agent_exists
9183b6
         and resource_agent.metadata.provides_self_validation
9183b6
         and not any(
9183b6
diff --git a/pcs/lib/cib/resource/remote_node.py b/pcs/lib/cib/resource/remote_node.py
9183b6
index c76e37a6..f65c5446 100644
9183b6
--- a/pcs/lib/cib/resource/remote_node.py
9183b6
+++ b/pcs/lib/cib/resource/remote_node.py
9183b6
@@ -253,4 +253,5 @@ def create(
9183b6
         # 3) call the validation from here and handle the results or config
9183b6
         #    the validator before / when running it
9183b6
         do_not_report_instance_attribute_server_exists=True,
9183b6
+        enable_agent_self_validation=False,
9183b6
     )
9183b6
diff --git a/pcs/lib/commands/booth.py b/pcs/lib/commands/booth.py
9183b6
index ee91ea14..7b0ed4de 100644
9183b6
--- a/pcs/lib/commands/booth.py
9183b6
+++ b/pcs/lib/commands/booth.py
9183b6
@@ -480,6 +480,7 @@ def create_in_cluster(
9183b6
         env.cmd_runner(),
9183b6
         resources_section,
9183b6
         id_provider,
9183b6
+        enable_agent_self_validation=False,
9183b6
     )
9183b6
     agent_factory = ResourceAgentFacadeFactory(
9183b6
         env.cmd_runner(), report_processor
9183b6
diff --git a/pcs/lib/commands/resource.py b/pcs/lib/commands/resource.py
9183b6
index 7c64ace7..41f1a1ac 100644
9183b6
--- a/pcs/lib/commands/resource.py
9183b6
+++ b/pcs/lib/commands/resource.py
9183b6
@@ -361,6 +361,7 @@ def create(
9183b6
     ensure_disabled: bool = False,
9183b6
     wait: WaitType = False,
9183b6
     allow_not_suitable_command: bool = False,
9183b6
+    enable_agent_self_validation: bool = False,
9183b6
 ):
9183b6
     # pylint: disable=too-many-arguments, too-many-locals
9183b6
     """
9183b6
@@ -394,6 +395,8 @@ def create(
9183b6
         pcs.lib.commands.remote_node);
9183b6
         in the case of remote/guest node forcible error is produced when this
9183b6
         flag is set to False and warning is produced otherwise
9183b6
+    enable_agent_self_validation -- if True, use agent self-validation feature
9183b6
+        to validate instance attributes
9183b6
     """
9183b6
     runner = env.cmd_runner()
9183b6
     agent_factory = ResourceAgentFacadeFactory(runner, env.report_processor)
9183b6
@@ -440,6 +443,7 @@ def create(
9183b6
             allow_invalid_operation,
9183b6
             allow_invalid_instance_attributes,
9183b6
             use_default_operations,
9183b6
+            enable_agent_self_validation=enable_agent_self_validation,
9183b6
         )
9183b6
         if env.report_processor.has_errors:
9183b6
             raise LibraryError()
9183b6
@@ -465,6 +469,7 @@ def create_as_clone(
9183b6
     wait: WaitType = False,
9183b6
     allow_not_suitable_command: bool = False,
9183b6
     allow_incompatible_clone_meta_attributes: bool = False,
9183b6
+    enable_agent_self_validation: bool = False,
9183b6
 ):
9183b6
     # pylint: disable=too-many-arguments, too-many-locals
9183b6
     """
9183b6
@@ -495,6 +500,8 @@ def create_as_clone(
9183b6
     allow_incompatible_clone_meta_attributes -- if True some incompatible clone
9183b6
         meta attributes are treated as a warning, or as a forceable error if
9183b6
         False
9183b6
+    enable_agent_self_validation -- if True, use agent self-validation feature
9183b6
+        to validate instance attributes
9183b6
     """
9183b6
     runner = env.cmd_runner()
9183b6
     agent_factory = ResourceAgentFacadeFactory(runner, env.report_processor)
9183b6
@@ -579,6 +586,7 @@ def create_as_clone(
9183b6
             allow_invalid_operation,
9183b6
             allow_invalid_instance_attributes,
9183b6
             use_default_operations,
9183b6
+            enable_agent_self_validation=enable_agent_self_validation,
9183b6
         )
9183b6
 
9183b6
         clone_element = resource.clone.append_new(
9183b6
@@ -609,6 +617,7 @@ def create_in_group(
9183b6
     put_after_adjacent: bool = False,
9183b6
     wait: WaitType = False,
9183b6
     allow_not_suitable_command: bool = False,
9183b6
+    enable_agent_self_validation: bool = False,
9183b6
 ):
9183b6
     # pylint: disable=too-many-arguments, too-many-locals
9183b6
     """
9183b6
@@ -637,6 +646,8 @@ def create_in_group(
9183b6
         adjacent resource
9183b6
     wait -- is flag for controlling waiting for pacemaker idle mechanism
9183b6
     allow_not_suitable_command -- turn forceable errors into warnings
9183b6
+    enable_agent_self_validation -- if True, use agent self-validation feature
9183b6
+        to validate instance attributes
9183b6
     """
9183b6
     runner = env.cmd_runner()
9183b6
     agent_factory = ResourceAgentFacadeFactory(runner, env.report_processor)
9183b6
@@ -712,6 +723,7 @@ def create_in_group(
9183b6
             allow_invalid_operation,
9183b6
             allow_invalid_instance_attributes,
9183b6
             use_default_operations,
9183b6
+            enable_agent_self_validation=enable_agent_self_validation,
9183b6
         )
9183b6
         if ensure_disabled:
9183b6
             resource.common.disable(primitive_element, id_provider)
9183b6
@@ -749,6 +761,7 @@ def create_into_bundle(
9183b6
     wait: WaitType = False,
9183b6
     allow_not_suitable_command: bool = False,
9183b6
     allow_not_accessible_resource: bool = False,
9183b6
+    enable_agent_self_validation: bool = False,
9183b6
 ):
9183b6
     # pylint: disable=too-many-arguments, too-many-locals
9183b6
     """
9183b6
@@ -776,6 +789,8 @@ def create_into_bundle(
9183b6
     wait -- is flag for controlling waiting for pacemaker idle mechanism
9183b6
     allow_not_suitable_command -- turn forceable errors into warnings
9183b6
     allow_not_accessible_resource -- turn forceable errors into warnings
9183b6
+    enable_agent_self_validation -- if True, use agent self-validation feature
9183b6
+        to validate instance attributes
9183b6
     """
9183b6
     runner = env.cmd_runner()
9183b6
     agent_factory = ResourceAgentFacadeFactory(runner, env.report_processor)
9183b6
@@ -823,6 +838,7 @@ def create_into_bundle(
9183b6
             allow_invalid_operation,
9183b6
             allow_invalid_instance_attributes,
9183b6
             use_default_operations,
9183b6
+            enable_agent_self_validation=enable_agent_self_validation,
9183b6
         )
9183b6
         if ensure_disabled:
9183b6
             resource.common.disable(primitive_element, id_provider)
9183b6
diff --git a/pcs/lib/commands/stonith.py b/pcs/lib/commands/stonith.py
9183b6
index 42b5b270..3a3ea3b7 100644
9183b6
--- a/pcs/lib/commands/stonith.py
9183b6
+++ b/pcs/lib/commands/stonith.py
9183b6
@@ -115,6 +115,7 @@ def create(
9183b6
     use_default_operations: bool = True,
9183b6
     ensure_disabled: bool = False,
9183b6
     wait: WaitType = False,
9183b6
+    enable_agent_self_validation: bool = False,
9183b6
 ):
9183b6
     # pylint: disable=too-many-arguments, too-many-locals
9183b6
     """
9183b6
@@ -137,6 +138,8 @@ def create(
9183b6
         operations (specified in a stonith agent)
9183b6
     ensure_disabled -- flag that keeps resource in target-role "Stopped"
9183b6
     wait -- flag for controlling waiting for pacemaker idle mechanism
9183b6
+    enable_agent_self_validation -- if True, use agent self-validation feature
9183b6
+        to validate instance attributes
9183b6
     """
9183b6
     runner = env.cmd_runner()
9183b6
     agent_factory = ResourceAgentFacadeFactory(runner, env.report_processor)
9183b6
@@ -173,6 +176,7 @@ def create(
9183b6
             allow_invalid_instance_attributes=allow_invalid_instance_attributes,
9183b6
             use_default_operations=use_default_operations,
9183b6
             resource_type="stonith",
9183b6
+            enable_agent_self_validation=enable_agent_self_validation,
9183b6
         )
9183b6
         if ensure_disabled:
9183b6
             resource.common.disable(stonith_element, id_provider)
9183b6
@@ -195,6 +199,7 @@ def create_in_group(
9183b6
     adjacent_resource_id: Optional[str] = None,
9183b6
     put_after_adjacent: bool = False,
9183b6
     wait: WaitType = False,
9183b6
+    enable_agent_self_validation: bool = False,
9183b6
 ):
9183b6
     # pylint: disable=too-many-arguments, too-many-locals
9183b6
     """
9183b6
@@ -222,6 +227,8 @@ def create_in_group(
9183b6
     put_after_adjacent -- is flag to put a newly create resource befor/after
9183b6
         adjacent stonith
9183b6
     wait -- flag for controlling waiting for pacemaker idle mechanism
9183b6
+    enable_agent_self_validation -- if True, use agent self-validation feature
9183b6
+        to validate instance attributes
9183b6
     """
9183b6
     runner = env.cmd_runner()
9183b6
     agent_factory = ResourceAgentFacadeFactory(runner, env.report_processor)
9183b6
@@ -288,6 +295,7 @@ def create_in_group(
9183b6
             allow_invalid_operation,
9183b6
             allow_invalid_instance_attributes,
9183b6
             use_default_operations,
9183b6
+            enable_agent_self_validation=enable_agent_self_validation,
9183b6
         )
9183b6
         if ensure_disabled:
9183b6
             resource.common.disable(stonith_element, id_provider)
9183b6
diff --git a/pcs/pcs.8.in b/pcs/pcs.8.in
9183b6
index 7bbd1ae2..3be8465e 100644
9183b6
--- a/pcs/pcs.8.in
9183b6
+++ b/pcs/pcs.8.in
9183b6
@@ -95,8 +95,8 @@ Show list of all available resource agents (if filter is provided then only reso
9183b6
 describe [<standard>:[<provider>:]]<type> [\fB\-\-full\fR]
9183b6
 Show options for the specified resource. If \fB\-\-full\fR is specified, all options including advanced and deprecated ones are shown.
9183b6
 .TP
9183b6
-create <resource id> [<standard>:[<provider>:]]<type> [resource options] [\fBop\fR <operation action> <operation options> [<operation action> <operation options>]...] [\fBmeta\fR <meta options>...] [\fBclone\fR [<clone id>] [<clone options>] | promotable [<clone id>] [<promotable options>] | \fB\-\-group\fR <group id> [\fB\-\-before\fR <resource id> | \fB\-\-after\fR <resource id>] | \fBbundle\fR <bundle id>] [\fB\-\-disabled\fR] [\fB\-\-no\-default\-ops] [\fB\-\-wait\fR[=n]]
9183b6
-Create specified resource. If \fBclone\fR is used a clone resource is created. If \fBpromotable\fR is used a promotable clone resource is created. If \fB\-\-group\fR is specified the resource is added to the group named. You can use \fB\-\-before\fR or \fB\-\-after\fR to specify the position of the added resource relatively to some resource already existing in the group. If \fBbundle\fR is specified, resource will be created inside of the specified bundle. If \fB\-\-disabled\fR is specified the resource is not started automatically. If \fB\-\-no\-default\-ops\fR is specified, only monitor operations are created for the resource and all other operations use default settings. If \fB\-\-wait\fR is specified, pcs will wait up to 'n' seconds for the resource to start and then return 0 if the resource is started, or 1 if the resource has not yet started. If 'n' is not specified it defaults to 60 minutes.
9183b6
+create <resource id> [<standard>:[<provider>:]]<type> [resource options] [\fBop\fR <operation action> <operation options> [<operation action> <operation options>]...] [\fBmeta\fR <meta options>...] [\fBclone\fR [<clone id>] [<clone options>] | promotable [<clone id>] [<promotable options>] | \fB\-\-group\fR <group id> [\fB\-\-before\fR <resource id> | \fB\-\-after\fR <resource id>] | \fBbundle\fR <bundle id>] [\fB\-\-disabled\fR] [\fB\-\-agent\-validation\fR] [\fB\-\-no\-default\-ops\fR] [\fB\-\-wait\fR[=n]]
9183b6
+Create specified resource. If \fBclone\fR is used a clone resource is created. If \fBpromotable\fR is used a promotable clone resource is created. If \fB\-\-group\fR is specified the resource is added to the group named. You can use \fB\-\-before\fR or \fB\-\-after\fR to specify the position of the added resource relatively to some resource already existing in the group. If \fBbundle\fR is specified, resource will be created inside of the specified bundle. If \fB\-\-disabled\fR is specified the resource is not started automatically. If \fB\-\-agent\-validation\fR is specified, resource agent validate\-all action will be used to validate resource options. If \fB\-\-no\-default\-ops\fR is specified, only monitor operations are created for the resource and all other operations use default settings. If \fB\-\-wait\fR is specified, pcs will wait up to 'n' seconds for the resource to start and then return 0 if the resource is started, or 1 if the resource has not yet started. If 'n' is not specified it defaults to 60 minutes.
9183b6
 
9183b6
 Example: Create a new resource called 'VirtualIP' with IP address 192.168.0.99, netmask of 32, monitored everything 30 seconds, on eth2: pcs resource create VirtualIP ocf:heartbeat:IPaddr2 ip=192.168.0.99 cidr_netmask=32 nic=eth2 op monitor interval=30s
9183b6
 .TP
9183b6
@@ -204,11 +204,13 @@ List available OCF resource agent providers.
9183b6
 agents [standard[:provider]]
9183b6
 List available agents optionally filtered by standard and provider.
9183b6
 .TP
9183b6
-update <resource id> [resource options] [op [<operation action> <operation options>]...] [meta <meta operations>...] [\fB\-\-wait\fR[=n]]
9183b6
+update <resource id> [resource options] [op [<operation action> <operation options>]...] [meta <meta operations>...] [\fB\-\-agent\-validation\fR] [\fB\-\-wait\fR[=n]]
9183b6
 Add, remove or change options of specified resource, clone or multi\-state resource. Unspecified options will be kept unchanged. If you wish to remove an option, set it to empty value, i.e. 'option_name='.
9183b6
 
9183b6
 If an operation (op) is specified it will update the first found operation with the same action on the specified resource. If no operation with that action exists then a new operation will be created. (WARNING: all existing options on the updated operation will be reset if not specified.) If you want to create multiple monitor operations you should use the 'op add' & 'op remove' commands.
9183b6
 
9183b6
+If \fB\-\-agent\-validation\fR is specified, resource agent validate\-all action will be used to validate resource options.
9183b6
+
9183b6
 If \fB\-\-wait\fR is specified, pcs will wait up to 'n' seconds for the changes to take effect and then return 0 if the changes have been processed or 1 otherwise. If 'n' is not specified it defaults to 60 minutes.
9183b6
 .TP
9183b6
 op add <resource id> <operation action> [operation properties]
9183b6
@@ -689,8 +691,8 @@ Show list of all available stonith agents (if filter is provided then only stoni
9183b6
 describe <stonith agent> [\fB\-\-full\fR]
9183b6
 Show options for specified stonith agent. If \fB\-\-full\fR is specified, all options including advanced and deprecated ones are shown.
9183b6
 .TP
9183b6
-create <stonith id> <stonith device type> [stonith device options] [op <operation action> <operation options> [<operation action> <operation options>]...] [meta <meta options>...] [\fB\-\-group\fR <group id> [\fB\-\-before\fR <stonith id> | \fB\-\-after\fR <stonith id>]] [\fB\-\-disabled\fR] [\fB\-\-wait\fR[=n]]
9183b6
-Create stonith device with specified type and options. If \fB\-\-group\fR is specified the stonith device is added to the group named. You can use \fB\-\-before\fR or \fB\-\-after\fR to specify the position of the added stonith device relatively to some stonith device already existing in the group. If\fB\-\-disabled\fR is specified the stonith device is not used. If \fB\-\-wait\fR is specified, pcs will wait up to 'n' seconds for the stonith device to start and then return 0 if the stonith device is started, or 1 if the stonith device has not yet started. If 'n' is not specified it defaults to 60 minutes.
9183b6
+create <stonith id> <stonith device type> [stonith device options] [op <operation action> <operation options> [<operation action> <operation options>]...] [meta <meta options>...] [\fB\-\-group\fR <group id> [\fB\-\-before\fR <stonith id> | \fB\-\-after\fR <stonith id>]] [\fB\-\-disabled\fR] [\fB\-\-agent\-validation\fR] [\fB\-\-wait\fR[=n]]
9183b6
+Create stonith device with specified type and options. If \fB\-\-group\fR is specified the stonith device is added to the group named. You can use \fB\-\-before\fR or \fB\-\-after\fR to specify the position of the added stonith device relatively to some stonith device already existing in the group. If\fB\-\-disabled\fR is specified the stonith device is not used. If \fB\-\-agent\-validation\fR is specified, stonith agent validate\-all action will be used to validate stonith device options. If \fB\-\-wait\fR is specified, pcs will wait up to 'n' seconds for the stonith device to start and then return 0 if the stonith device is started, or 1 if the stonith device has not yet started. If 'n' is not specified it defaults to 60 minutes.
9183b6
 
9183b6
 Example: Create a device for nodes node1 and node2
9183b6
 .br
9183b6
@@ -700,11 +702,13 @@ Example: Use port p1 for node n1 and ports p2 and p3 for node n2
9183b6
 .br
9183b6
 pcs stonith create MyFence fence_virt 'pcmk_host_map=n1:p1;n2:p2,p3'
9183b6
 .TP
9183b6
-update <stonith id> [stonith options] [op [<operation action> <operation options>]...] [meta <meta operations>...] [\fB\-\-wait\fR[=n]]
9183b6
+update <stonith id> [stonith options] [op [<operation action> <operation options>]...] [meta <meta operations>...] [\fB\-\-agent\-validation\fR] [\fB\-\-wait\fR[=n]]
9183b6
 Add, remove or change options of specified stonith device. Unspecified options will be kept unchanged. If you wish to remove an option, set it to empty value, i.e. 'option_name='.
9183b6
 
9183b6
 If an operation (op) is specified it will update the first found operation with the same action on the specified stonith device. If no operation with that action exists then a new operation will be created. (WARNING: all existing options on the updated operation will be reset if not specified.) If you want to create multiple monitor operations you should use the 'op add' & 'op remove' commands.
9183b6
 
9183b6
+If \fB\-\-agent\-validation\fR is specified, stonith agent validate\-all action will be used to validate stonith device options.
9183b6
+
9183b6
 If \fB\-\-wait\fR is specified, pcs will wait up to 'n' seconds for the changes to take effect and then return 0 if the changes have been processed or 1 otherwise. If 'n' is not specified it defaults to 60 minutes.
9183b6
 .TP
9183b6
 update\-scsi\-devices <stonith id> (set <device\-path> [<device\-path>...]) | (add <device\-path> [<device\-path>...] delete|remove <device\-path> [<device\-path>...] )
9183b6
diff --git a/pcs/resource.py b/pcs/resource.py
9183b6
index b265b2d2..d8c61633 100644
9183b6
--- a/pcs/resource.py
9183b6
+++ b/pcs/resource.py
9183b6
@@ -624,6 +624,7 @@ def _format_desc(indentation, desc):
9183b6
 def resource_create(lib, argv, modifiers):
9183b6
     """
9183b6
     Options:
9183b6
+      * --agent-validation - use agent self validation of instance attributes
9183b6
       * --before - specified resource inside a group before which new resource
9183b6
         will be placed inside the group
9183b6
       * --after - specified resource inside a group after which new resource
9183b6
@@ -637,6 +638,7 @@ def resource_create(lib, argv, modifiers):
9183b6
       * -f - CIB file
9183b6
     """
9183b6
     modifiers.ensure_only_supported(
9183b6
+        "--agent-validation",
9183b6
         "--before",
9183b6
         "--after",
9183b6
         "--group",
9183b6
@@ -699,6 +701,7 @@ def resource_create(lib, argv, modifiers):
9183b6
         use_default_operations=not modifiers.get("--no-default-ops"),
9183b6
         wait=modifiers.get("--wait"),
9183b6
         allow_not_suitable_command=modifiers.get("--force"),
9183b6
+        enable_agent_self_validation=modifiers.get("--agent-validation"),
9183b6
     )
9183b6
 
9183b6
     clone_id = parts.get("clone_id", None)
9183b6
@@ -966,6 +969,7 @@ def update_cmd(lib: Any, argv: List[str], modifiers: InputModifiers) -> None:
9183b6
     """
9183b6
     Options:
9183b6
       * -f - CIB file
9183b6
+      * --agent-validation - use agent self validation of instance attributes
9183b6
       * --wait
9183b6
       * --force - allow invalid options, do not fail if not possible to get
9183b6
         agent metadata, allow not suitable command
9183b6
@@ -982,11 +986,14 @@ def resource_update(args: List[str], modifiers: InputModifiers) -> None:
9183b6
     """
9183b6
     Commandline options:
9183b6
       * -f - CIB file
9183b6
+      * --agent-validation - use agent self validation of instance attributes
9183b6
       * --wait
9183b6
       * --force - allow invalid options, do not fail if not possible to get
9183b6
         agent metadata, allow not suitable command
9183b6
     """
9183b6
-    modifiers.ensure_only_supported("-f", "--wait", "--force")
9183b6
+    modifiers.ensure_only_supported(
9183b6
+        "-f", "--wait", "--force", "--agent-validation"
9183b6
+    )
9183b6
     if len(args) < 2:
9183b6
         raise CmdLineInputError()
9183b6
     res_id = args.pop(0)
9183b6
@@ -1052,6 +1059,9 @@ def resource_update(args: List[str], modifiers: InputModifiers) -> None:
9183b6
             res_id,
9183b6
             get_resources(lib_pacemaker.get_cib(cib_xml)),
9183b6
             force=bool(modifiers.get("--force")),
9183b6
+            enable_agent_self_validation=bool(
9183b6
+                modifiers.get("--agent-validation")
9183b6
+            ),
9183b6
         )
9183b6
         if report_list:
9183b6
             process_library_reports(report_list)
9183b6
diff --git a/pcs/stonith.py b/pcs/stonith.py
9183b6
index 8ba6066c..ef97b41b 100644
9183b6
--- a/pcs/stonith.py
9183b6
+++ b/pcs/stonith.py
9183b6
@@ -148,6 +148,7 @@ def stonith_create(lib, argv, modifiers):
9183b6
         instance attributes
9183b6
       * --disabled - created resource will be disabled
9183b6
       * --no-default-ops - do not add default operations
9183b6
+      * --agent-validation - use agent self validation of instance attributes
9183b6
       * --wait
9183b6
       * -f - CIB file
9183b6
     """
9183b6
@@ -158,6 +159,7 @@ def stonith_create(lib, argv, modifiers):
9183b6
         "--force",
9183b6
         "--disabled",
9183b6
         "--no-default-ops",
9183b6
+        "--agent-validation",
9183b6
         "--wait",
9183b6
         "-f",
9183b6
     )
9183b6
@@ -191,6 +193,7 @@ def stonith_create(lib, argv, modifiers):
9183b6
         ensure_disabled=modifiers.get("--disabled"),
9183b6
         use_default_operations=not modifiers.get("--no-default-ops"),
9183b6
         wait=modifiers.get("--wait"),
9183b6
+        enable_agent_self_validation=modifiers.get("--agent-validation"),
9183b6
     )
9183b6
 
9183b6
     if not modifiers.get("--group"):
9183b6
diff --git a/pcs/usage.py b/pcs/usage.py
9183b6
index 073e2b1e..b2c46669 100644
9183b6
--- a/pcs/usage.py
9183b6
+++ b/pcs/usage.py
9183b6
@@ -680,16 +680,17 @@ _RESOURCE_UPDATE_CMD = "update"
9183b6
 _RESOURCE_UPDATE_SYNTAX = _unwrap(
9183b6
     """
9183b6
     <{obj} id> [{obj} options] [op [<operation action> <operation options>]...]
9183b6
-    [meta <meta operations>...] [--wait[=n]]
9183b6
+    [meta <meta operations>...] [--agent-validation] [--wait[=n]]
9183b6
     """
9183b6
 )
9183b6
 
9183b6
 
9183b6
 def _resource_update_desc_fn(is_stonith: bool) -> Iterable[str]:
9183b6
     if is_stonith:
9183b6
-        obj = obj_long = "stonith device"
9183b6
+        agent_type = "stonith"
9183b6
+        obj = obj_long = f"{agent_type} device"
9183b6
     else:
9183b6
-        obj = "resource"
9183b6
+        obj = agent_type = "resource"
9183b6
         obj_long = "resource, clone or multi-state resource"
9183b6
     return (
9183b6
         f"""
9183b6
@@ -707,6 +708,11 @@ def _resource_update_desc_fn(is_stonith: bool) -> Iterable[str]:
9183b6
          you should use the 'op add' & 'op remove' commands.
9183b6
         """,
9183b6
         "",
9183b6
+        f"""
9183b6
+        If --agent-validation is specified, {agent_type} agent validate-all
9183b6
+        action will be used to validate {obj} options.
9183b6
+        """,
9183b6
+        "",
9183b6
         """
9183b6
         If --wait is specified, pcs will wait up to 'n' seconds for the changes
9183b6
         to take effect and then return 0 if the changes have been processed or
9183b6
@@ -778,7 +784,8 @@ Commands:
9183b6
            [clone [<clone id>] [<clone options>] |
9183b6
            promotable [<clone id>] [<promotable options>] |
9183b6
            --group <group id> [--before <resource id> | --after <resource id>] |
9183b6
-           bundle <bundle id>] [--disabled] [--no-default-ops] [--wait[=n]]
9183b6
+           bundle <bundle id>] [--disabled] [--agent-validation]
9183b6
+           [--no-default-ops] [--wait[=n]]
9183b6
         Create specified resource. If clone is used a clone resource is
9183b6
         created. If promotable is used a promotable clone resource is created.
9183b6
         If --group is specified the resource is added to the group named. You
9183b6
@@ -786,12 +793,13 @@ Commands:
9183b6
         resource relatively to some resource already existing in the group. If
9183b6
         bundle is used, the resource will be created inside of the specified
9183b6
         bundle. If --disabled is specified the resource is not started
9183b6
-        automatically. If --no-default-ops is specified, only monitor
9183b6
-        operations are created for the resource and all other operations use
9183b6
-        default settings. If --wait is specified, pcs will wait up to 'n'
9183b6
-        seconds for the resource to start and then return 0 if the resource is
9183b6
-        started, or 1 if the resource has not yet started. If 'n' is not
9183b6
-        specified it defaults to 60 minutes.
9183b6
+        automatically. If --agent-validation is specified, resource agent
9183b6
+        validate-all action will be used to validate resource options. If
9183b6
+        --no-default-ops is specified, only monitor operations are created for
9183b6
+        the resource and all other operations use default settings. If --wait
9183b6
+        is specified, pcs will wait up to 'n' seconds for the resource to start
9183b6
+        and then return 0 if the resource is started, or 1 if the resource has
9183b6
+        not yet started. If 'n' is not specified it defaults to 60 minutes.
9183b6
         Example: Create a new resource called 'VirtualIP' with IP address
9183b6
             192.168.0.99, netmask of 32, monitored everything 30 seconds,
9183b6
             on eth2:
9183b6
@@ -1844,13 +1852,15 @@ Commands:
9183b6
            [op <operation action> <operation options> [<operation action>
9183b6
            <operation options>]...] [meta <meta options>...]
9183b6
            [--group <group id> [--before <stonith id> | --after <stonith id>]]
9183b6
-           [--disabled] [--wait[=n]]
9183b6
+           [--disabled] [--agent-validation] [--wait[=n]]
9183b6
         Create stonith device with specified type and options.
9183b6
         If --group is specified the stonith device is added to the group named.
9183b6
         You can use --before or --after to specify the position of the added
9183b6
         stonith device relatively to some stonith device already existing in the
9183b6
         group.
9183b6
         If --disabled is specified the stonith device is not used.
9183b6
+        If --agent-validation is specified, stonith agent validate-all action
9183b6
+        will be used to validate stonith device options.
9183b6
         If --wait is specified, pcs will wait up to 'n' seconds for the stonith
9183b6
         device to start and then return 0 if the stonith device is started, or 1
9183b6
         if the stonith device has not yet started.  If 'n' is not specified it
9183b6
diff --git a/pcs_test/tier0/lib/cib/resource/test_primitive_validate.py b/pcs_test/tier0/lib/cib/resource/test_primitive_validate.py
9183b6
index 7a4e5c8f..0438ae5d 100644
9183b6
--- a/pcs_test/tier0/lib/cib/resource/test_primitive_validate.py
9183b6
+++ b/pcs_test/tier0/lib/cib/resource/test_primitive_validate.py
9183b6
@@ -643,6 +643,22 @@ class ValidateResourceInstanceAttributesCreateSelfValidation(TestCase):
9183b6
         self.agent_self_validation_mock.return_value = True, []
9183b6
         self.cmd_runner = mock.Mock()
9183b6
 
9183b6
+    def test_disabled(self):
9183b6
+        attributes = {"required": "value"}
9183b6
+        facade = _fixture_ocf_agent()
9183b6
+        self.assertEqual(
9183b6
+            primitive.validate_resource_instance_attributes_create(
9183b6
+                self.cmd_runner,
9183b6
+                facade,
9183b6
+                attributes,
9183b6
+                etree.Element("resources"),
9183b6
+                force=False,
9183b6
+                enable_agent_self_validation=False,
9183b6
+            ),
9183b6
+            [],
9183b6
+        )
9183b6
+        self.agent_self_validation_mock.assert_not_called()
9183b6
+
9183b6
     def test_success(self):
9183b6
         attributes = {"required": "value"}
9183b6
         facade = _fixture_ocf_agent()
9183b6
@@ -653,6 +669,7 @@ class ValidateResourceInstanceAttributesCreateSelfValidation(TestCase):
9183b6
                 attributes,
9183b6
                 etree.Element("resources"),
9183b6
                 force=False,
9183b6
+                enable_agent_self_validation=True,
9183b6
             ),
9183b6
             [],
9183b6
         )
9183b6
@@ -672,6 +689,7 @@ class ValidateResourceInstanceAttributesCreateSelfValidation(TestCase):
9183b6
                 attributes,
9183b6
                 etree.Element("resources"),
9183b6
                 force=True,
9183b6
+                enable_agent_self_validation=True,
9183b6
             ),
9183b6
             [],
9183b6
         )
9183b6
@@ -693,6 +711,7 @@ class ValidateResourceInstanceAttributesCreateSelfValidation(TestCase):
9183b6
                 attributes,
9183b6
                 etree.Element("resources"),
9183b6
                 force=False,
9183b6
+                enable_agent_self_validation=True,
9183b6
             ),
9183b6
             [
9183b6
                 fixture.error(
9183b6
@@ -718,6 +737,7 @@ class ValidateResourceInstanceAttributesCreateSelfValidation(TestCase):
9183b6
                 attributes,
9183b6
                 etree.Element("resources"),
9183b6
                 force=False,
9183b6
+                enable_agent_self_validation=True,
9183b6
             ),
9183b6
             [],
9183b6
         )
9183b6
@@ -737,6 +757,7 @@ class ValidateResourceInstanceAttributesCreateSelfValidation(TestCase):
9183b6
                 attributes,
9183b6
                 etree.Element("resources"),
9183b6
                 force=False,
9183b6
+                enable_agent_self_validation=True,
9183b6
             ),
9183b6
             [],
9183b6
         )
9183b6
@@ -752,6 +773,7 @@ class ValidateResourceInstanceAttributesCreateSelfValidation(TestCase):
9183b6
                 attributes,
9183b6
                 etree.Element("resources"),
9183b6
                 force=False,
9183b6
+                enable_agent_self_validation=True,
9183b6
             ),
9183b6
             [],
9183b6
         )
9183b6
@@ -767,6 +789,7 @@ class ValidateResourceInstanceAttributesCreateSelfValidation(TestCase):
9183b6
                 attributes,
9183b6
                 etree.Element("resources"),
9183b6
                 force=False,
9183b6
+                enable_agent_self_validation=True,
9183b6
             ),
9183b6
             [
9183b6
                 fixture.error(
9183b6
@@ -1326,6 +1349,24 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
9183b6
             etree.SubElement(nvset_el, "nvpair", dict(name=name, value=value))
9183b6
         return resources_el
9183b6
 
9183b6
+    def test_disabled(self):
9183b6
+        old_attributes = {"required": "old_value"}
9183b6
+        new_attributes = {"required": "new_value"}
9183b6
+        facade = _fixture_ocf_agent()
9183b6
+        self.assertEqual(
9183b6
+            primitive.validate_resource_instance_attributes_update(
9183b6
+                self.cmd_runner,
9183b6
+                facade,
9183b6
+                new_attributes,
9183b6
+                self._NAME,
9183b6
+                self._fixture_resources(old_attributes),
9183b6
+                force=False,
9183b6
+                enable_agent_self_validation=False,
9183b6
+            ),
9183b6
+            [],
9183b6
+        )
9183b6
+        self.agent_self_validation_mock.assert_not_called()
9183b6
+
9183b6
     def test_success(self):
9183b6
         old_attributes = {"required": "old_value"}
9183b6
         new_attributes = {"required": "new_value"}
9183b6
@@ -1338,6 +1379,7 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
9183b6
                 self._NAME,
9183b6
                 self._fixture_resources(old_attributes),
9183b6
                 force=False,
9183b6
+                enable_agent_self_validation=True,
9183b6
             ),
9183b6
             [],
9183b6
         )
9183b6
@@ -1369,6 +1411,7 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
9183b6
                 self._NAME,
9183b6
                 self._fixture_resources(old_attributes),
9183b6
                 force=True,
9183b6
+                enable_agent_self_validation=True,
9183b6
             ),
9183b6
             [],
9183b6
         )
9183b6
@@ -1405,6 +1448,7 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
9183b6
                 self._NAME,
9183b6
                 self._fixture_resources(old_attributes),
9183b6
                 force=False,
9183b6
+                enable_agent_self_validation=True,
9183b6
             ),
9183b6
             [
9183b6
                 fixture.error(
9183b6
@@ -1442,6 +1486,7 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
9183b6
                 self._NAME,
9183b6
                 self._fixture_resources(old_attributes),
9183b6
                 force=False,
9183b6
+                enable_agent_self_validation=True,
9183b6
             ),
9183b6
             [],
9183b6
         )
9183b6
@@ -1473,6 +1518,7 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
9183b6
                 self._NAME,
9183b6
                 self._fixture_resources(old_attributes),
9183b6
                 force=False,
9183b6
+                enable_agent_self_validation=True,
9183b6
             ),
9183b6
             [],
9183b6
         )
9183b6
@@ -1490,6 +1536,7 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
9183b6
                 self._NAME,
9183b6
                 self._fixture_resources(old_attributes),
9183b6
                 force=False,
9183b6
+                enable_agent_self_validation=True,
9183b6
             ),
9183b6
             [],
9183b6
         )
9183b6
@@ -1507,6 +1554,7 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
9183b6
                 self._NAME,
9183b6
                 self._fixture_resources(old_attributes),
9183b6
                 force=False,
9183b6
+                enable_agent_self_validation=True,
9183b6
             ),
9183b6
             [
9183b6
                 fixture.error(
9183b6
@@ -1533,6 +1581,7 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
9183b6
                 self._NAME,
9183b6
                 self._fixture_resources(old_attributes),
9183b6
                 force=False,
9183b6
+                enable_agent_self_validation=True,
9183b6
             ),
9183b6
             [
9183b6
                 fixture.warn(
9183b6
diff --git a/pcs_test/tier0/lib/commands/resource/test_resource_create.py b/pcs_test/tier0/lib/commands/resource/test_resource_create.py
9183b6
index 433a7351..a038d0f5 100644
9183b6
--- a/pcs_test/tier0/lib/commands/resource/test_resource_create.py
9183b6
+++ b/pcs_test/tier0/lib/commands/resource/test_resource_create.py
9183b6
@@ -30,7 +30,9 @@ def create(
9183b6
     allow_invalid_operation=False,
9183b6
     agent_name="ocf:heartbeat:Dummy",
9183b6
     allow_invalid_instance_attributes=False,
9183b6
+    enable_agent_self_validation=False,
9183b6
 ):
9183b6
+    # pylint: disable=too-many-arguments
9183b6
     return resource.create(
9183b6
         env,
9183b6
         "A",
9183b6
@@ -42,6 +44,7 @@ def create(
9183b6
         ensure_disabled=disabled,
9183b6
         allow_invalid_operation=allow_invalid_operation,
9183b6
         allow_invalid_instance_attributes=allow_invalid_instance_attributes,
9183b6
+        enable_agent_self_validation=enable_agent_self_validation,
9183b6
     )
9183b6
 
9183b6
 
9183b6
@@ -51,6 +54,7 @@ def create_group(
9183b6
     disabled=False,
9183b6
     meta_attributes=None,
9183b6
     operation_list=None,
9183b6
+    enable_agent_self_validation=False,
9183b6
 ):
9183b6
     return resource.create_in_group(
9183b6
         env,
9183b6
@@ -62,6 +66,7 @@ def create_group(
9183b6
         instance_attributes={},
9183b6
         wait=wait,
9183b6
         ensure_disabled=disabled,
9183b6
+        enable_agent_self_validation=enable_agent_self_validation,
9183b6
     )
9183b6
 
9183b6
 
9183b6
@@ -75,6 +80,7 @@ def create_clone(
9183b6
     clone_id=None,
9183b6
     agent="ocf:heartbeat:Dummy",
9183b6
     allow_incompatible_clone_meta_attributes=False,
9183b6
+    enable_agent_self_validation=False,
9183b6
 ):
9183b6
     # pylint: disable=too-many-arguments
9183b6
     return resource.create_as_clone(
9183b6
@@ -89,6 +95,7 @@ def create_clone(
9183b6
         wait=wait,
9183b6
         ensure_disabled=disabled,
9183b6
         allow_incompatible_clone_meta_attributes=allow_incompatible_clone_meta_attributes,
9183b6
+        enable_agent_self_validation=enable_agent_self_validation,
9183b6
     )
9183b6
 
9183b6
 
9183b6
@@ -99,6 +106,7 @@ def create_bundle(
9183b6
     meta_attributes=None,
9183b6
     allow_not_accessible_resource=False,
9183b6
     operation_list=None,
9183b6
+    enable_agent_self_validation=False,
9183b6
 ):
9183b6
     return resource.create_into_bundle(
9183b6
         env,
9183b6
@@ -111,6 +119,7 @@ def create_bundle(
9183b6
         wait=wait,
9183b6
         ensure_disabled=disabled,
9183b6
         allow_not_accessible_resource=allow_not_accessible_resource,
9183b6
+        enable_agent_self_validation=enable_agent_self_validation,
9183b6
     )
9183b6
 
9183b6
 
9183b6
@@ -395,13 +404,6 @@ class CreateRolesNormalization(TestCase):
9183b6
             agent_filename=agent_file_name,
9183b6
         )
9183b6
         self.config.runner.cib.load(filename=cib_file)
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation(
9183b6
-            {},
9183b6
-            output="",
9183b6
-            standard="ocf",
9183b6
-            provider="pacemaker",
9183b6
-            agent_type="Stateful",
9183b6
-        )
9183b6
 
9183b6
     def create(self, operation_list=None):
9183b6
         resource.create(
9183b6
@@ -597,7 +599,6 @@ class Create(TestCase):
9183b6
     def test_simplest_resource(self):
9183b6
         self.config.runner.pcmk.load_agent()
9183b6
         self.config.runner.cib.load()
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
9183b6
         self.config.env.push_cib(
9183b6
             resources=fixture_cib_resources_xml_primitive_simplest
9183b6
         )
9183b6
@@ -619,7 +620,9 @@ class Create(TestCase):
9183b6
             returncode=1,
9183b6
         )
9183b6
         self.env_assist.assert_raise_library_error(
9183b6
-            lambda: create(self.env_assist.get_env()),
9183b6
+            lambda: create(
9183b6
+                self.env_assist.get_env(), enable_agent_self_validation=True
9183b6
+            ),
9183b6
         )
9183b6
         self.env_assist.assert_reports(
9183b6
             [
9183b6
@@ -650,7 +653,9 @@ class Create(TestCase):
9183b6
             resources=fixture_cib_resources_xml_primitive_simplest
9183b6
         )
9183b6
         create(
9183b6
-            self.env_assist.get_env(), allow_invalid_instance_attributes=True
9183b6
+            self.env_assist.get_env(),
9183b6
+            allow_invalid_instance_attributes=True,
9183b6
+            enable_agent_self_validation=True,
9183b6
         )
9183b6
         self.env_assist.assert_reports(
9183b6
             [
9183b6
@@ -670,7 +675,10 @@ class Create(TestCase):
9183b6
             returncode=0,
9183b6
         )
9183b6
         self.env_assist.assert_raise_library_error(
9183b6
-            lambda: create(self.env_assist.get_env()),
9183b6
+            lambda: create(
9183b6
+                self.env_assist.get_env(),
9183b6
+                enable_agent_self_validation=True,
9183b6
+            ),
9183b6
         )
9183b6
         self.env_assist.assert_reports(
9183b6
             [
9183b6
@@ -715,7 +723,6 @@ class Create(TestCase):
9183b6
         )
9183b6
         self.config.runner.pcmk.load_agent()
9183b6
         self.config.runner.cib.load()
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
9183b6
         self.config.env.push_cib(
9183b6
             resources=fixture_cib_resources_xml_primitive_simplest
9183b6
         )
9183b6
@@ -878,7 +885,6 @@ class Create(TestCase):
9183b6
     def test_resource_with_operation(self):
9183b6
         self.config.runner.pcmk.load_agent()
9183b6
         self.config.runner.cib.load()
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
9183b6
         self.config.env.push_cib(
9183b6
             resources="""
9183b6
                 <resources>
9183b6
@@ -924,14 +930,12 @@ class Create(TestCase):
9183b6
             ),
9183b6
         )
9183b6
         self.config.runner.cib.load()
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
9183b6
         self.config.env.push_cib(resources=self.fixture_sanitized_operation)
9183b6
         create(self.env_assist.get_env())
9183b6
 
9183b6
     def test_sanitize_operation_id_from_user(self):
9183b6
         self.config.runner.pcmk.load_agent()
9183b6
         self.config.runner.cib.load()
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
9183b6
         self.config.env.push_cib(resources=self.fixture_sanitized_operation)
9183b6
         create(
9183b6
             self.env_assist.get_env(),
9183b6
@@ -1113,9 +1117,6 @@ class Create(TestCase):
9183b6
                 </resources>
9183b6
             """,
9183b6
         )
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation(
9183b6
-            dict(state=1), output=""
9183b6
-        )
9183b6
         self.config.env.push_cib(
9183b6
             resources="""
9183b6
                 <resources>
9183b6
@@ -1201,7 +1202,6 @@ class Create(TestCase):
9183b6
         )
9183b6
         self.config.runner.cib.upgrade()
9183b6
         self.config.runner.cib.load(filename="cib-empty-3.4.xml")
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
9183b6
         self.config.env.push_cib(
9183b6
             resources="""
9183b6
                 <resources>
9183b6
@@ -1257,7 +1257,6 @@ class CreateWait(TestCase):
9183b6
         self.env_assist, self.config = get_env_tools(test_case=self)
9183b6
         self.config.runner.pcmk.load_agent()
9183b6
         self.config.runner.cib.load()
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
9183b6
         self.config.env.push_cib(
9183b6
             resources=fixture_cib_resources_xml_primitive_simplest,
9183b6
             wait=TIMEOUT,
9183b6
@@ -1387,15 +1386,9 @@ class CreateWait(TestCase):
9183b6
 
9183b6
 class CreateInGroup(TestCase):
9183b6
     def setUp(self):
9183b6
-        self.agent_self_validation_call_name = (
9183b6
-            "runner.pcmk.resource_agent_self_validation"
9183b6
-        )
9183b6
         self.env_assist, self.config = get_env_tools(test_case=self)
9183b6
         self.config.runner.pcmk.load_agent()
9183b6
         self.config.runner.cib.load()
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation(
9183b6
-            {}, output="", name=self.agent_self_validation_call_name
9183b6
-        )
9183b6
 
9183b6
     def test_simplest_resource(self):
9183b6
         (
9183b6
@@ -1438,7 +1431,6 @@ class CreateInGroup(TestCase):
9183b6
         create_group(self.env_assist.get_env(), wait=False)
9183b6
 
9183b6
     def test_cib_upgrade_on_onfail_demote(self):
9183b6
-        self.config.remove(self.agent_self_validation_call_name)
9183b6
         self.config.runner.cib.load(
9183b6
             filename="cib-empty-3.3.xml",
9183b6
             instead="runner.cib.load",
9183b6
@@ -1446,7 +1438,6 @@ class CreateInGroup(TestCase):
9183b6
         )
9183b6
         self.config.runner.cib.upgrade()
9183b6
         self.config.runner.cib.load(filename="cib-empty-3.4.xml")
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
9183b6
         self.config.env.push_cib(
9183b6
             resources="""
9183b6
                 <resources>
9183b6
@@ -1498,6 +1489,34 @@ class CreateInGroup(TestCase):
9183b6
             [fixture.info(reports.codes.CIB_UPGRADE_SUCCESSFUL)]
9183b6
         )
9183b6
 
9183b6
+    def test_resource_self_validation_failure(self):
9183b6
+        self.config.runner.pcmk.resource_agent_self_validation(
9183b6
+            {},
9183b6
+            output="""
9183b6
+            <output source="stderr">not ignored</output>
9183b6
+            <output source="stdout">this is ignored</output>
9183b6
+            <output source="stderr">
9183b6
+            first issue
9183b6
+            another one
9183b6
+            </output>
9183b6
+            """,
9183b6
+            returncode=1,
9183b6
+        )
9183b6
+        self.env_assist.assert_raise_library_error(
9183b6
+            lambda: create_group(
9183b6
+                self.env_assist.get_env(), enable_agent_self_validation=True
9183b6
+            ),
9183b6
+        )
9183b6
+        self.env_assist.assert_reports(
9183b6
+            [
9183b6
+                fixture.error(
9183b6
+                    reports.codes.AGENT_SELF_VALIDATION_RESULT,
9183b6
+                    result="not ignored\nfirst issue\nanother one",
9183b6
+                    force_code=reports.codes.FORCE,
9183b6
+                )
9183b6
+            ]
9183b6
+        )
9183b6
+
9183b6
     def test_fail_wait(self):
9183b6
         self.config.env.push_cib(
9183b6
             resources=fixture_cib_resources_xml_group_simplest,
9183b6
@@ -1641,15 +1660,9 @@ class CreateInGroup(TestCase):
9183b6
 
9183b6
 class CreateAsClone(TestCase):
9183b6
     def setUp(self):
9183b6
-        self.agent_self_validation_call_name = (
9183b6
-            "runner.pcmk.resource_agent_self_validation"
9183b6
-        )
9183b6
         self.env_assist, self.config = get_env_tools(test_case=self)
9183b6
         self.config.runner.pcmk.load_agent()
9183b6
         self.config.runner.cib.load()
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation(
9183b6
-            {}, output="", name=self.agent_self_validation_call_name
9183b6
-        )
9183b6
 
9183b6
     def test_simplest_resource(self):
9183b6
         (
9183b6
@@ -1659,6 +1672,34 @@ class CreateAsClone(TestCase):
9183b6
         )
9183b6
         create_clone(self.env_assist.get_env(), wait=False)
9183b6
 
9183b6
+    def test_resource_self_validation_failure(self):
9183b6
+        self.config.runner.pcmk.resource_agent_self_validation(
9183b6
+            {},
9183b6
+            output="""
9183b6
+            <output source="stderr">not ignored</output>
9183b6
+            <output source="stdout">this is ignored</output>
9183b6
+            <output source="stderr">
9183b6
+            first issue
9183b6
+            another one
9183b6
+            </output>
9183b6
+            """,
9183b6
+            returncode=1,
9183b6
+        )
9183b6
+        self.env_assist.assert_raise_library_error(
9183b6
+            lambda: create_clone(
9183b6
+                self.env_assist.get_env(), enable_agent_self_validation=True
9183b6
+            ),
9183b6
+        )
9183b6
+        self.env_assist.assert_reports(
9183b6
+            [
9183b6
+                fixture.error(
9183b6
+                    reports.codes.AGENT_SELF_VALIDATION_RESULT,
9183b6
+                    result="not ignored\nfirst issue\nanother one",
9183b6
+                    force_code=reports.codes.FORCE,
9183b6
+                )
9183b6
+            ]
9183b6
+        )
9183b6
+
9183b6
     def test_custom_clone_id(self):
9183b6
         (
9183b6
             self.config.env.push_cib(
9183b6
@@ -1670,7 +1711,6 @@ class CreateAsClone(TestCase):
9183b6
         )
9183b6
 
9183b6
     def test_custom_clone_id_error_invalid_id(self):
9183b6
-        self.config.remove(self.agent_self_validation_call_name)
9183b6
         self.env_assist.assert_raise_library_error(
9183b6
             lambda: create_clone(
9183b6
                 self.env_assist.get_env(), wait=False, clone_id="1invalid"
9183b6
@@ -1682,7 +1722,6 @@ class CreateAsClone(TestCase):
9183b6
 
9183b6
     def test_custom_clone_id_error_id_already_exist(self):
9183b6
         self.config.remove(name="runner.cib.load")
9183b6
-        self.config.remove(self.agent_self_validation_call_name)
9183b6
         self.config.runner.cib.load(
9183b6
             resources="""
9183b6
                 <resources>
9183b6
@@ -1705,7 +1744,6 @@ class CreateAsClone(TestCase):
9183b6
         self.env_assist.assert_reports([fixture.report_id_already_exist("C")])
9183b6
 
9183b6
     def test_cib_upgrade_on_onfail_demote(self):
9183b6
-        self.config.remove(self.agent_self_validation_call_name)
9183b6
         self.config.runner.cib.load(
9183b6
             filename="cib-empty-3.3.xml",
9183b6
             instead="runner.cib.load",
9183b6
@@ -1713,7 +1751,6 @@ class CreateAsClone(TestCase):
9183b6
         )
9183b6
         self.config.runner.cib.upgrade()
9183b6
         self.config.runner.cib.load(filename="cib-empty-3.4.xml")
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
9183b6
         self.config.env.push_cib(
9183b6
             resources="""<resources>
9183b6
                 <clone id="A-clone">
9183b6
@@ -2198,6 +2235,7 @@ class CreateAsCloneFailures(TestCase):
9183b6
                 agent=agent.full_name,
9183b6
                 clone_options={"promotable": "1"},
9183b6
                 allow_incompatible_clone_meta_attributes=True,
9183b6
+                enable_agent_self_validation=True,
9183b6
             ),
9183b6
         )
9183b6
         self.env_assist.assert_reports(
9183b6
@@ -2363,7 +2401,6 @@ class CreateInToBundle(TestCase):
9183b6
         self.config.runner.cib.load(
9183b6
             filename="cib-empty-3.4.xml", resources=self.fixture_resources_pre
9183b6
         )
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
9183b6
         self.config.env.push_cib(
9183b6
             resources=self.fixture_resource_post_simple_without_network.format(
9183b6
                 network="""
9183b6
@@ -2393,13 +2430,11 @@ class CreateInToBundle(TestCase):
9183b6
 
9183b6
     def test_simplest_resource(self):
9183b6
         self.config.runner.cib.load(resources=self.fixture_resources_pre)
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
9183b6
         self.config.env.push_cib(resources=self.fixture_resources_post_simple)
9183b6
         create_bundle(self.env_assist.get_env(), wait=False)
9183b6
 
9183b6
     def test_bundle_doesnt_exist(self):
9183b6
         self.config.runner.cib.load(resources=self.fixture_empty_resources)
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
9183b6
         self.env_assist.assert_raise_library_error(
9183b6
             lambda: create_bundle(self.env_assist.get_env(), wait=False),
9183b6
             [
9183b6
@@ -2422,7 +2457,6 @@ class CreateInToBundle(TestCase):
9183b6
                     </resources>
9183b6
                 """
9183b6
         )
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
9183b6
 
9183b6
         self.env_assist.assert_raise_library_error(
9183b6
             lambda: create_bundle(self.env_assist.get_env(), wait=False),
9183b6
@@ -2448,7 +2482,6 @@ class CreateInToBundle(TestCase):
9183b6
                     </resources>
9183b6
                 """
9183b6
         )
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
9183b6
         self.env_assist.assert_raise_library_error(
9183b6
             lambda: create_bundle(self.env_assist.get_env(), wait=False),
9183b6
             [
9183b6
@@ -2463,7 +2496,6 @@ class CreateInToBundle(TestCase):
9183b6
 
9183b6
     def test_wait_fail(self):
9183b6
         self.config.runner.cib.load(resources=self.fixture_resources_pre)
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
9183b6
         self.config.env.push_cib(
9183b6
             resources=self.fixture_resources_post_simple,
9183b6
             wait=TIMEOUT,
9183b6
@@ -2488,7 +2520,6 @@ class CreateInToBundle(TestCase):
9183b6
     )
9183b6
     def test_wait_ok_run_ok(self):
9183b6
         self.config.runner.cib.load(resources=self.fixture_resources_pre)
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
9183b6
         self.config.env.push_cib(
9183b6
             resources=self.fixture_resources_post_simple, wait=TIMEOUT
9183b6
         )
9183b6
@@ -2509,7 +2540,6 @@ class CreateInToBundle(TestCase):
9183b6
     )
9183b6
     def test_wait_ok_run_fail(self):
9183b6
         self.config.runner.cib.load(resources=self.fixture_resources_pre)
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
9183b6
         self.config.env.push_cib(
9183b6
             resources=self.fixture_resources_post_simple, wait=TIMEOUT
9183b6
         )
9183b6
@@ -2534,7 +2564,6 @@ class CreateInToBundle(TestCase):
9183b6
     )
9183b6
     def test_disabled_wait_ok_not_running(self):
9183b6
         self.config.runner.cib.load(resources=self.fixture_resources_pre)
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
9183b6
         self.config.env.push_cib(
9183b6
             resources=self.fixture_resources_post_disabled, wait=TIMEOUT
9183b6
         )
9183b6
@@ -2553,7 +2582,6 @@ class CreateInToBundle(TestCase):
9183b6
     )
9183b6
     def test_disabled_wait_ok_running(self):
9183b6
         self.config.runner.cib.load(resources=self.fixture_resources_pre)
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
9183b6
         self.config.env.push_cib(
9183b6
             resources=self.fixture_resources_post_disabled, wait=TIMEOUT
9183b6
         )
9183b6
@@ -2581,7 +2609,6 @@ class CreateInToBundle(TestCase):
9183b6
                 </resources>
9183b6
             """
9183b6
         )
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
9183b6
         self.env_assist.assert_raise_library_error(
9183b6
             lambda: create_bundle(self.env_assist.get_env(), wait=False)
9183b6
         )
9183b6
@@ -2605,7 +2632,6 @@ class CreateInToBundle(TestCase):
9183b6
                 </resources>
9183b6
             """
9183b6
         )
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
9183b6
         self.config.env.push_cib(
9183b6
             resources=(
9183b6
                 self.fixture_resource_post_simple_without_network.format(
9183b6
@@ -2638,7 +2664,6 @@ class CreateInToBundle(TestCase):
9183b6
                 </resources>
9183b6
             """
9183b6
         )
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
9183b6
         self.config.env.push_cib(
9183b6
             resources=(
9183b6
                 self.fixture_resource_post_simple_without_network.format(
9183b6
@@ -2655,3 +2680,32 @@ class CreateInToBundle(TestCase):
9183b6
         self._test_with_network_defined(
9183b6
             '<network ip-range-start="192.168.100.200"/>'
9183b6
         )
9183b6
+
9183b6
+    def test_resource_self_validation_failure(self):
9183b6
+        self.config.runner.cib.load()
9183b6
+        self.config.runner.pcmk.resource_agent_self_validation(
9183b6
+            {},
9183b6
+            output="""
9183b6
+            <output source="stderr">not ignored</output>
9183b6
+            <output source="stdout">this is ignored</output>
9183b6
+            <output source="stderr">
9183b6
+            first issue
9183b6
+            another one
9183b6
+            </output>
9183b6
+            """,
9183b6
+            returncode=1,
9183b6
+        )
9183b6
+        self.env_assist.assert_raise_library_error(
9183b6
+            lambda: create_bundle(
9183b6
+                self.env_assist.get_env(), enable_agent_self_validation=True
9183b6
+            ),
9183b6
+        )
9183b6
+        self.env_assist.assert_reports(
9183b6
+            [
9183b6
+                fixture.error(
9183b6
+                    reports.codes.AGENT_SELF_VALIDATION_RESULT,
9183b6
+                    result="not ignored\nfirst issue\nanother one",
9183b6
+                    force_code=reports.codes.FORCE,
9183b6
+                )
9183b6
+            ]
9183b6
+        )
9183b6
diff --git a/pcs_test/tier0/lib/commands/test_booth.py b/pcs_test/tier0/lib/commands/test_booth.py
9183b6
index 220d058f..e0b6924e 100644
9183b6
--- a/pcs_test/tier0/lib/commands/test_booth.py
9183b6
+++ b/pcs_test/tier0/lib/commands/test_booth.py
9183b6
@@ -1754,30 +1754,10 @@ class CreateInCluster(TestCase, FixtureMixin):
9183b6
             agent_name="ocf:heartbeat:IPaddr2",
9183b6
             name="runner.pcmk.load_agent.ipaddr2",
9183b6
         )
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation(
9183b6
-            dict(ip=self.site_ip),
9183b6
-            standard="ocf",
9183b6
-            provider="heartbeat",
9183b6
-            agent_type="IPaddr2",
9183b6
-            output="",
9183b6
-        )
9183b6
         self.config.runner.pcmk.load_agent(
9183b6
             agent_name="ocf:pacemaker:booth-site",
9183b6
             name="runner.pcmk.load_agent.booth-site",
9183b6
         )
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation(
9183b6
-            dict(
9183b6
-                config=os.path.join(
9183b6
-                    settings.booth_config_dir,
9183b6
-                    f"{instance_name}.conf",
9183b6
-                )
9183b6
-            ),
9183b6
-            standard="ocf",
9183b6
-            provider="pacemaker",
9183b6
-            agent_type="booth-site",
9183b6
-            output="",
9183b6
-            name="runner.pcmk.agent_self_validation.booth-site",
9183b6
-        )
9183b6
         self.config.env.push_cib(
9183b6
             resources=self.fixture_cib_booth_group(instance_name)
9183b6
         )
9183b6
@@ -1809,33 +1789,11 @@ class CreateInCluster(TestCase, FixtureMixin):
9183b6
             name="runner.pcmk.load_agent.ipaddr2",
9183b6
             env=env,
9183b6
         )
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation(
9183b6
-            dict(ip=self.site_ip),
9183b6
-            standard="ocf",
9183b6
-            provider="heartbeat",
9183b6
-            agent_type="IPaddr2",
9183b6
-            output="",
9183b6
-            env=env,
9183b6
-        )
9183b6
         self.config.runner.pcmk.load_agent(
9183b6
             agent_name="ocf:pacemaker:booth-site",
9183b6
             name="runner.pcmk.load_agent.booth-site",
9183b6
             env=env,
9183b6
         )
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation(
9183b6
-            dict(
9183b6
-                config=os.path.join(
9183b6
-                    settings.booth_config_dir,
9183b6
-                    f"{constants.DEFAULT_INSTANCE_NAME}.conf",
9183b6
-                )
9183b6
-            ),
9183b6
-            standard="ocf",
9183b6
-            provider="pacemaker",
9183b6
-            agent_type="booth-site",
9183b6
-            output="",
9183b6
-            env=env,
9183b6
-            name="runner.pcmk.agent_self_validation.booth-site",
9183b6
-        )
9183b6
         self.config.env.push_cib(resources=self.fixture_cib_booth_group())
9183b6
         commands.create_in_cluster(self.env_assist.get_env(), self.site_ip)
9183b6
 
9183b6
@@ -1943,13 +1901,6 @@ class CreateInCluster(TestCase, FixtureMixin):
9183b6
             agent_name="ocf:heartbeat:IPaddr2",
9183b6
             name="runner.pcmk.load_agent.ipaddr2",
9183b6
         )
9183b6
-        self.config.runner.pcmk.resource_agent_self_validation(
9183b6
-            dict(ip=self.site_ip),
9183b6
-            standard="ocf",
9183b6
-            provider="heartbeat",
9183b6
-            agent_type="IPaddr2",
9183b6
-            output="",
9183b6
-        )
9183b6
         self.config.runner.pcmk.load_agent(
9183b6
             agent_name="ocf:pacemaker:booth-site",
9183b6
             agent_is_missing=True,
9183b6
diff --git a/pcs_test/tier0/lib/commands/test_stonith.py b/pcs_test/tier0/lib/commands/test_stonith.py
9183b6
index 65a0608f..eedd1c04 100644
9183b6
--- a/pcs_test/tier0/lib/commands/test_stonith.py
9183b6
+++ b/pcs_test/tier0/lib/commands/test_stonith.py
9183b6
@@ -108,9 +108,6 @@ class CreateMixin:
9183b6
         )
9183b6
         self.config.runner.pcmk.load_fake_agent_metadata()
9183b6
         self.config.runner.cib.load()
9183b6
-        self.config.runner.pcmk.stonith_agent_self_validation(
9183b6
-            instance_attributes, agent_name, output=""
9183b6
-        )
9183b6
         self.config.env.push_cib(
9183b6
             resources=self._expected_cib(expected_cib_simple)
9183b6
         )
9183b6
@@ -158,6 +155,7 @@ class CreateMixin:
9183b6
                 operations=[],
9183b6
                 meta_attributes={},
9183b6
                 instance_attributes=instance_attributes,
9183b6
+                enable_agent_self_validation=True,
9183b6
             ),
9183b6
         )
9183b6
         self.env_assist.assert_reports(
9183b6
@@ -208,6 +206,7 @@ class CreateMixin:
9183b6
             meta_attributes={},
9183b6
             instance_attributes=instance_attributes,
9183b6
             allow_invalid_instance_attributes=True,
9183b6
+            enable_agent_self_validation=True,
9183b6
         )
9183b6
         self.env_assist.assert_reports(
9183b6
             [
9183b6
@@ -245,6 +244,7 @@ class CreateMixin:
9183b6
                 operations=[],
9183b6
                 meta_attributes={},
9183b6
                 instance_attributes=instance_attributes,
9183b6
+                enable_agent_self_validation=True,
9183b6
             ),
9183b6
         )
9183b6
         self.env_assist.assert_reports(
9183b6
@@ -266,9 +266,6 @@ class CreateMixin:
9183b6
         )
9183b6
         self.config.runner.pcmk.load_fake_agent_metadata()
9183b6
         self.config.runner.cib.load()
9183b6
-        self.config.runner.pcmk.stonith_agent_self_validation(
9183b6
-            {}, agent_name, output=""
9183b6
-        )
9183b6
         self.config.env.push_cib(
9183b6
             resources=self._expected_cib(expected_cib_unfencing)
9183b6
         )
9183b6
@@ -306,9 +303,6 @@ class CreateMixin:
9183b6
         )
9183b6
         self.config.runner.pcmk.load_fake_agent_metadata()
9183b6
         self.config.runner.cib.load()
9183b6
-        self.config.runner.pcmk.stonith_agent_self_validation(
9183b6
-            instance_attributes, agent_name, output=""
9183b6
-        )
9183b6
         self.config.env.push_cib(resources=self._expected_cib(expected_cib))
9183b6
 
9183b6
         self._create(
9183b6
@@ -334,9 +328,6 @@ class CreateMixin:
9183b6
         )
9183b6
         self.config.runner.pcmk.load_fake_agent_metadata()
9183b6
         self.config.runner.cib.load()
9183b6
-        self.config.runner.pcmk.stonith_agent_self_validation(
9183b6
-            {}, agent_name, output=""
9183b6
-        )
9183b6
         self.config.env.push_cib(
9183b6
             resources=self._expected_cib(expected_cib_operations)
9183b6
         )
9183b6
@@ -395,9 +386,6 @@ class CreateMixin:
9183b6
         )
9183b6
         self.config.runner.pcmk.load_fake_agent_metadata()
9183b6
         self.config.runner.cib.load()
9183b6
-        self.config.runner.pcmk.stonith_agent_self_validation(
9183b6
-            instance_attributes, agent_name, output=""
9183b6
-        )
9183b6
         self.config.env.push_cib(
9183b6
             resources=self._expected_cib(expected_cib_simple_forced)
9183b6
         )
9183b6
@@ -611,9 +599,6 @@ class CreateMixin:
9183b6
         )
9183b6
         self.config.runner.pcmk.load_fake_agent_metadata()
9183b6
         self.config.runner.cib.load()
9183b6
-        self.config.runner.pcmk.stonith_agent_self_validation(
9183b6
-            instance_attributes, agent_name, output=""
9183b6
-        )
9183b6
         self.config.env.push_cib(
9183b6
             resources=self._expected_cib(expected_cib_simple), wait=timeout
9183b6
         )
9183b6
@@ -727,9 +712,6 @@ class CreateInGroup(CreateMixin, TestCase):
9183b6
         )
9183b6
         self.config.runner.pcmk.load_fake_agent_metadata()
9183b6
         self.config.runner.cib.load(resources=original_cib)
9183b6
-        self.config.runner.pcmk.stonith_agent_self_validation(
9183b6
-            instance_attributes, agent_name, output=""
9183b6
-        )
9183b6
         self.config.env.push_cib(resources=expected_cib)
9183b6
 
9183b6
         stonith.create_in_group(
9183b6
diff --git a/pcs_test/tier1/cib_resource/test_create.py b/pcs_test/tier1/cib_resource/test_create.py
9183b6
index 3a088513..bbc1acaa 100644
9183b6
--- a/pcs_test/tier1/cib_resource/test_create.py
9183b6
+++ b/pcs_test/tier1/cib_resource/test_create.py
9183b6
@@ -751,7 +751,9 @@ class Promotable(TestCase, AssertPcsMixin):
9183b6
         ensure_disabled=False,
9183b6
         use_default_operations=True,
9183b6
         wait=False,
9183b6
+        enable_agent_self_validation=False,
9183b6
     ):
9183b6
+        # pylint: disable=too-many-arguments
9183b6
         options = locals()
9183b6
         del options["self"]
9183b6
         return options
9183b6
diff --git a/pcs_test/tier1/cib_resource/test_stonith_create.py b/pcs_test/tier1/cib_resource/test_stonith_create.py
9183b6
index 77277b75..ea429b64 100644
9183b6
--- a/pcs_test/tier1/cib_resource/test_stonith_create.py
9183b6
+++ b/pcs_test/tier1/cib_resource/test_stonith_create.py
9183b6
@@ -45,7 +45,6 @@ class PlainStonith(ResourceTest):
9183b6
                     </operations>
9183b6
                 </primitive>
9183b6
             </resources>""",
9183b6
-            output_start="Warning: Validation result from agent:",
9183b6
         )
9183b6
 
9183b6
     def test_error_when_not_valid_name(self):
9183b6
@@ -249,7 +248,6 @@ class WithMeta(ResourceTest):
9183b6
                     </operations>
9183b6
                 </primitive>
9183b6
             </resources>""",
9183b6
-            output_start="Warning: Validation result from agent:",
9183b6
         )
9183b6
 
9183b6
 
9183b6
diff --git a/pcs_test/tier1/legacy/test_resource.py b/pcs_test/tier1/legacy/test_resource.py
9183b6
index 3ba32ec7..d53af88b 100644
9183b6
--- a/pcs_test/tier1/legacy/test_resource.py
9183b6
+++ b/pcs_test/tier1/legacy/test_resource.py
9183b6
@@ -5906,7 +5906,13 @@ class UpdateInstanceAttrs(
9183b6
     def test_agent_self_validation_failure(self):
9183b6
         self.fixture_resource()
9183b6
         self.assert_pcs_fail(
9183b6
-            ["resource", "update", "R", "fake=is_invalid=True"],
9183b6
+            [
9183b6
+                "resource",
9183b6
+                "update",
9183b6
+                "R",
9183b6
+                "fake=is_invalid=True",
9183b6
+                "--agent-validation",
9183b6
+            ],
9183b6
             stdout_start="Error: Validation result from agent (use --force to override):",
9183b6
         )
9183b6
 
9183b6
diff --git a/pcs_test/tier1/legacy/test_stonith.py b/pcs_test/tier1/legacy/test_stonith.py
9183b6
index 7e7ec030..8ca84065 100644
9183b6
--- a/pcs_test/tier1/legacy/test_stonith.py
9183b6
+++ b/pcs_test/tier1/legacy/test_stonith.py
9183b6
@@ -1283,6 +1283,27 @@ class StonithTest(TestCase, AssertPcsMixin):
9183b6
             "Deleting Resource - apc-fencing\n",
9183b6
         )
9183b6
 
9183b6
+        self.assert_pcs_fail(
9183b6
+            (
9183b6
+                "stonith create apc-fencing fence_apc ip=morph-apc username=apc "
9183b6
+                "--agent-validation"
9183b6
+            ).split(),
9183b6
+            stdout_start="Error: Validation result from agent",
9183b6
+        )
9183b6
+
9183b6
+        self.assert_pcs_success(
9183b6
+            (
9183b6
+                "stonith create apc-fencing fence_apc ip=morph-apc username=apc "
9183b6
+                "--agent-validation --force"
9183b6
+            ).split(),
9183b6
+            stdout_start="Warning: Validation result from agent",
9183b6
+        )
9183b6
+
9183b6
+        self.assert_pcs_success(
9183b6
+            "stonith remove apc-fencing".split(),
9183b6
+            stdout_full="Deleting Resource - apc-fencing\n",
9183b6
+        )
9183b6
+
9183b6
         self.assert_pcs_fail(
9183b6
             "stonith update test3 bad_ipaddr=test username=login".split(),
9183b6
             stdout_regexp=(
9183b6
@@ -1292,8 +1313,8 @@ class StonithTest(TestCase, AssertPcsMixin):
9183b6
         )
9183b6
 
9183b6
         self.assert_pcs_success(
9183b6
-            "stonith update test3 username=testA".split(),
9183b6
-            stdout_start="Warning: ",
9183b6
+            "stonith update test3 username=testA --agent-validation".split(),
9183b6
+            stdout_start="Warning: The resource was misconfigured before the update,",
9183b6
         )
9183b6
 
9183b6
         self.assert_pcs_success(
9183b6
-- 
9183b6
2.39.0
9183b6