Blame SOURCES/bz2159455-01-add-agent-validation-option.patch

3362d5
From 537d18f785edfffb7505510ef309cbd4c31bb914 Mon Sep 17 00:00:00 2001
3362d5
From: Ondrej Mular <omular@redhat.com>
3362d5
Date: Thu, 12 Jan 2023 14:14:26 +0100
3362d5
Subject: [PATCH 1/2] add '--agent-validation' option for enabling agent
3362d5
 self-validation feature
3362d5
3362d5
---
3362d5
 pcs/cli/common/parse_args.py                  |   3 +
3362d5
 pcs/lib/cib/resource/primitive.py             |  12 +-
3362d5
 pcs/lib/cib/resource/remote_node.py           |   1 +
3362d5
 pcs/lib/commands/booth.py                     |   1 +
3362d5
 pcs/lib/commands/resource.py                  |  16 ++
3362d5
 pcs/lib/commands/stonith.py                   |   8 +
3362d5
 pcs/pcs.8.in                                  |  16 +-
3362d5
 pcs/resource.py                               |  13 +-
3362d5
 pcs/stonith.py                                |   3 +
3362d5
 pcs/usage.py                                  |  31 ++--
3362d5
 .../cib/resource/test_primitive_validate.py   |  49 ++++++
3362d5
 .../commands/resource/test_resource_create.py | 155 ++++++++++++------
3362d5
 pcs_test/tier0/lib/commands/test_booth.py     |  49 ------
3362d5
 pcs_test/tier0/lib/commands/test_stonith.py   |  24 +--
3362d5
 pcs_test/tier1/cib_resource/test_create.py    |   2 +
3362d5
 .../tier1/cib_resource/test_stonith_create.py |   2 -
3362d5
 pcs_test/tier1/legacy/test_resource.py        |   8 +-
3362d5
 pcs_test/tier1/legacy/test_stonith.py         |  25 ++-
3362d5
 18 files changed, 272 insertions(+), 146 deletions(-)
3362d5
3362d5
diff --git a/pcs/cli/common/parse_args.py b/pcs/cli/common/parse_args.py
3362d5
index 0a43deec..a16d882e 100644
3362d5
--- a/pcs/cli/common/parse_args.py
3362d5
+++ b/pcs/cli/common/parse_args.py
3362d5
@@ -94,6 +94,8 @@ PCS_LONG_OPTIONS = [
3362d5
     f"{_OUTPUT_FORMAT_OPTION_STR}=",
3362d5
     # auth token
3362d5
     "token=",
3362d5
+    # enable agent self validation
3362d5
+    "agent-validation",
3362d5
 ]
3362d5
 
3362d5
 
3362d5
@@ -485,6 +487,7 @@ class InputModifiers:
3362d5
             {
3362d5
                 # boolean values
3362d5
                 "--all": "--all" in options,
3362d5
+                "--agent-validation": "--agent-validation" in options,
3362d5
                 "--autodelete": "--autodelete" in options,
3362d5
                 "--brief": "--brief" in options,
3362d5
                 "--config": "--config" in options,
3362d5
diff --git a/pcs/lib/cib/resource/primitive.py b/pcs/lib/cib/resource/primitive.py
3362d5
index c5df8e58..5a6e1e0d 100644
3362d5
--- a/pcs/lib/cib/resource/primitive.py
3362d5
+++ b/pcs/lib/cib/resource/primitive.py
3362d5
@@ -137,6 +137,7 @@ def create(
3362d5
     resource_type: str = "resource",
3362d5
     # TODO remove this arg
3362d5
     do_not_report_instance_attribute_server_exists: bool = False,
3362d5
+    enable_agent_self_validation: bool = False,
3362d5
 ):
3362d5
     # pylint: disable=too-many-arguments
3362d5
     # pylint: disable=too-many-locals
3362d5
@@ -159,6 +160,8 @@ def create(
3362d5
     resource_type -- describes the resource for reports
3362d5
     do_not_report_instance_attribute_server_exists -- dirty fix due to
3362d5
         suboptimal architecture, TODO: fix the architecture and remove the param
3362d5
+    enable_agent_self_validation -- if True, use agent self-validation feature
3362d5
+        to validate instance attributes
3362d5
     """
3362d5
     if raw_operation_list is None:
3362d5
         raw_operation_list = []
3362d5
@@ -200,6 +203,7 @@ def create(
3362d5
         instance_attributes,
3362d5
         resources_section,
3362d5
         force=allow_invalid_instance_attributes,
3362d5
+        enable_agent_self_validation=enable_agent_self_validation,
3362d5
     )
3362d5
     # TODO remove this "if", see pcs.lib.cib.remote_node.create for details
3362d5
     if do_not_report_instance_attribute_server_exists:
3362d5
@@ -388,6 +392,7 @@ def validate_resource_instance_attributes_create(
3362d5
     instance_attributes: Mapping[str, str],
3362d5
     resources_section: _Element,
3362d5
     force: bool = False,
3362d5
+    enable_agent_self_validation: bool = False,
3362d5
 ) -> reports.ReportItemList:
3362d5
     report_items: reports.ReportItemList = []
3362d5
     agent_name = resource_agent.metadata.name
3362d5
@@ -419,7 +424,8 @@ def validate_resource_instance_attributes_create(
3362d5
         )
3362d5
 
3362d5
     if (
3362d5
-        _is_ocf_or_stonith_agent(agent_name)
3362d5
+        enable_agent_self_validation
3362d5
+        and _is_ocf_or_stonith_agent(agent_name)
3362d5
         and resource_agent.metadata.agent_exists
3362d5
         and resource_agent.metadata.provides_self_validation
3362d5
         and not any(
3362d5
@@ -447,6 +453,7 @@ def validate_resource_instance_attributes_update(
3362d5
     resource_id: str,
3362d5
     resources_section: _Element,
3362d5
     force: bool = False,
3362d5
+    enable_agent_self_validation: bool = False,
3362d5
 ) -> reports.ReportItemList:
3362d5
     # pylint: disable=too-many-locals
3362d5
     # TODO This function currently accepts the updated resource as a string and
3362d5
@@ -521,7 +528,8 @@ def validate_resource_instance_attributes_update(
3362d5
         )
3362d5
 
3362d5
     if (
3362d5
-        _is_ocf_or_stonith_agent(agent_name)
3362d5
+        enable_agent_self_validation
3362d5
+        and _is_ocf_or_stonith_agent(agent_name)
3362d5
         and resource_agent.metadata.agent_exists
3362d5
         and resource_agent.metadata.provides_self_validation
3362d5
         and not any(
3362d5
diff --git a/pcs/lib/cib/resource/remote_node.py b/pcs/lib/cib/resource/remote_node.py
3362d5
index c76e37a6..f65c5446 100644
3362d5
--- a/pcs/lib/cib/resource/remote_node.py
3362d5
+++ b/pcs/lib/cib/resource/remote_node.py
3362d5
@@ -253,4 +253,5 @@ def create(
3362d5
         # 3) call the validation from here and handle the results or config
3362d5
         #    the validator before / when running it
3362d5
         do_not_report_instance_attribute_server_exists=True,
3362d5
+        enable_agent_self_validation=False,
3362d5
     )
3362d5
diff --git a/pcs/lib/commands/booth.py b/pcs/lib/commands/booth.py
3362d5
index ee91ea14..7b0ed4de 100644
3362d5
--- a/pcs/lib/commands/booth.py
3362d5
+++ b/pcs/lib/commands/booth.py
3362d5
@@ -480,6 +480,7 @@ def create_in_cluster(
3362d5
         env.cmd_runner(),
3362d5
         resources_section,
3362d5
         id_provider,
3362d5
+        enable_agent_self_validation=False,
3362d5
     )
3362d5
     agent_factory = ResourceAgentFacadeFactory(
3362d5
         env.cmd_runner(), report_processor
3362d5
diff --git a/pcs/lib/commands/resource.py b/pcs/lib/commands/resource.py
3362d5
index 28407d48..12b1f0e9 100644
3362d5
--- a/pcs/lib/commands/resource.py
3362d5
+++ b/pcs/lib/commands/resource.py
3362d5
@@ -348,6 +348,7 @@ def create(
3362d5
     ensure_disabled: bool = False,
3362d5
     wait: WaitType = False,
3362d5
     allow_not_suitable_command: bool = False,
3362d5
+    enable_agent_self_validation: bool = False,
3362d5
 ):
3362d5
     # pylint: disable=too-many-arguments, too-many-locals
3362d5
     """
3362d5
@@ -381,6 +382,8 @@ def create(
3362d5
         pcs.lib.commands.remote_node);
3362d5
         in the case of remote/guest node forcible error is produced when this
3362d5
         flag is set to False and warning is produced otherwise
3362d5
+    enable_agent_self_validation -- if True, use agent self-validation feature
3362d5
+        to validate instance attributes
3362d5
     """
3362d5
     runner = env.cmd_runner()
3362d5
     agent_factory = ResourceAgentFacadeFactory(runner, env.report_processor)
3362d5
@@ -427,6 +430,7 @@ def create(
3362d5
             allow_invalid_operation,
3362d5
             allow_invalid_instance_attributes,
3362d5
             use_default_operations,
3362d5
+            enable_agent_self_validation=enable_agent_self_validation,
3362d5
         )
3362d5
         if env.report_processor.has_errors:
3362d5
             raise LibraryError()
3362d5
@@ -451,6 +455,7 @@ def create_as_clone(
3362d5
     ensure_disabled: bool = False,
3362d5
     wait: WaitType = False,
3362d5
     allow_not_suitable_command: bool = False,
3362d5
+    enable_agent_self_validation: bool = False,
3362d5
 ):
3362d5
     # pylint: disable=too-many-arguments, too-many-locals
3362d5
     """
3362d5
@@ -478,6 +483,8 @@ def create_as_clone(
3362d5
     ensure_disabled -- is flag that keeps resource in target-role "Stopped"
3362d5
     wait -- is flag for controlling waiting for pacemaker idle mechanism
3362d5
     allow_not_suitable_command -- turn forceable errors into warnings
3362d5
+    enable_agent_self_validation -- if True, use agent self-validation feature
3362d5
+        to validate instance attributes
3362d5
     """
3362d5
     runner = env.cmd_runner()
3362d5
     agent_factory = ResourceAgentFacadeFactory(runner, env.report_processor)
3362d5
@@ -531,6 +538,7 @@ def create_as_clone(
3362d5
             allow_invalid_operation,
3362d5
             allow_invalid_instance_attributes,
3362d5
             use_default_operations,
3362d5
+            enable_agent_self_validation=enable_agent_self_validation,
3362d5
         )
3362d5
 
3362d5
         clone_element = resource.clone.append_new(
3362d5
@@ -561,6 +569,7 @@ def create_in_group(
3362d5
     put_after_adjacent: bool = False,
3362d5
     wait: WaitType = False,
3362d5
     allow_not_suitable_command: bool = False,
3362d5
+    enable_agent_self_validation: bool = False,
3362d5
 ):
3362d5
     # pylint: disable=too-many-arguments, too-many-locals
3362d5
     """
3362d5
@@ -589,6 +598,8 @@ def create_in_group(
3362d5
         adjacent resource
3362d5
     wait -- is flag for controlling waiting for pacemaker idle mechanism
3362d5
     allow_not_suitable_command -- turn forceable errors into warnings
3362d5
+    enable_agent_self_validation -- if True, use agent self-validation feature
3362d5
+        to validate instance attributes
3362d5
     """
3362d5
     runner = env.cmd_runner()
3362d5
     agent_factory = ResourceAgentFacadeFactory(runner, env.report_processor)
3362d5
@@ -664,6 +675,7 @@ def create_in_group(
3362d5
             allow_invalid_operation,
3362d5
             allow_invalid_instance_attributes,
3362d5
             use_default_operations,
3362d5
+            enable_agent_self_validation=enable_agent_self_validation,
3362d5
         )
3362d5
         if ensure_disabled:
3362d5
             resource.common.disable(primitive_element, id_provider)
3362d5
@@ -701,6 +713,7 @@ def create_into_bundle(
3362d5
     wait: WaitType = False,
3362d5
     allow_not_suitable_command: bool = False,
3362d5
     allow_not_accessible_resource: bool = False,
3362d5
+    enable_agent_self_validation: bool = False,
3362d5
 ):
3362d5
     # pylint: disable=too-many-arguments, too-many-locals
3362d5
     """
3362d5
@@ -728,6 +741,8 @@ def create_into_bundle(
3362d5
     wait -- is flag for controlling waiting for pacemaker idle mechanism
3362d5
     allow_not_suitable_command -- turn forceable errors into warnings
3362d5
     allow_not_accessible_resource -- turn forceable errors into warnings
3362d5
+    enable_agent_self_validation -- if True, use agent self-validation feature
3362d5
+        to validate instance attributes
3362d5
     """
3362d5
     runner = env.cmd_runner()
3362d5
     agent_factory = ResourceAgentFacadeFactory(runner, env.report_processor)
3362d5
@@ -775,6 +790,7 @@ def create_into_bundle(
3362d5
             allow_invalid_operation,
3362d5
             allow_invalid_instance_attributes,
3362d5
             use_default_operations,
3362d5
+            enable_agent_self_validation=enable_agent_self_validation,
3362d5
         )
3362d5
         if ensure_disabled:
3362d5
             resource.common.disable(primitive_element, id_provider)
3362d5
diff --git a/pcs/lib/commands/stonith.py b/pcs/lib/commands/stonith.py
3362d5
index 15b10dec..fc0264e7 100644
3362d5
--- a/pcs/lib/commands/stonith.py
3362d5
+++ b/pcs/lib/commands/stonith.py
3362d5
@@ -117,6 +117,7 @@ def create(
3362d5
     use_default_operations: bool = True,
3362d5
     ensure_disabled: bool = False,
3362d5
     wait: WaitType = False,
3362d5
+    enable_agent_self_validation: bool = False,
3362d5
 ):
3362d5
     # pylint: disable=too-many-arguments, too-many-locals
3362d5
     """
3362d5
@@ -139,6 +140,8 @@ def create(
3362d5
         operations (specified in a stonith agent)
3362d5
     ensure_disabled -- flag that keeps resource in target-role "Stopped"
3362d5
     wait -- flag for controlling waiting for pacemaker idle mechanism
3362d5
+    enable_agent_self_validation -- if True, use agent self-validation feature
3362d5
+        to validate instance attributes
3362d5
     """
3362d5
     runner = env.cmd_runner()
3362d5
     agent_factory = ResourceAgentFacadeFactory(runner, env.report_processor)
3362d5
@@ -174,6 +177,7 @@ def create(
3362d5
             allow_invalid_instance_attributes=allow_invalid_instance_attributes,
3362d5
             use_default_operations=use_default_operations,
3362d5
             resource_type="stonith",
3362d5
+            enable_agent_self_validation=enable_agent_self_validation,
3362d5
         )
3362d5
         if ensure_disabled:
3362d5
             resource.common.disable(stonith_element, id_provider)
3362d5
@@ -195,6 +199,7 @@ def create_in_group(
3362d5
     adjacent_resource_id: Optional[str] = None,
3362d5
     put_after_adjacent: bool = False,
3362d5
     wait: WaitType = False,
3362d5
+    enable_agent_self_validation: bool = False,
3362d5
 ):
3362d5
     # pylint: disable=too-many-arguments, too-many-locals
3362d5
     """
3362d5
@@ -221,6 +226,8 @@ def create_in_group(
3362d5
     put_after_adjacent -- is flag to put a newly create resource befor/after
3362d5
         adjacent stonith
3362d5
     wait -- flag for controlling waiting for pacemaker idle mechanism
3362d5
+    enable_agent_self_validation -- if True, use agent self-validation feature
3362d5
+        to validate instance attributes
3362d5
     """
3362d5
     runner = env.cmd_runner()
3362d5
     agent_factory = ResourceAgentFacadeFactory(runner, env.report_processor)
3362d5
@@ -286,6 +293,7 @@ def create_in_group(
3362d5
             allow_invalid_operation,
3362d5
             allow_invalid_instance_attributes,
3362d5
             use_default_operations,
3362d5
+            enable_agent_self_validation=enable_agent_self_validation,
3362d5
         )
3362d5
         if ensure_disabled:
3362d5
             resource.common.disable(stonith_element, id_provider)
3362d5
diff --git a/pcs/pcs.8.in b/pcs/pcs.8.in
3362d5
index cd00f8ac..6f7fe9cc 100644
3362d5
--- a/pcs/pcs.8.in
3362d5
+++ b/pcs/pcs.8.in
3362d5
@@ -95,8 +95,8 @@ Show list of all available resource agents (if filter is provided then only reso
3362d5
 describe [<standard>:[<provider>:]]<type> [\fB\-\-full\fR]
3362d5
 Show options for the specified resource. If \fB\-\-full\fR is specified, all options including advanced and deprecated ones are shown.
3362d5
 .TP
3362d5
-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]]
3362d5
-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.
3362d5
+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]]
3362d5
+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.
3362d5
 
3362d5
 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
3362d5
 .TP
3362d5
@@ -183,11 +183,13 @@ List available OCF resource agent providers.
3362d5
 agents [standard[:provider]]
3362d5
 List available agents optionally filtered by standard and provider.
3362d5
 .TP
3362d5
-update <resource id> [resource options] [op [<operation action> <operation options>]...] [meta <meta operations>...] [\fB\-\-wait\fR[=n]]
3362d5
+update <resource id> [resource options] [op [<operation action> <operation options>]...] [meta <meta operations>...] [\fB\-\-agent\-validation\fR] [\fB\-\-wait\fR[=n]]
3362d5
 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='.
3362d5
 
3362d5
 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.
3362d5
 
3362d5
+If \fB\-\-agent\-validation\fR is specified, resource agent validate\-all action will be used to validate resource options.
3362d5
+
3362d5
 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.
3362d5
 .TP
3362d5
 op add <resource id> <operation action> [operation properties]
3362d5
@@ -670,8 +672,8 @@ Show list of all available stonith agents (if filter is provided then only stoni
3362d5
 describe <stonith agent> [\fB\-\-full\fR]
3362d5
 Show options for specified stonith agent. If \fB\-\-full\fR is specified, all options including advanced and deprecated ones are shown.
3362d5
 .TP
3362d5
-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]]
3362d5
-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.
3362d5
+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]]
3362d5
+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.
3362d5
 
3362d5
 Example: Create a device for nodes node1 and node2
3362d5
 .br
3362d5
@@ -681,8 +683,10 @@ Example: Use port p1 for node n1 and ports p2 and p3 for node n2
3362d5
 .br
3362d5
 pcs stonith create MyFence fence_virt 'pcmk_host_map=n1:p1;n2:p2,p3'
3362d5
 .TP
3362d5
-update <stonith id> [stonith device options]
3362d5
+update <stonith id> [stonith device options] [\fB\-\-agent\-validation\fR]
3362d5
 Add, remove or change options of specified stonith id. Unspecified options will be kept unchanged. If you wish to remove an option, set it to empty value, i.e. 'option_name='.
3362d5
+
3362d5
+If \fB\-\-agent\-validation\fR is specified, stonith agent validate\-all action will be used to validate stonith device options.
3362d5
 .TP
3362d5
 update\-scsi\-devices <stonith id> (set <device\-path> [<device\-path>...]) | (add <device\-path> [<device\-path>...] delete|remove <device\-path> [<device\-path>...] )
3362d5
 Update scsi fencing devices without affecting other resources. You must specify either list of set devices or at least one device for add or delete/remove devices. Stonith resource must be running on one cluster node. Each device will be unfenced on each cluster node running cluster. Supported fence agents: fence_scsi, fence_mpath.
3362d5
diff --git a/pcs/resource.py b/pcs/resource.py
3362d5
index bf34e8d7..7500b37e 100644
3362d5
--- a/pcs/resource.py
3362d5
+++ b/pcs/resource.py
3362d5
@@ -580,6 +580,7 @@ def _format_desc(indentation, desc):
3362d5
 def resource_create(lib, argv, modifiers):
3362d5
     """
3362d5
     Options:
3362d5
+      * --agent-validation - use agent self validation of instance attributes
3362d5
       * --before - specified resource inside a group before which new resource
3362d5
         will be placed inside the group
3362d5
       * --after - specified resource inside a group after which new resource
3362d5
@@ -593,6 +594,7 @@ def resource_create(lib, argv, modifiers):
3362d5
       * -f - CIB file
3362d5
     """
3362d5
     modifiers.ensure_only_supported(
3362d5
+        "--agent-validation",
3362d5
         "--before",
3362d5
         "--after",
3362d5
         "--group",
3362d5
@@ -655,6 +657,7 @@ def resource_create(lib, argv, modifiers):
3362d5
         use_default_operations=not modifiers.get("--no-default-ops"),
3362d5
         wait=modifiers.get("--wait"),
3362d5
         allow_not_suitable_command=modifiers.get("--force"),
3362d5
+        enable_agent_self_validation=modifiers.get("--agent-validation"),
3362d5
     )
3362d5
 
3362d5
     clone_id = parts.get("clone_id", None)
3362d5
@@ -894,12 +897,15 @@ def resource_update(lib, args, modifiers, deal_with_guest_change=True):
3362d5
     """
3362d5
     Options:
3362d5
       * -f - CIB file
3362d5
+      * --agent-validation - use agent self validation of instance attributes
3362d5
       * --wait
3362d5
       * --force - allow invalid options, do not fail if not possible to get
3362d5
         agent metadata, allow not suitable command
3362d5
     """
3362d5
     del lib
3362d5
-    modifiers.ensure_only_supported("-f", "--wait", "--force")
3362d5
+    modifiers.ensure_only_supported(
3362d5
+        "-f", "--wait", "--force", "--agent-validation"
3362d5
+    )
3362d5
     if len(args) < 2:
3362d5
         raise CmdLineInputError()
3362d5
     res_id = args.pop(0)
3362d5
@@ -970,7 +976,10 @@ def resource_update(lib, args, modifiers, deal_with_guest_change=True):
3362d5
             dict(params),
3362d5
             res_id,
3362d5
             get_resources(lib_pacemaker.get_cib(cib_xml)),
3362d5
-            force=modifiers.get("--force"),
3362d5
+            force=bool(modifiers.get("--force")),
3362d5
+            enable_agent_self_validation=bool(
3362d5
+                modifiers.get("--agent-validation")
3362d5
+            ),
3362d5
         )
3362d5
         if report_list:
3362d5
             process_library_reports(report_list)
3362d5
diff --git a/pcs/stonith.py b/pcs/stonith.py
3362d5
index 58cd14fc..17ba6aca 100644
3362d5
--- a/pcs/stonith.py
3362d5
+++ b/pcs/stonith.py
3362d5
@@ -127,6 +127,7 @@ def stonith_create(lib, argv, modifiers):
3362d5
         instance attributes
3362d5
       * --disabled - created resource will be disabled
3362d5
       * --no-default-ops - do not add default operations
3362d5
+      * --agent-validation - use agent self validation of instance attributes
3362d5
       * --wait
3362d5
       * -f - CIB file
3362d5
     """
3362d5
@@ -137,6 +138,7 @@ def stonith_create(lib, argv, modifiers):
3362d5
         "--force",
3362d5
         "--disabled",
3362d5
         "--no-default-ops",
3362d5
+        "--agent-validation",
3362d5
         "--wait",
3362d5
         "-f",
3362d5
     )
3362d5
@@ -170,6 +172,7 @@ def stonith_create(lib, argv, modifiers):
3362d5
         ensure_disabled=modifiers.get("--disabled"),
3362d5
         use_default_operations=not modifiers.get("--no-default-ops"),
3362d5
         wait=modifiers.get("--wait"),
3362d5
+        enable_agent_self_validation=modifiers.get("--agent-validation"),
3362d5
     )
3362d5
 
3362d5
     if not modifiers.get("--group"):
3362d5
diff --git a/pcs/usage.py b/pcs/usage.py
3362d5
index 0a6ffcb6..bb5f864d 100644
3362d5
--- a/pcs/usage.py
3362d5
+++ b/pcs/usage.py
3362d5
@@ -357,7 +357,8 @@ Commands:
3362d5
            [clone [<clone id>] [<clone options>] |
3362d5
            promotable [<clone id>] [<promotable options>] |
3362d5
            --group <group id> [--before <resource id> | --after <resource id>] |
3362d5
-           bundle <bundle id>] [--disabled] [--no-default-ops] [--wait[=n]]
3362d5
+           bundle <bundle id>] [--disabled] [--agent-validation]
3362d5
+           [--no-default-ops] [--wait[=n]]
3362d5
         Create specified resource. If clone is used a clone resource is
3362d5
         created. If promotable is used a promotable clone resource is created.
3362d5
         If --group is specified the resource is added to the group named. You
3362d5
@@ -365,12 +366,13 @@ Commands:
3362d5
         resource relatively to some resource already existing in the group. If
3362d5
         bundle is used, the resource will be created inside of the specified
3362d5
         bundle. If --disabled is specified the resource is not started
3362d5
-        automatically. If --no-default-ops is specified, only monitor
3362d5
-        operations are created for the resource and all other operations use
3362d5
-        default settings. If --wait is specified, pcs will wait up to 'n'
3362d5
-        seconds for the resource to start and then return 0 if the resource is
3362d5
-        started, or 1 if the resource has not yet started. If 'n' is not
3362d5
-        specified it defaults to 60 minutes.
3362d5
+        automatically. If --agent-validation is specified, resource agent
3362d5
+        validate-all action will be used to validate resource options. If
3362d5
+        --no-default-ops is specified, only monitor operations are created for
3362d5
+        the resource and all other operations use default settings. If --wait
3362d5
+        is specified, pcs will wait up to 'n' seconds for the resource to start
3362d5
+        and then return 0 if the resource is started, or 1 if the resource has
3362d5
+        not yet started. If 'n' is not specified it defaults to 60 minutes.
3362d5
         Example: Create a new resource called 'VirtualIP' with IP address
3362d5
             192.168.0.99, netmask of 32, monitored everything 30 seconds,
3362d5
             on eth2:
3362d5
@@ -545,7 +547,8 @@ Commands:
3362d5
         List available agents optionally filtered by standard and provider.
3362d5
 
3362d5
     update <resource id> [resource options] [op [<operation action>
3362d5
-           <operation options>]...] [meta <meta operations>...] [--wait[=n]]
3362d5
+           <operation options>]...] [meta <meta operations>...]
3362d5
+           [--agent-validation] [--wait[=n]]
3362d5
         Add, remove or change options of specified resource, clone or
3362d5
         multi-state resource. Unspecified options will be kept unchanged. If
3362d5
         you wish to remove an option, set it to empty value, i.e.
3362d5
@@ -558,6 +561,9 @@ Commands:
3362d5
         if not specified.) If you want to create multiple monitor operations
3362d5
         you should use the 'op add' & 'op remove' commands.
3362d5
 
3362d5
+        If --agent-validation is specified, resource agent validate-all action
3362d5
+        will be used to validate resource options.
3362d5
+
3362d5
         If --wait is specified, pcs will wait up to 'n' seconds for the changes
3362d5
         to take effect and then return 0 if the changes have been processed or
3362d5
         1 otherwise. If 'n' is not specified it defaults to 60 minutes.
3362d5
@@ -1420,13 +1426,15 @@ Commands:
3362d5
            [op <operation action> <operation options> [<operation action>
3362d5
            <operation options>]...] [meta <meta options>...]
3362d5
            [--group <group id> [--before <stonith id> | --after <stonith id>]]
3362d5
-           [--disabled] [--wait[=n]]
3362d5
+           [--disabled] [--agent-validation] [--wait[=n]]
3362d5
         Create stonith device with specified type and options.
3362d5
         If --group is specified the stonith device is added to the group named.
3362d5
         You can use --before or --after to specify the position of the added
3362d5
         stonith device relatively to some stonith device already existing in the
3362d5
         group.
3362d5
         If --disabled is specified the stonith device is not used.
3362d5
+        If --agent-validation is specified, stonith agent validate-all action
3362d5
+        will be used to validate stonith device options.
3362d5
         If --wait is specified, pcs will wait up to 'n' seconds for the stonith
3362d5
         device to start and then return 0 if the stonith device is started, or 1
3362d5
         if the stonith device has not yet started.  If 'n' is not specified it
3362d5
@@ -1436,11 +1444,14 @@ Commands:
3362d5
         Example: Use port p1 for node n1 and ports p2 and p3 for node n2
3362d5
             pcs stonith create MyFence fence_virt 'pcmk_host_map=n1:p1;n2:p2,p3'
3362d5
 
3362d5
-    update <stonith id> [stonith device options]
3362d5
+    update <stonith id> [stonith device options] [--agent-validation]
3362d5
         Add, remove or change options of specified stonith id. Unspecified
3362d5
         options will be kept unchanged. If you wish to remove an option, set it
3362d5
         to empty value, i.e. 'option_name='.
3362d5
 
3362d5
+        If --agent-validation is specified, stonith agent validate-all action
3362d5
+        will be used to validate stonith device options.
3362d5
+
3362d5
     update-scsi-devices <stonith id> (set <device-path> [<device-path>...])
3362d5
             | (add <device-path> [<device-path>...] delete|remove <device-path>
3362d5
             [device-path>...])
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 1bc3a5a6..0456abcf 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
@@ -592,6 +592,22 @@ class ValidateResourceInstanceAttributesCreateSelfValidation(TestCase):
3362d5
         self.agent_self_validation_mock.return_value = True, []
3362d5
         self.cmd_runner = mock.Mock()
3362d5
 
3362d5
+    def test_disabled(self):
3362d5
+        attributes = {"required": "value"}
3362d5
+        facade = _fixture_ocf_agent()
3362d5
+        self.assertEqual(
3362d5
+            primitive.validate_resource_instance_attributes_create(
3362d5
+                self.cmd_runner,
3362d5
+                facade,
3362d5
+                attributes,
3362d5
+                etree.Element("resources"),
3362d5
+                force=False,
3362d5
+                enable_agent_self_validation=False,
3362d5
+            ),
3362d5
+            [],
3362d5
+        )
3362d5
+        self.agent_self_validation_mock.assert_not_called()
3362d5
+
3362d5
     def test_success(self):
3362d5
         attributes = {"required": "value"}
3362d5
         facade = _fixture_ocf_agent()
3362d5
@@ -602,6 +618,7 @@ class ValidateResourceInstanceAttributesCreateSelfValidation(TestCase):
3362d5
                 attributes,
3362d5
                 etree.Element("resources"),
3362d5
                 force=False,
3362d5
+                enable_agent_self_validation=True,
3362d5
             ),
3362d5
             [],
3362d5
         )
3362d5
@@ -621,6 +638,7 @@ class ValidateResourceInstanceAttributesCreateSelfValidation(TestCase):
3362d5
                 attributes,
3362d5
                 etree.Element("resources"),
3362d5
                 force=True,
3362d5
+                enable_agent_self_validation=True,
3362d5
             ),
3362d5
             [],
3362d5
         )
3362d5
@@ -642,6 +660,7 @@ class ValidateResourceInstanceAttributesCreateSelfValidation(TestCase):
3362d5
                 attributes,
3362d5
                 etree.Element("resources"),
3362d5
                 force=False,
3362d5
+                enable_agent_self_validation=True,
3362d5
             ),
3362d5
             [
3362d5
                 fixture.error(
3362d5
@@ -667,6 +686,7 @@ class ValidateResourceInstanceAttributesCreateSelfValidation(TestCase):
3362d5
                 attributes,
3362d5
                 etree.Element("resources"),
3362d5
                 force=False,
3362d5
+                enable_agent_self_validation=True,
3362d5
             ),
3362d5
             [],
3362d5
         )
3362d5
@@ -686,6 +706,7 @@ class ValidateResourceInstanceAttributesCreateSelfValidation(TestCase):
3362d5
                 attributes,
3362d5
                 etree.Element("resources"),
3362d5
                 force=False,
3362d5
+                enable_agent_self_validation=True,
3362d5
             ),
3362d5
             [],
3362d5
         )
3362d5
@@ -701,6 +722,7 @@ class ValidateResourceInstanceAttributesCreateSelfValidation(TestCase):
3362d5
                 attributes,
3362d5
                 etree.Element("resources"),
3362d5
                 force=False,
3362d5
+                enable_agent_self_validation=True,
3362d5
             ),
3362d5
             [],
3362d5
         )
3362d5
@@ -716,6 +738,7 @@ class ValidateResourceInstanceAttributesCreateSelfValidation(TestCase):
3362d5
                 attributes,
3362d5
                 etree.Element("resources"),
3362d5
                 force=False,
3362d5
+                enable_agent_self_validation=True,
3362d5
             ),
3362d5
             [
3362d5
                 fixture.error(
3362d5
@@ -1275,6 +1298,24 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
3362d5
             etree.SubElement(nvset_el, "nvpair", dict(name=name, value=value))
3362d5
         return resources_el
3362d5
 
3362d5
+    def test_disabled(self):
3362d5
+        old_attributes = {"required": "old_value"}
3362d5
+        new_attributes = {"required": "new_value"}
3362d5
+        facade = _fixture_ocf_agent()
3362d5
+        self.assertEqual(
3362d5
+            primitive.validate_resource_instance_attributes_update(
3362d5
+                self.cmd_runner,
3362d5
+                facade,
3362d5
+                new_attributes,
3362d5
+                self._NAME,
3362d5
+                self._fixture_resources(old_attributes),
3362d5
+                force=False,
3362d5
+                enable_agent_self_validation=False,
3362d5
+            ),
3362d5
+            [],
3362d5
+        )
3362d5
+        self.agent_self_validation_mock.assert_not_called()
3362d5
+
3362d5
     def test_success(self):
3362d5
         old_attributes = {"required": "old_value"}
3362d5
         new_attributes = {"required": "new_value"}
3362d5
@@ -1287,6 +1328,7 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
3362d5
                 self._NAME,
3362d5
                 self._fixture_resources(old_attributes),
3362d5
                 force=False,
3362d5
+                enable_agent_self_validation=True,
3362d5
             ),
3362d5
             [],
3362d5
         )
3362d5
@@ -1318,6 +1360,7 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
3362d5
                 self._NAME,
3362d5
                 self._fixture_resources(old_attributes),
3362d5
                 force=True,
3362d5
+                enable_agent_self_validation=True,
3362d5
             ),
3362d5
             [],
3362d5
         )
3362d5
@@ -1354,6 +1397,7 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
3362d5
                 self._NAME,
3362d5
                 self._fixture_resources(old_attributes),
3362d5
                 force=False,
3362d5
+                enable_agent_self_validation=True,
3362d5
             ),
3362d5
             [
3362d5
                 fixture.error(
3362d5
@@ -1391,6 +1435,7 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
3362d5
                 self._NAME,
3362d5
                 self._fixture_resources(old_attributes),
3362d5
                 force=False,
3362d5
+                enable_agent_self_validation=True,
3362d5
             ),
3362d5
             [],
3362d5
         )
3362d5
@@ -1422,6 +1467,7 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
3362d5
                 self._NAME,
3362d5
                 self._fixture_resources(old_attributes),
3362d5
                 force=False,
3362d5
+                enable_agent_self_validation=True,
3362d5
             ),
3362d5
             [],
3362d5
         )
3362d5
@@ -1439,6 +1485,7 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
3362d5
                 self._NAME,
3362d5
                 self._fixture_resources(old_attributes),
3362d5
                 force=False,
3362d5
+                enable_agent_self_validation=True,
3362d5
             ),
3362d5
             [],
3362d5
         )
3362d5
@@ -1456,6 +1503,7 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
3362d5
                 self._NAME,
3362d5
                 self._fixture_resources(old_attributes),
3362d5
                 force=False,
3362d5
+                enable_agent_self_validation=True,
3362d5
             ),
3362d5
             [
3362d5
                 fixture.error(
3362d5
@@ -1482,6 +1530,7 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
3362d5
                 self._NAME,
3362d5
                 self._fixture_resources(old_attributes),
3362d5
                 force=False,
3362d5
+                enable_agent_self_validation=True,
3362d5
             ),
3362d5
             [
3362d5
                 fixture.warn(
3362d5
diff --git a/pcs_test/tier0/lib/commands/resource/test_resource_create.py b/pcs_test/tier0/lib/commands/resource/test_resource_create.py
3362d5
index 3384a674..225bb57b 100644
3362d5
--- a/pcs_test/tier0/lib/commands/resource/test_resource_create.py
3362d5
+++ b/pcs_test/tier0/lib/commands/resource/test_resource_create.py
3362d5
@@ -29,7 +29,9 @@ def create(
3362d5
     allow_invalid_operation=False,
3362d5
     agent_name="ocf:heartbeat:Dummy",
3362d5
     allow_invalid_instance_attributes=False,
3362d5
+    enable_agent_self_validation=False,
3362d5
 ):
3362d5
+    # pylint: disable=too-many-arguments
3362d5
     return resource.create(
3362d5
         env,
3362d5
         "A",
3362d5
@@ -41,6 +43,7 @@ def create(
3362d5
         ensure_disabled=disabled,
3362d5
         allow_invalid_operation=allow_invalid_operation,
3362d5
         allow_invalid_instance_attributes=allow_invalid_instance_attributes,
3362d5
+        enable_agent_self_validation=enable_agent_self_validation,
3362d5
     )
3362d5
 
3362d5
 
3362d5
@@ -50,6 +53,7 @@ def create_group(
3362d5
     disabled=False,
3362d5
     meta_attributes=None,
3362d5
     operation_list=None,
3362d5
+    enable_agent_self_validation=False,
3362d5
 ):
3362d5
     return resource.create_in_group(
3362d5
         env,
3362d5
@@ -61,6 +65,7 @@ def create_group(
3362d5
         instance_attributes={},
3362d5
         wait=wait,
3362d5
         ensure_disabled=disabled,
3362d5
+        enable_agent_self_validation=enable_agent_self_validation,
3362d5
     )
3362d5
 
3362d5
 
3362d5
@@ -72,6 +77,7 @@ def create_clone(
3362d5
     clone_options=None,
3362d5
     operation_list=None,
3362d5
     clone_id=None,
3362d5
+    enable_agent_self_validation=False,
3362d5
 ):
3362d5
     return resource.create_as_clone(
3362d5
         env,
3362d5
@@ -84,6 +90,7 @@ def create_clone(
3362d5
         clone_id=clone_id,
3362d5
         wait=wait,
3362d5
         ensure_disabled=disabled,
3362d5
+        enable_agent_self_validation=enable_agent_self_validation,
3362d5
     )
3362d5
 
3362d5
 
3362d5
@@ -94,6 +101,7 @@ def create_bundle(
3362d5
     meta_attributes=None,
3362d5
     allow_not_accessible_resource=False,
3362d5
     operation_list=None,
3362d5
+    enable_agent_self_validation=False,
3362d5
 ):
3362d5
     return resource.create_into_bundle(
3362d5
         env,
3362d5
@@ -106,6 +114,7 @@ def create_bundle(
3362d5
         wait=wait,
3362d5
         ensure_disabled=disabled,
3362d5
         allow_not_accessible_resource=allow_not_accessible_resource,
3362d5
+        enable_agent_self_validation=enable_agent_self_validation,
3362d5
     )
3362d5
 
3362d5
 
3362d5
@@ -390,13 +399,6 @@ class CreateRolesNormalization(TestCase):
3362d5
             agent_filename=agent_file_name,
3362d5
         )
3362d5
         self.config.runner.cib.load(filename=cib_file)
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation(
3362d5
-            {},
3362d5
-            output="",
3362d5
-            standard="ocf",
3362d5
-            provider="pacemaker",
3362d5
-            agent_type="Stateful",
3362d5
-        )
3362d5
 
3362d5
     def create(self, operation_list=None):
3362d5
         resource.create(
3362d5
@@ -564,7 +566,6 @@ class Create(TestCase):
3362d5
     def test_simplest_resource(self):
3362d5
         self.config.runner.pcmk.load_agent()
3362d5
         self.config.runner.cib.load()
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
3362d5
         self.config.env.push_cib(
3362d5
             resources=fixture_cib_resources_xml_primitive_simplest
3362d5
         )
3362d5
@@ -586,7 +587,9 @@ class Create(TestCase):
3362d5
             returncode=1,
3362d5
         )
3362d5
         self.env_assist.assert_raise_library_error(
3362d5
-            lambda: create(self.env_assist.get_env()),
3362d5
+            lambda: create(
3362d5
+                self.env_assist.get_env(), enable_agent_self_validation=True
3362d5
+            ),
3362d5
         )
3362d5
         self.env_assist.assert_reports(
3362d5
             [
3362d5
@@ -617,7 +620,9 @@ class Create(TestCase):
3362d5
             resources=fixture_cib_resources_xml_primitive_simplest
3362d5
         )
3362d5
         create(
3362d5
-            self.env_assist.get_env(), allow_invalid_instance_attributes=True
3362d5
+            self.env_assist.get_env(),
3362d5
+            allow_invalid_instance_attributes=True,
3362d5
+            enable_agent_self_validation=True,
3362d5
         )
3362d5
         self.env_assist.assert_reports(
3362d5
             [
3362d5
@@ -637,7 +642,10 @@ class Create(TestCase):
3362d5
             returncode=0,
3362d5
         )
3362d5
         self.env_assist.assert_raise_library_error(
3362d5
-            lambda: create(self.env_assist.get_env()),
3362d5
+            lambda: create(
3362d5
+                self.env_assist.get_env(),
3362d5
+                enable_agent_self_validation=True,
3362d5
+            ),
3362d5
         )
3362d5
         self.env_assist.assert_reports(
3362d5
             [
3362d5
@@ -682,7 +690,6 @@ class Create(TestCase):
3362d5
         )
3362d5
         self.config.runner.pcmk.load_agent()
3362d5
         self.config.runner.cib.load()
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
3362d5
         self.config.env.push_cib(
3362d5
             resources=fixture_cib_resources_xml_primitive_simplest
3362d5
         )
3362d5
@@ -845,7 +852,6 @@ class Create(TestCase):
3362d5
     def test_resource_with_operation(self):
3362d5
         self.config.runner.pcmk.load_agent()
3362d5
         self.config.runner.cib.load()
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
3362d5
         self.config.env.push_cib(
3362d5
             resources="""
3362d5
                 <resources>
3362d5
@@ -891,14 +897,12 @@ class Create(TestCase):
3362d5
             ),
3362d5
         )
3362d5
         self.config.runner.cib.load()
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
3362d5
         self.config.env.push_cib(resources=self.fixture_sanitized_operation)
3362d5
         create(self.env_assist.get_env())
3362d5
 
3362d5
     def test_sanitize_operation_id_from_user(self):
3362d5
         self.config.runner.pcmk.load_agent()
3362d5
         self.config.runner.cib.load()
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
3362d5
         self.config.env.push_cib(resources=self.fixture_sanitized_operation)
3362d5
         create(
3362d5
             self.env_assist.get_env(),
3362d5
@@ -1080,9 +1084,6 @@ class Create(TestCase):
3362d5
                 </resources>
3362d5
             """,
3362d5
         )
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation(
3362d5
-            dict(state=1), output=""
3362d5
-        )
3362d5
         self.config.env.push_cib(
3362d5
             resources="""
3362d5
                 <resources>
3362d5
@@ -1168,7 +1169,6 @@ class Create(TestCase):
3362d5
         )
3362d5
         self.config.runner.cib.upgrade()
3362d5
         self.config.runner.cib.load(filename="cib-empty-3.4.xml")
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
3362d5
         self.config.env.push_cib(
3362d5
             resources="""
3362d5
                 <resources>
3362d5
@@ -1224,7 +1224,6 @@ class CreateWait(TestCase):
3362d5
         self.env_assist, self.config = get_env_tools(test_case=self)
3362d5
         self.config.runner.pcmk.load_agent()
3362d5
         self.config.runner.cib.load()
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
3362d5
         self.config.env.push_cib(
3362d5
             resources=fixture_cib_resources_xml_primitive_simplest,
3362d5
             wait=TIMEOUT,
3362d5
@@ -1354,15 +1353,9 @@ class CreateWait(TestCase):
3362d5
 
3362d5
 class CreateInGroup(TestCase):
3362d5
     def setUp(self):
3362d5
-        self.agent_self_validation_call_name = (
3362d5
-            "runner.pcmk.resource_agent_self_validation"
3362d5
-        )
3362d5
         self.env_assist, self.config = get_env_tools(test_case=self)
3362d5
         self.config.runner.pcmk.load_agent()
3362d5
         self.config.runner.cib.load()
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation(
3362d5
-            {}, output="", name=self.agent_self_validation_call_name
3362d5
-        )
3362d5
 
3362d5
     def test_simplest_resource(self):
3362d5
         (
3362d5
@@ -1405,7 +1398,6 @@ class CreateInGroup(TestCase):
3362d5
         create_group(self.env_assist.get_env(), wait=False)
3362d5
 
3362d5
     def test_cib_upgrade_on_onfail_demote(self):
3362d5
-        self.config.remove(self.agent_self_validation_call_name)
3362d5
         self.config.runner.cib.load(
3362d5
             filename="cib-empty-3.3.xml",
3362d5
             instead="runner.cib.load",
3362d5
@@ -1413,7 +1405,6 @@ class CreateInGroup(TestCase):
3362d5
         )
3362d5
         self.config.runner.cib.upgrade()
3362d5
         self.config.runner.cib.load(filename="cib-empty-3.4.xml")
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
3362d5
         self.config.env.push_cib(
3362d5
             resources="""
3362d5
                 <resources>
3362d5
@@ -1465,6 +1456,34 @@ class CreateInGroup(TestCase):
3362d5
             [fixture.info(reports.codes.CIB_UPGRADE_SUCCESSFUL)]
3362d5
         )
3362d5
 
3362d5
+    def test_resource_self_validation_failure(self):
3362d5
+        self.config.runner.pcmk.resource_agent_self_validation(
3362d5
+            {},
3362d5
+            output="""
3362d5
+            <output source="stderr">not ignored</output>
3362d5
+            <output source="stdout">this is ignored</output>
3362d5
+            <output source="stderr">
3362d5
+            first issue
3362d5
+            another one
3362d5
+            </output>
3362d5
+            """,
3362d5
+            returncode=1,
3362d5
+        )
3362d5
+        self.env_assist.assert_raise_library_error(
3362d5
+            lambda: create_group(
3362d5
+                self.env_assist.get_env(), enable_agent_self_validation=True
3362d5
+            ),
3362d5
+        )
3362d5
+        self.env_assist.assert_reports(
3362d5
+            [
3362d5
+                fixture.error(
3362d5
+                    reports.codes.AGENT_SELF_VALIDATION_RESULT,
3362d5
+                    result="not ignored\nfirst issue\nanother one",
3362d5
+                    force_code=reports.codes.FORCE,
3362d5
+                )
3362d5
+            ]
3362d5
+        )
3362d5
+
3362d5
     def test_fail_wait(self):
3362d5
         self.config.env.push_cib(
3362d5
             resources=fixture_cib_resources_xml_group_simplest,
3362d5
@@ -1608,15 +1627,9 @@ class CreateInGroup(TestCase):
3362d5
 
3362d5
 class CreateAsClone(TestCase):
3362d5
     def setUp(self):
3362d5
-        self.agent_self_validation_call_name = (
3362d5
-            "runner.pcmk.resource_agent_self_validation"
3362d5
-        )
3362d5
         self.env_assist, self.config = get_env_tools(test_case=self)
3362d5
         self.config.runner.pcmk.load_agent()
3362d5
         self.config.runner.cib.load()
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation(
3362d5
-            {}, output="", name=self.agent_self_validation_call_name
3362d5
-        )
3362d5
 
3362d5
     def test_simplest_resource(self):
3362d5
         (
3362d5
@@ -1626,6 +1639,34 @@ class CreateAsClone(TestCase):
3362d5
         )
3362d5
         create_clone(self.env_assist.get_env(), wait=False)
3362d5
 
3362d5
+    def test_resource_self_validation_failure(self):
3362d5
+        self.config.runner.pcmk.resource_agent_self_validation(
3362d5
+            {},
3362d5
+            output="""
3362d5
+            <output source="stderr">not ignored</output>
3362d5
+            <output source="stdout">this is ignored</output>
3362d5
+            <output source="stderr">
3362d5
+            first issue
3362d5
+            another one
3362d5
+            </output>
3362d5
+            """,
3362d5
+            returncode=1,
3362d5
+        )
3362d5
+        self.env_assist.assert_raise_library_error(
3362d5
+            lambda: create_clone(
3362d5
+                self.env_assist.get_env(), enable_agent_self_validation=True
3362d5
+            ),
3362d5
+        )
3362d5
+        self.env_assist.assert_reports(
3362d5
+            [
3362d5
+                fixture.error(
3362d5
+                    reports.codes.AGENT_SELF_VALIDATION_RESULT,
3362d5
+                    result="not ignored\nfirst issue\nanother one",
3362d5
+                    force_code=reports.codes.FORCE,
3362d5
+                )
3362d5
+            ]
3362d5
+        )
3362d5
+
3362d5
     def test_custom_clone_id(self):
3362d5
         (
3362d5
             self.config.env.push_cib(
3362d5
@@ -1637,7 +1678,6 @@ class CreateAsClone(TestCase):
3362d5
         )
3362d5
 
3362d5
     def test_custom_clone_id_error_invalid_id(self):
3362d5
-        self.config.remove(self.agent_self_validation_call_name)
3362d5
         self.env_assist.assert_raise_library_error(
3362d5
             lambda: create_clone(
3362d5
                 self.env_assist.get_env(), wait=False, clone_id="1invalid"
3362d5
@@ -1649,7 +1689,6 @@ class CreateAsClone(TestCase):
3362d5
 
3362d5
     def test_custom_clone_id_error_id_already_exist(self):
3362d5
         self.config.remove(name="runner.cib.load")
3362d5
-        self.config.remove(self.agent_self_validation_call_name)
3362d5
         self.config.runner.cib.load(
3362d5
             resources="""
3362d5
                 <resources>
3362d5
@@ -1672,7 +1711,6 @@ class CreateAsClone(TestCase):
3362d5
         self.env_assist.assert_reports([fixture.report_id_already_exist("C")])
3362d5
 
3362d5
     def test_cib_upgrade_on_onfail_demote(self):
3362d5
-        self.config.remove(self.agent_self_validation_call_name)
3362d5
         self.config.runner.cib.load(
3362d5
             filename="cib-empty-3.3.xml",
3362d5
             instead="runner.cib.load",
3362d5
@@ -1680,7 +1718,6 @@ class CreateAsClone(TestCase):
3362d5
         )
3362d5
         self.config.runner.cib.upgrade()
3362d5
         self.config.runner.cib.load(filename="cib-empty-3.4.xml")
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
3362d5
         self.config.env.push_cib(
3362d5
             resources="""<resources>
3362d5
                 <clone id="A-clone">
3362d5
@@ -2237,7 +2274,6 @@ class CreateInToBundle(TestCase):
3362d5
         self.config.runner.cib.load(
3362d5
             filename="cib-empty-3.4.xml", resources=self.fixture_resources_pre
3362d5
         )
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
3362d5
         self.config.env.push_cib(
3362d5
             resources=self.fixture_resource_post_simple_without_network.format(
3362d5
                 network="""
3362d5
@@ -2267,13 +2303,11 @@ class CreateInToBundle(TestCase):
3362d5
 
3362d5
     def test_simplest_resource(self):
3362d5
         self.config.runner.cib.load(resources=self.fixture_resources_pre)
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
3362d5
         self.config.env.push_cib(resources=self.fixture_resources_post_simple)
3362d5
         create_bundle(self.env_assist.get_env(), wait=False)
3362d5
 
3362d5
     def test_bundle_doesnt_exist(self):
3362d5
         self.config.runner.cib.load(resources=self.fixture_empty_resources)
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
3362d5
         self.env_assist.assert_raise_library_error(
3362d5
             lambda: create_bundle(self.env_assist.get_env(), wait=False),
3362d5
             [
3362d5
@@ -2296,7 +2330,6 @@ class CreateInToBundle(TestCase):
3362d5
                     </resources>
3362d5
                 """
3362d5
         )
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
3362d5
 
3362d5
         self.env_assist.assert_raise_library_error(
3362d5
             lambda: create_bundle(self.env_assist.get_env(), wait=False),
3362d5
@@ -2322,7 +2355,6 @@ class CreateInToBundle(TestCase):
3362d5
                     </resources>
3362d5
                 """
3362d5
         )
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
3362d5
         self.env_assist.assert_raise_library_error(
3362d5
             lambda: create_bundle(self.env_assist.get_env(), wait=False),
3362d5
             [
3362d5
@@ -2337,7 +2369,6 @@ class CreateInToBundle(TestCase):
3362d5
 
3362d5
     def test_wait_fail(self):
3362d5
         self.config.runner.cib.load(resources=self.fixture_resources_pre)
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
3362d5
         self.config.env.push_cib(
3362d5
             resources=self.fixture_resources_post_simple,
3362d5
             wait=TIMEOUT,
3362d5
@@ -2362,7 +2393,6 @@ class CreateInToBundle(TestCase):
3362d5
     )
3362d5
     def test_wait_ok_run_ok(self):
3362d5
         self.config.runner.cib.load(resources=self.fixture_resources_pre)
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
3362d5
         self.config.env.push_cib(
3362d5
             resources=self.fixture_resources_post_simple, wait=TIMEOUT
3362d5
         )
3362d5
@@ -2383,7 +2413,6 @@ class CreateInToBundle(TestCase):
3362d5
     )
3362d5
     def test_wait_ok_run_fail(self):
3362d5
         self.config.runner.cib.load(resources=self.fixture_resources_pre)
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
3362d5
         self.config.env.push_cib(
3362d5
             resources=self.fixture_resources_post_simple, wait=TIMEOUT
3362d5
         )
3362d5
@@ -2408,7 +2437,6 @@ class CreateInToBundle(TestCase):
3362d5
     )
3362d5
     def test_disabled_wait_ok_not_running(self):
3362d5
         self.config.runner.cib.load(resources=self.fixture_resources_pre)
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
3362d5
         self.config.env.push_cib(
3362d5
             resources=self.fixture_resources_post_disabled, wait=TIMEOUT
3362d5
         )
3362d5
@@ -2427,7 +2455,6 @@ class CreateInToBundle(TestCase):
3362d5
     )
3362d5
     def test_disabled_wait_ok_running(self):
3362d5
         self.config.runner.cib.load(resources=self.fixture_resources_pre)
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
3362d5
         self.config.env.push_cib(
3362d5
             resources=self.fixture_resources_post_disabled, wait=TIMEOUT
3362d5
         )
3362d5
@@ -2455,7 +2482,6 @@ class CreateInToBundle(TestCase):
3362d5
                 </resources>
3362d5
             """
3362d5
         )
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
3362d5
         self.env_assist.assert_raise_library_error(
3362d5
             lambda: create_bundle(self.env_assist.get_env(), wait=False)
3362d5
         )
3362d5
@@ -2479,7 +2505,6 @@ class CreateInToBundle(TestCase):
3362d5
                 </resources>
3362d5
             """
3362d5
         )
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
3362d5
         self.config.env.push_cib(
3362d5
             resources=(
3362d5
                 self.fixture_resource_post_simple_without_network.format(
3362d5
@@ -2512,7 +2537,6 @@ class CreateInToBundle(TestCase):
3362d5
                 </resources>
3362d5
             """
3362d5
         )
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation({}, output="")
3362d5
         self.config.env.push_cib(
3362d5
             resources=(
3362d5
                 self.fixture_resource_post_simple_without_network.format(
3362d5
@@ -2529,3 +2553,32 @@ class CreateInToBundle(TestCase):
3362d5
         self._test_with_network_defined(
3362d5
             '<network ip-range-start="192.168.100.200"/>'
3362d5
         )
3362d5
+
3362d5
+    def test_resource_self_validation_failure(self):
3362d5
+        self.config.runner.cib.load()
3362d5
+        self.config.runner.pcmk.resource_agent_self_validation(
3362d5
+            {},
3362d5
+            output="""
3362d5
+            <output source="stderr">not ignored</output>
3362d5
+            <output source="stdout">this is ignored</output>
3362d5
+            <output source="stderr">
3362d5
+            first issue
3362d5
+            another one
3362d5
+            </output>
3362d5
+            """,
3362d5
+            returncode=1,
3362d5
+        )
3362d5
+        self.env_assist.assert_raise_library_error(
3362d5
+            lambda: create_bundle(
3362d5
+                self.env_assist.get_env(), enable_agent_self_validation=True
3362d5
+            ),
3362d5
+        )
3362d5
+        self.env_assist.assert_reports(
3362d5
+            [
3362d5
+                fixture.error(
3362d5
+                    reports.codes.AGENT_SELF_VALIDATION_RESULT,
3362d5
+                    result="not ignored\nfirst issue\nanother one",
3362d5
+                    force_code=reports.codes.FORCE,
3362d5
+                )
3362d5
+            ]
3362d5
+        )
3362d5
diff --git a/pcs_test/tier0/lib/commands/test_booth.py b/pcs_test/tier0/lib/commands/test_booth.py
3362d5
index 220d058f..e0b6924e 100644
3362d5
--- a/pcs_test/tier0/lib/commands/test_booth.py
3362d5
+++ b/pcs_test/tier0/lib/commands/test_booth.py
3362d5
@@ -1754,30 +1754,10 @@ class CreateInCluster(TestCase, FixtureMixin):
3362d5
             agent_name="ocf:heartbeat:IPaddr2",
3362d5
             name="runner.pcmk.load_agent.ipaddr2",
3362d5
         )
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation(
3362d5
-            dict(ip=self.site_ip),
3362d5
-            standard="ocf",
3362d5
-            provider="heartbeat",
3362d5
-            agent_type="IPaddr2",
3362d5
-            output="",
3362d5
-        )
3362d5
         self.config.runner.pcmk.load_agent(
3362d5
             agent_name="ocf:pacemaker:booth-site",
3362d5
             name="runner.pcmk.load_agent.booth-site",
3362d5
         )
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation(
3362d5
-            dict(
3362d5
-                config=os.path.join(
3362d5
-                    settings.booth_config_dir,
3362d5
-                    f"{instance_name}.conf",
3362d5
-                )
3362d5
-            ),
3362d5
-            standard="ocf",
3362d5
-            provider="pacemaker",
3362d5
-            agent_type="booth-site",
3362d5
-            output="",
3362d5
-            name="runner.pcmk.agent_self_validation.booth-site",
3362d5
-        )
3362d5
         self.config.env.push_cib(
3362d5
             resources=self.fixture_cib_booth_group(instance_name)
3362d5
         )
3362d5
@@ -1809,33 +1789,11 @@ class CreateInCluster(TestCase, FixtureMixin):
3362d5
             name="runner.pcmk.load_agent.ipaddr2",
3362d5
             env=env,
3362d5
         )
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation(
3362d5
-            dict(ip=self.site_ip),
3362d5
-            standard="ocf",
3362d5
-            provider="heartbeat",
3362d5
-            agent_type="IPaddr2",
3362d5
-            output="",
3362d5
-            env=env,
3362d5
-        )
3362d5
         self.config.runner.pcmk.load_agent(
3362d5
             agent_name="ocf:pacemaker:booth-site",
3362d5
             name="runner.pcmk.load_agent.booth-site",
3362d5
             env=env,
3362d5
         )
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation(
3362d5
-            dict(
3362d5
-                config=os.path.join(
3362d5
-                    settings.booth_config_dir,
3362d5
-                    f"{constants.DEFAULT_INSTANCE_NAME}.conf",
3362d5
-                )
3362d5
-            ),
3362d5
-            standard="ocf",
3362d5
-            provider="pacemaker",
3362d5
-            agent_type="booth-site",
3362d5
-            output="",
3362d5
-            env=env,
3362d5
-            name="runner.pcmk.agent_self_validation.booth-site",
3362d5
-        )
3362d5
         self.config.env.push_cib(resources=self.fixture_cib_booth_group())
3362d5
         commands.create_in_cluster(self.env_assist.get_env(), self.site_ip)
3362d5
 
3362d5
@@ -1943,13 +1901,6 @@ class CreateInCluster(TestCase, FixtureMixin):
3362d5
             agent_name="ocf:heartbeat:IPaddr2",
3362d5
             name="runner.pcmk.load_agent.ipaddr2",
3362d5
         )
3362d5
-        self.config.runner.pcmk.resource_agent_self_validation(
3362d5
-            dict(ip=self.site_ip),
3362d5
-            standard="ocf",
3362d5
-            provider="heartbeat",
3362d5
-            agent_type="IPaddr2",
3362d5
-            output="",
3362d5
-        )
3362d5
         self.config.runner.pcmk.load_agent(
3362d5
             agent_name="ocf:pacemaker:booth-site",
3362d5
             agent_is_missing=True,
3362d5
diff --git a/pcs_test/tier0/lib/commands/test_stonith.py b/pcs_test/tier0/lib/commands/test_stonith.py
3362d5
index 65a0608f..eedd1c04 100644
3362d5
--- a/pcs_test/tier0/lib/commands/test_stonith.py
3362d5
+++ b/pcs_test/tier0/lib/commands/test_stonith.py
3362d5
@@ -108,9 +108,6 @@ class CreateMixin:
3362d5
         )
3362d5
         self.config.runner.pcmk.load_fake_agent_metadata()
3362d5
         self.config.runner.cib.load()
3362d5
-        self.config.runner.pcmk.stonith_agent_self_validation(
3362d5
-            instance_attributes, agent_name, output=""
3362d5
-        )
3362d5
         self.config.env.push_cib(
3362d5
             resources=self._expected_cib(expected_cib_simple)
3362d5
         )
3362d5
@@ -158,6 +155,7 @@ class CreateMixin:
3362d5
                 operations=[],
3362d5
                 meta_attributes={},
3362d5
                 instance_attributes=instance_attributes,
3362d5
+                enable_agent_self_validation=True,
3362d5
             ),
3362d5
         )
3362d5
         self.env_assist.assert_reports(
3362d5
@@ -208,6 +206,7 @@ class CreateMixin:
3362d5
             meta_attributes={},
3362d5
             instance_attributes=instance_attributes,
3362d5
             allow_invalid_instance_attributes=True,
3362d5
+            enable_agent_self_validation=True,
3362d5
         )
3362d5
         self.env_assist.assert_reports(
3362d5
             [
3362d5
@@ -245,6 +244,7 @@ class CreateMixin:
3362d5
                 operations=[],
3362d5
                 meta_attributes={},
3362d5
                 instance_attributes=instance_attributes,
3362d5
+                enable_agent_self_validation=True,
3362d5
             ),
3362d5
         )
3362d5
         self.env_assist.assert_reports(
3362d5
@@ -266,9 +266,6 @@ class CreateMixin:
3362d5
         )
3362d5
         self.config.runner.pcmk.load_fake_agent_metadata()
3362d5
         self.config.runner.cib.load()
3362d5
-        self.config.runner.pcmk.stonith_agent_self_validation(
3362d5
-            {}, agent_name, output=""
3362d5
-        )
3362d5
         self.config.env.push_cib(
3362d5
             resources=self._expected_cib(expected_cib_unfencing)
3362d5
         )
3362d5
@@ -306,9 +303,6 @@ class CreateMixin:
3362d5
         )
3362d5
         self.config.runner.pcmk.load_fake_agent_metadata()
3362d5
         self.config.runner.cib.load()
3362d5
-        self.config.runner.pcmk.stonith_agent_self_validation(
3362d5
-            instance_attributes, agent_name, output=""
3362d5
-        )
3362d5
         self.config.env.push_cib(resources=self._expected_cib(expected_cib))
3362d5
 
3362d5
         self._create(
3362d5
@@ -334,9 +328,6 @@ class CreateMixin:
3362d5
         )
3362d5
         self.config.runner.pcmk.load_fake_agent_metadata()
3362d5
         self.config.runner.cib.load()
3362d5
-        self.config.runner.pcmk.stonith_agent_self_validation(
3362d5
-            {}, agent_name, output=""
3362d5
-        )
3362d5
         self.config.env.push_cib(
3362d5
             resources=self._expected_cib(expected_cib_operations)
3362d5
         )
3362d5
@@ -395,9 +386,6 @@ class CreateMixin:
3362d5
         )
3362d5
         self.config.runner.pcmk.load_fake_agent_metadata()
3362d5
         self.config.runner.cib.load()
3362d5
-        self.config.runner.pcmk.stonith_agent_self_validation(
3362d5
-            instance_attributes, agent_name, output=""
3362d5
-        )
3362d5
         self.config.env.push_cib(
3362d5
             resources=self._expected_cib(expected_cib_simple_forced)
3362d5
         )
3362d5
@@ -611,9 +599,6 @@ class CreateMixin:
3362d5
         )
3362d5
         self.config.runner.pcmk.load_fake_agent_metadata()
3362d5
         self.config.runner.cib.load()
3362d5
-        self.config.runner.pcmk.stonith_agent_self_validation(
3362d5
-            instance_attributes, agent_name, output=""
3362d5
-        )
3362d5
         self.config.env.push_cib(
3362d5
             resources=self._expected_cib(expected_cib_simple), wait=timeout
3362d5
         )
3362d5
@@ -727,9 +712,6 @@ class CreateInGroup(CreateMixin, TestCase):
3362d5
         )
3362d5
         self.config.runner.pcmk.load_fake_agent_metadata()
3362d5
         self.config.runner.cib.load(resources=original_cib)
3362d5
-        self.config.runner.pcmk.stonith_agent_self_validation(
3362d5
-            instance_attributes, agent_name, output=""
3362d5
-        )
3362d5
         self.config.env.push_cib(resources=expected_cib)
3362d5
 
3362d5
         stonith.create_in_group(
3362d5
diff --git a/pcs_test/tier1/cib_resource/test_create.py b/pcs_test/tier1/cib_resource/test_create.py
3362d5
index 16c20116..29db0ffd 100644
3362d5
--- a/pcs_test/tier1/cib_resource/test_create.py
3362d5
+++ b/pcs_test/tier1/cib_resource/test_create.py
3362d5
@@ -751,7 +751,9 @@ class Promotable(TestCase, AssertPcsMixin):
3362d5
         ensure_disabled=False,
3362d5
         use_default_operations=True,
3362d5
         wait=False,
3362d5
+        enable_agent_self_validation=False,
3362d5
     ):
3362d5
+        # pylint: disable=too-many-arguments
3362d5
         options = locals()
3362d5
         del options["self"]
3362d5
         return options
3362d5
diff --git a/pcs_test/tier1/cib_resource/test_stonith_create.py b/pcs_test/tier1/cib_resource/test_stonith_create.py
3362d5
index 6d6841fe..d8801871 100644
3362d5
--- a/pcs_test/tier1/cib_resource/test_stonith_create.py
3362d5
+++ b/pcs_test/tier1/cib_resource/test_stonith_create.py
3362d5
@@ -45,7 +45,6 @@ class PlainStonith(ResourceTest):
3362d5
                     </operations>
3362d5
                 </primitive>
3362d5
             </resources>""",
3362d5
-            output_start="Warning: Validation result from agent:",
3362d5
         )
3362d5
 
3362d5
     def test_error_when_not_valid_name(self):
3362d5
@@ -249,7 +248,6 @@ class WithMeta(ResourceTest):
3362d5
                     </operations>
3362d5
                 </primitive>
3362d5
             </resources>""",
3362d5
-            output_start="Warning: Validation result from agent:",
3362d5
         )
3362d5
 
3362d5
 
3362d5
diff --git a/pcs_test/tier1/legacy/test_resource.py b/pcs_test/tier1/legacy/test_resource.py
3362d5
index 65ad1090..f4424a58 100644
3362d5
--- a/pcs_test/tier1/legacy/test_resource.py
3362d5
+++ b/pcs_test/tier1/legacy/test_resource.py
3362d5
@@ -5809,7 +5809,13 @@ class UpdateInstanceAttrs(
3362d5
     def test_agent_self_validation_failure(self):
3362d5
         self.fixture_resource()
3362d5
         self.assert_pcs_fail(
3362d5
-            ["resource", "update", "R", "fake=is_invalid=True"],
3362d5
+            [
3362d5
+                "resource",
3362d5
+                "update",
3362d5
+                "R",
3362d5
+                "fake=is_invalid=True",
3362d5
+                "--agent-validation",
3362d5
+            ],
3362d5
             stdout_start="Error: Validation result from agent (use --force to override):",
3362d5
         )
3362d5
 
3362d5
diff --git a/pcs_test/tier1/legacy/test_stonith.py b/pcs_test/tier1/legacy/test_stonith.py
3362d5
index cf430d75..c528c921 100644
3362d5
--- a/pcs_test/tier1/legacy/test_stonith.py
3362d5
+++ b/pcs_test/tier1/legacy/test_stonith.py
3362d5
@@ -1286,6 +1286,27 @@ class StonithTest(TestCase, AssertPcsMixin):
3362d5
             "Deleting Resource - apc-fencing\n",
3362d5
         )
3362d5
 
3362d5
+        self.assert_pcs_fail(
3362d5
+            (
3362d5
+                "stonith create apc-fencing fence_apc ip=morph-apc username=apc "
3362d5
+                "--agent-validation"
3362d5
+            ).split(),
3362d5
+            stdout_start="Error: Validation result from agent",
3362d5
+        )
3362d5
+
3362d5
+        self.assert_pcs_success(
3362d5
+            (
3362d5
+                "stonith create apc-fencing fence_apc ip=morph-apc username=apc "
3362d5
+                "--agent-validation --force"
3362d5
+            ).split(),
3362d5
+            stdout_start="Warning: Validation result from agent",
3362d5
+        )
3362d5
+
3362d5
+        self.assert_pcs_success(
3362d5
+            "stonith remove apc-fencing".split(),
3362d5
+            stdout_full="Deleting Resource - apc-fencing\n",
3362d5
+        )
3362d5
+
3362d5
         self.assert_pcs_fail(
3362d5
             "stonith update test3 bad_ipaddr=test username=login".split(),
3362d5
             stdout_regexp=(
3362d5
@@ -1295,8 +1316,8 @@ class StonithTest(TestCase, AssertPcsMixin):
3362d5
         )
3362d5
 
3362d5
         self.assert_pcs_success(
3362d5
-            "stonith update test3 username=testA".split(),
3362d5
-            stdout_start="Warning: ",
3362d5
+            "stonith update test3 username=testA --agent-validation".split(),
3362d5
+            stdout_start="Warning: The resource was misconfigured before the update,",
3362d5
         )
3362d5
 
3362d5
         self.assert_pcs_success(
3362d5
-- 
3362d5
2.39.0
3362d5