From ffe53b2626ddd3917f1c570e24b144307145df30 Mon Sep 17 00:00:00 2001 From: Packit Service Date: Feb 05 2021 06:16:25 +0000 Subject: Prepare for a new update Reverting patches so we can apply the latest update and changes can be seen in the spec file and sources. --- diff --git a/configure.ac b/configure.ac index 66faa47..5a3afa8 100644 --- a/configure.ac +++ b/configure.ac @@ -2017,8 +2017,6 @@ AC_CONFIG_FILES(Makefile \ lib/pacemaker-cluster.pc \ lib/common/Makefile \ lib/common/tests/Makefile \ - lib/common/tests/agents/Makefile \ - lib/common/tests/cmdline/Makefile \ lib/common/tests/flags/Makefile \ lib/common/tests/operations/Makefile \ lib/common/tests/strings/Makefile \ diff --git a/cts/Makefile.am b/cts/Makefile.am index de02aed..6abb42f 100644 --- a/cts/Makefile.am +++ b/cts/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2001-2021 the Pacemaker project contributors +# Copyright 2001-2019 the Pacemaker project contributors # # The version control history for this file may have further details. # @@ -60,12 +60,10 @@ cts_SCRIPTS = CTSlab.py \ pacemaker-cts-dummyd clidir = $(testdir)/cli -dist_cli_DATA = cli/constraints.xml \ - cli/crm_diff_new.xml \ +dist_cli_DATA = cli/crm_diff_new.xml \ cli/crm_diff_old.xml \ cli/crm_mon.xml \ cli/crm_mon-partial.xml \ - cli/crm_resource_digests.xml \ cli/regression.acls.exp \ cli/regression.crm_mon.exp \ cli/regression.dates.exp \ diff --git a/cts/cli/constraints.xml b/cts/cli/constraints.xml deleted file mode 100644 index 1a27aa7..0000000 --- a/cts/cli/constraints.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cts/cli/crm_resource_digests.xml b/cts/cli/crm_resource_digests.xml deleted file mode 100644 index 074ca3d..0000000 --- a/cts/cli/crm_resource_digests.xml +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cts/cli/regression.crm_mon.exp b/cts/cli/regression.crm_mon.exp index 43c1d9a..b7a9093 100644 --- a/cts/cli/regression.crm_mon.exp +++ b/cts/cli/regression.crm_mon.exp @@ -125,39 +125,39 @@ Active Resources: - - + + - - + + - + - + - - + + - - + + - - + + - + - - + + @@ -285,39 +285,39 @@ Active Resources: - - + + - - + + - + - + - - + + - - + + - - + + - + - - + + @@ -480,13 +480,13 @@ Node List: * Online: [ cluster01 cluster02 ] Active Resources: - * 1 (ocf::pacemaker:Dummy): Active cluster02 - * 1 (stonith:fence_xvm): Active cluster01 + * 1 (ocf::pacemaker:Dummy): Active cluster02 + * 1 (stonith:fence_xvm): Active cluster01 * Clone Set: ping-clone [ping]: * Started: [ cluster01 cluster02 ] * Resource Group: exim-group: - * 1/1 (lsb:exim): Active cluster02 - * 1/1 (ocf::heartbeat:IPaddr): Active cluster02 + * 1/1 (lsb:exim): Active cluster02 + * 1/1 (ocf::heartbeat:IPaddr): Active cluster02 * Clone Set: mysql-clone-group [mysql-group]: * Started: [ cluster01 cluster02 ] @@ -609,16 +609,16 @@ Cluster Summary: Node List: * Node cluster01: online: * Resources: - * 1 (lsb:mysql-proxy): Active - * 1 (ocf::pacemaker:ping): Active - * 1 (stonith:fence_xvm): Active + * 1 (lsb:mysql-proxy): Active + * 1 (ocf::pacemaker:ping): Active + * 1 (stonith:fence_xvm): Active * Node cluster02: online: * Resources: - * 1 (lsb:exim): Active - * 1 (lsb:mysql-proxy): Active - * 1 (ocf::heartbeat:IPaddr): Active - * 1 (ocf::pacemaker:Dummy): Active - * 1 (ocf::pacemaker:ping): Active + * 1 (lsb:exim): Active + * 1 (lsb:mysql-proxy): Active + * 1 (ocf::heartbeat:IPaddr): Active + * 1 (ocf::pacemaker:Dummy): Active + * 1 (ocf::pacemaker:ping): Active Node Attributes: * Node: cluster01: @@ -766,39 +766,39 @@ Negative Location Constraints: - - + + - - + + - + - + - - + + - - + + - - + + - + - - + + @@ -928,19 +928,19 @@ Negative Location Constraints: - - + + - - + + - + - - + + @@ -1081,22 +1081,22 @@ Negative Location Constraints: - - + + - - + + - + - + - - + + @@ -1171,8 +1171,8 @@ Operations: - - + + @@ -1371,8 +1371,8 @@ Operations: - - + + @@ -1452,10 +1452,10 @@ Operations: - + - + @@ -1529,7 +1529,7 @@ Operations: - + @@ -1611,14 +1611,14 @@ Operations: - - + + - - + + @@ -1700,14 +1700,14 @@ Operations: - - + + - - + + @@ -1786,14 +1786,14 @@ Operations: - - + + - - + + @@ -2257,14 +2257,14 @@ Operations: - - + + - - + + @@ -2368,14 +2368,14 @@ Operations: - - + + - - + + @@ -2457,14 +2457,14 @@ Operations: - - + + - - + + @@ -2568,14 +2568,14 @@ Operations: - - + + - - + + @@ -2657,14 +2657,14 @@ Operations: - - + + - - + + @@ -2770,46 +2770,46 @@ Active Resources: - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - + @@ -2857,7 +2857,7 @@ Node List: * GuestOnline: [ httpd-bundle-0@cluster02 httpd-bundle-1@cluster01 ] Full List of Resources: - * 1/1 (stonith:fence_xvm): Active cluster01 + * 1/1 (stonith:fence_xvm): Active cluster01 * Clone Set: ping-clone [ping]: * Started: [ cluster01 ] * Stopped: [ cluster02 ] @@ -2865,7 +2865,7 @@ Full List of Resources: * httpd-bundle-0 (192.168.122.131) (ocf::heartbeat:apache): Started cluster02 * httpd-bundle-1 (192.168.122.132) (ocf::heartbeat:apache): Stopped cluster01 * Resource Group: partially-active-group: - * 1/2 (ocf::pacemaker:Dummy): Active cluster02 + * 1/2 (ocf::pacemaker:Dummy): Active cluster02 Node Attributes: * Node: cluster01: @@ -2919,20 +2919,20 @@ Cluster Summary: Node List: * Node cluster01: online: * Resources: - * 1 (ocf::heartbeat:IPaddr2): Active - * 1 (ocf::heartbeat:docker): Active - * 1 (ocf::pacemaker:ping): Active - * 1 (ocf::pacemaker:remote): Active - * 1 (stonith:fence_xvm): Active + * 1 (ocf::heartbeat:IPaddr2): Active + * 1 (ocf::heartbeat:docker): Active + * 1 (ocf::pacemaker:ping): Active + * 1 (ocf::pacemaker:remote): Active + * 1 (stonith:fence_xvm): Active * Node cluster02: online: * Resources: - * 1 (ocf::heartbeat:IPaddr2): Active - * 1 (ocf::heartbeat:docker): Active - * 1 (ocf::pacemaker:Dummy): Active - * 1 (ocf::pacemaker:remote): Active + * 1 (ocf::heartbeat:IPaddr2): Active + * 1 (ocf::heartbeat:docker): Active + * 1 (ocf::pacemaker:Dummy): Active + * 1 (ocf::pacemaker:remote): Active * GuestNode httpd-bundle-0@cluster02: online: * Resources: - * 1 (ocf::heartbeat:apache): Active + * 1 (ocf::heartbeat:apache): Active Inactive Resources: * Clone Set: ping-clone [ping]: @@ -2942,7 +2942,7 @@ Inactive Resources: * httpd-bundle-0 (192.168.122.131) (ocf::heartbeat:apache): Started cluster02 * httpd-bundle-1 (192.168.122.132) (ocf::heartbeat:apache): Stopped cluster01 * Resource Group: partially-active-group: - * 1/2 (ocf::pacemaker:Dummy): Active cluster02 + * 1/2 (ocf::pacemaker:Dummy): Active cluster02 Node Attributes: * Node: cluster01: @@ -3051,24 +3051,24 @@ Full List of Resources: - - + + - - + + - - + + - - + + - - + + diff --git a/cts/cli/regression.tools.exp b/cts/cli/regression.tools.exp index 510cc0a..35e7a8c 100644 --- a/cts/cli/regression.tools.exp +++ b/cts/cli/regression.tools.exp @@ -876,7 +876,9 @@ Set 'dummy' option: id=dummy-meta_attributes-target-role set=dummy-meta_attribut * Passed: crm_resource - Create another resource meta attribute =#=#=#= Begin test: Show why a resource is not running =#=#=#= Resource dummy is not running -Configuration specifies 'dummy' should remain stopped + + * Configuration specifies 'dummy' should remain stopped + =#=#=#= End test: Show why a resource is not running - OK (0) =#=#=#= * Passed: crm_resource - Show why a resource is not running =#=#=#= Begin test: Remove another resource meta attribute =#=#=#= @@ -924,8 +926,7 @@ Set 'dummy' option: id=dummy-instance_attributes-delay set=dummy-instance_attrib =#=#=#= End test: Create a resource attribute - OK (0) =#=#=#= * Passed: crm_resource - Create a resource attribute =#=#=#= Begin test: List the configured resources =#=#=#= -Full List of Resources: - * dummy (ocf::pacemaker:Dummy): Stopped + dummy (ocf::pacemaker:Dummy): Stopped =#=#=#= Current cib after: List the configured resources =#=#=#= @@ -969,14 +970,15 @@ dummy =#=#=#= End test: List IDs of instantiated resources - OK (0) =#=#=#= * Passed: crm_resource - List IDs of instantiated resources =#=#=#= Begin test: Show XML configuration of resource =#=#=#= -dummy (ocf::pacemaker:Dummy): Stopped -Resource XML: + dummy (ocf::pacemaker:Dummy): Stopped +xml: + =#=#=#= End test: Show XML configuration of resource - OK (0) =#=#=#= * Passed: crm_resource - Show XML configuration of resource =#=#=#= Begin test: Require a destination when migrating a resource that is stopped =#=#=#= @@ -2001,12 +2003,12 @@ WARNING: Creating rsc_location constraint 'cli-ban-dummy-on-node1' with a score =#=#=#= End test: Ban dummy from node1 - OK (0) =#=#=#= * Passed: crm_resource - Ban dummy from node1 =#=#=#= Begin test: Show where a resource is running =#=#=#= -resource dummy is running on: node1 +resource dummy is running on: node1 =#=#=#= End test: Show where a resource is running - OK (0) =#=#=#= * Passed: crm_resource - Show where a resource is running =#=#=#= Begin test: Show constraints on a resource =#=#=#= -Locations: - * Node node1 (score=-INFINITY, id=cli-ban-dummy-on-node1, rsc=dummy) +* dummy + : Node node1 (score=-INFINITY, id=cli-ban-dummy-on-node1) =#=#=#= End test: Show constraints on a resource - OK (0) =#=#=#= * Passed: crm_resource - Show constraints on a resource =#=#=#= Begin test: Ban dummy from node2 =#=#=#= @@ -3221,10 +3223,10 @@ Migration will take effect until: =#=#=#= End test: Try to move a resource previously moved with a lifetime - OK (0) =#=#=#= * Passed: crm_resource - Try to move a resource previously moved with a lifetime =#=#=#= Begin test: Ban dummy from node1 for a short time =#=#=#= -Migration will take effect until: WARNING: Creating rsc_location constraint 'cli-ban-dummy-on-node1' with a score of -INFINITY for resource dummy on node1. This will prevent dummy from running on node1 until the constraint is removed using the clear option or by editing the CIB with an appropriate tool This will be the case even if node1 is the last node in the cluster +Migration will take effect until: =#=#=#= Current cib after: Ban dummy from node1 for a short time =#=#=#= @@ -3469,587 +3471,3 @@ Removing constraint: cli-prefer-dummy =#=#=#= End test: Create an XML patchset - Error occurred (1) =#=#=#= * Passed: crm_diff - Create an XML patchset -=#=#=#= Begin test: Check locations and constraints for prim1 =#=#=#= -=#=#=#= End test: Check locations and constraints for prim1 - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for prim1 -=#=#=#= Begin test: Recursively check locations and constraints for prim1 =#=#=#= -=#=#=#= End test: Recursively check locations and constraints for prim1 - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for prim1 -=#=#=#= Begin test: Check locations and constraints for prim1 in XML =#=#=#= - - - - -=#=#=#= End test: Check locations and constraints for prim1 in XML - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for prim1 in XML -=#=#=#= Begin test: Recursively check locations and constraints for prim1 in XML =#=#=#= - - - - -=#=#=#= End test: Recursively check locations and constraints for prim1 in XML - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for prim1 in XML -=#=#=#= Begin test: Check locations and constraints for prim2 =#=#=#= -Locations: - * Node cluster01 (score=INFINITY, id=prim2-on-cluster1, rsc=prim2) -Resources prim2 is colocated with: - * prim3 (score=INFINITY, id=colocation-prim2-prim3-INFINITY) -=#=#=#= End test: Check locations and constraints for prim2 - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for prim2 -=#=#=#= Begin test: Recursively check locations and constraints for prim2 =#=#=#= -Locations: - * Node cluster01 (score=INFINITY, id=prim2-on-cluster1, rsc=prim2) -Resources prim2 is colocated with: - * prim3 (score=INFINITY, id=colocation-prim2-prim3-INFINITY) - * Resources prim3 is colocated with: - * prim4 (score=INFINITY, id=colocation-prim3-prim4-INFINITY) - * Locations: - * Node cluster02 (score=INFINITY, id=prim4-on-cluster2, rsc=prim4) - * Resources prim4 is colocated with: - * prim5 (score=INFINITY, id=colocation-prim4-prim5-INFINITY) -=#=#=#= End test: Recursively check locations and constraints for prim2 - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for prim2 -=#=#=#= Begin test: Check locations and constraints for prim2 in XML =#=#=#= - - - - - - - -=#=#=#= End test: Check locations and constraints for prim2 in XML - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for prim2 in XML -=#=#=#= Begin test: Recursively check locations and constraints for prim2 in XML =#=#=#= - - - - - - - - - - -=#=#=#= End test: Recursively check locations and constraints for prim2 in XML - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for prim2 in XML -=#=#=#= Begin test: Check locations and constraints for prim3 =#=#=#= -Resources colocated with prim3: - * prim2 (score=INFINITY, id=colocation-prim2-prim3-INFINITY) - * Locations: - * Node cluster01 (score=INFINITY, id=prim2-on-cluster1, rsc=prim2) -Resources prim3 is colocated with: - * prim4 (score=INFINITY, id=colocation-prim3-prim4-INFINITY) - * Locations: - * Node cluster02 (score=INFINITY, id=prim4-on-cluster2, rsc=prim4) -=#=#=#= End test: Check locations and constraints for prim3 - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for prim3 -=#=#=#= Begin test: Recursively check locations and constraints for prim3 =#=#=#= -Resources colocated with prim3: - * prim2 (score=INFINITY, id=colocation-prim2-prim3-INFINITY) - * Locations: - * Node cluster01 (score=INFINITY, id=prim2-on-cluster1, rsc=prim2) -Resources prim3 is colocated with: - * prim4 (score=INFINITY, id=colocation-prim3-prim4-INFINITY) - * Locations: - * Node cluster02 (score=INFINITY, id=prim4-on-cluster2, rsc=prim4) - * Resources prim4 is colocated with: - * prim5 (score=INFINITY, id=colocation-prim4-prim5-INFINITY) -=#=#=#= End test: Recursively check locations and constraints for prim3 - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for prim3 -=#=#=#= Begin test: Check locations and constraints for prim3 in XML =#=#=#= - - - - - - - - - -=#=#=#= End test: Check locations and constraints for prim3 in XML - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for prim3 in XML -=#=#=#= Begin test: Recursively check locations and constraints for prim3 in XML =#=#=#= - - - - - - - - - - -=#=#=#= End test: Recursively check locations and constraints for prim3 in XML - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for prim3 in XML -=#=#=#= Begin test: Check locations and constraints for prim4 =#=#=#= -Locations: - * Node cluster02 (score=INFINITY, id=prim4-on-cluster2, rsc=prim4) -Resources colocated with prim4: - * prim10 (score=INFINITY, id=colocation-prim10-prim4-INFINITY) - * prim3 (score=INFINITY, id=colocation-prim3-prim4-INFINITY) -Resources prim4 is colocated with: - * prim5 (score=INFINITY, id=colocation-prim4-prim5-INFINITY) -=#=#=#= End test: Check locations and constraints for prim4 - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for prim4 -=#=#=#= Begin test: Recursively check locations and constraints for prim4 =#=#=#= -Locations: - * Node cluster02 (score=INFINITY, id=prim4-on-cluster2, rsc=prim4) -Resources colocated with prim4: - * prim10 (score=INFINITY, id=colocation-prim10-prim4-INFINITY) - * prim3 (score=INFINITY, id=colocation-prim3-prim4-INFINITY) - * Resources colocated with prim3: - * prim2 (score=INFINITY, id=colocation-prim2-prim3-INFINITY) - * Locations: - * Node cluster01 (score=INFINITY, id=prim2-on-cluster1, rsc=prim2) -Resources prim4 is colocated with: - * prim5 (score=INFINITY, id=colocation-prim4-prim5-INFINITY) -=#=#=#= End test: Recursively check locations and constraints for prim4 - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for prim4 -=#=#=#= Begin test: Check locations and constraints for prim4 in XML =#=#=#= - - - - - - - - - -=#=#=#= End test: Check locations and constraints for prim4 in XML - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for prim4 in XML -=#=#=#= Begin test: Recursively check locations and constraints for prim4 in XML =#=#=#= - - - - - - - - - - - -=#=#=#= End test: Recursively check locations and constraints for prim4 in XML - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for prim4 in XML -=#=#=#= Begin test: Check locations and constraints for prim5 =#=#=#= -Resources colocated with prim5: - * prim4 (score=INFINITY, id=colocation-prim4-prim5-INFINITY) - * Locations: - * Node cluster02 (score=INFINITY, id=prim4-on-cluster2, rsc=prim4) -=#=#=#= End test: Check locations and constraints for prim5 - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for prim5 -=#=#=#= Begin test: Recursively check locations and constraints for prim5 =#=#=#= -Resources colocated with prim5: - * prim4 (score=INFINITY, id=colocation-prim4-prim5-INFINITY) - * Locations: - * Node cluster02 (score=INFINITY, id=prim4-on-cluster2, rsc=prim4) - * Resources colocated with prim4: - * prim10 (score=INFINITY, id=colocation-prim10-prim4-INFINITY) - * prim3 (score=INFINITY, id=colocation-prim3-prim4-INFINITY) - * Resources colocated with prim3: - * prim2 (score=INFINITY, id=colocation-prim2-prim3-INFINITY) - * Locations: - * Node cluster01 (score=INFINITY, id=prim2-on-cluster1, rsc=prim2) -=#=#=#= End test: Recursively check locations and constraints for prim5 - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for prim5 -=#=#=#= Begin test: Check locations and constraints for prim5 in XML =#=#=#= - - - - - - - -=#=#=#= End test: Check locations and constraints for prim5 in XML - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for prim5 in XML -=#=#=#= Begin test: Recursively check locations and constraints for prim5 in XML =#=#=#= - - - - - - - - - - - -=#=#=#= End test: Recursively check locations and constraints for prim5 in XML - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for prim5 in XML -=#=#=#= Begin test: Check locations and constraints for prim6 =#=#=#= -Locations: - * Node cluster02 (score=-INFINITY, id=prim6-not-on-cluster2, rsc=prim6) -=#=#=#= End test: Check locations and constraints for prim6 - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for prim6 -=#=#=#= Begin test: Recursively check locations and constraints for prim6 =#=#=#= -Locations: - * Node cluster02 (score=-INFINITY, id=prim6-not-on-cluster2, rsc=prim6) -=#=#=#= End test: Recursively check locations and constraints for prim6 - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for prim6 -=#=#=#= Begin test: Check locations and constraints for prim6 in XML =#=#=#= - - - - - - -=#=#=#= End test: Check locations and constraints for prim6 in XML - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for prim6 in XML -=#=#=#= Begin test: Recursively check locations and constraints for prim6 in XML =#=#=#= - - - - - - -=#=#=#= End test: Recursively check locations and constraints for prim6 in XML - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for prim6 in XML -=#=#=#= Begin test: Check locations and constraints for prim7 =#=#=#= -Resources prim7 is colocated with: - * group (score=INFINITY, id=colocation-prim7-group-INFINITY) -=#=#=#= End test: Check locations and constraints for prim7 - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for prim7 -=#=#=#= Begin test: Recursively check locations and constraints for prim7 =#=#=#= -Resources prim7 is colocated with: - * group (score=INFINITY, id=colocation-prim7-group-INFINITY) -=#=#=#= End test: Recursively check locations and constraints for prim7 - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for prim7 -=#=#=#= Begin test: Check locations and constraints for prim7 in XML =#=#=#= - - - - - - -=#=#=#= End test: Check locations and constraints for prim7 in XML - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for prim7 in XML -=#=#=#= Begin test: Recursively check locations and constraints for prim7 in XML =#=#=#= - - - - - - -=#=#=#= End test: Recursively check locations and constraints for prim7 in XML - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for prim7 in XML -=#=#=#= Begin test: Check locations and constraints for prim8 =#=#=#= -Resources prim8 is colocated with: - * gr2 (score=INFINITY, id=colocation-prim8-gr2-INFINITY) -=#=#=#= End test: Check locations and constraints for prim8 - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for prim8 -=#=#=#= Begin test: Recursively check locations and constraints for prim8 =#=#=#= -Resources prim8 is colocated with: - * gr2 (score=INFINITY, id=colocation-prim8-gr2-INFINITY) -=#=#=#= End test: Recursively check locations and constraints for prim8 - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for prim8 -=#=#=#= Begin test: Check locations and constraints for prim8 in XML =#=#=#= - - - - - - -=#=#=#= End test: Check locations and constraints for prim8 in XML - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for prim8 in XML -=#=#=#= Begin test: Recursively check locations and constraints for prim8 in XML =#=#=#= - - - - - - -=#=#=#= End test: Recursively check locations and constraints for prim8 in XML - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for prim8 in XML -=#=#=#= Begin test: Check locations and constraints for prim9 =#=#=#= -Resources prim9 is colocated with: - * clone (score=INFINITY, id=colocation-prim9-clone-INFINITY) -=#=#=#= End test: Check locations and constraints for prim9 - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for prim9 -=#=#=#= Begin test: Recursively check locations and constraints for prim9 =#=#=#= -Resources prim9 is colocated with: - * clone (score=INFINITY, id=colocation-prim9-clone-INFINITY) -=#=#=#= End test: Recursively check locations and constraints for prim9 - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for prim9 -=#=#=#= Begin test: Check locations and constraints for prim9 in XML =#=#=#= - - - - - - -=#=#=#= End test: Check locations and constraints for prim9 in XML - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for prim9 in XML -=#=#=#= Begin test: Recursively check locations and constraints for prim9 in XML =#=#=#= - - - - - - -=#=#=#= End test: Recursively check locations and constraints for prim9 in XML - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for prim9 in XML -=#=#=#= Begin test: Check locations and constraints for prim10 =#=#=#= -Resources prim10 is colocated with: - * prim4 (score=INFINITY, id=colocation-prim10-prim4-INFINITY) - * Locations: - * Node cluster02 (score=INFINITY, id=prim4-on-cluster2, rsc=prim4) -=#=#=#= End test: Check locations and constraints for prim10 - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for prim10 -=#=#=#= Begin test: Recursively check locations and constraints for prim10 =#=#=#= -Resources prim10 is colocated with: - * prim4 (score=INFINITY, id=colocation-prim10-prim4-INFINITY) - * Locations: - * Node cluster02 (score=INFINITY, id=prim4-on-cluster2, rsc=prim4) - * Resources prim4 is colocated with: - * prim5 (score=INFINITY, id=colocation-prim4-prim5-INFINITY) -=#=#=#= End test: Recursively check locations and constraints for prim10 - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for prim10 -=#=#=#= Begin test: Check locations and constraints for prim10 in XML =#=#=#= - - - - - - - -=#=#=#= End test: Check locations and constraints for prim10 in XML - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for prim10 in XML -=#=#=#= Begin test: Recursively check locations and constraints for prim10 in XML =#=#=#= - - - - - - - - -=#=#=#= End test: Recursively check locations and constraints for prim10 in XML - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for prim10 in XML -=#=#=#= Begin test: Check locations and constraints for prim11 =#=#=#= -Resources colocated with prim11: - * prim13 (score=INFINITY, id=colocation-prim13-prim11-INFINITY) -Resources prim11 is colocated with: - * prim12 (score=INFINITY, id=colocation-prim11-prim12-INFINITY) -=#=#=#= End test: Check locations and constraints for prim11 - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for prim11 -=#=#=#= Begin test: Recursively check locations and constraints for prim11 =#=#=#= -Resources colocated with prim11: - * prim13 (score=INFINITY, id=colocation-prim13-prim11-INFINITY) - * Resources colocated with prim13: - * prim12 (score=INFINITY, id=colocation-prim12-prim13-INFINITY) - * Resources colocated with prim12: - * prim11 (id=colocation-prim11-prim12-INFINITY - loop) -Resources prim11 is colocated with: - * prim12 (score=INFINITY, id=colocation-prim11-prim12-INFINITY) - * Resources prim12 is colocated with: - * prim13 (score=INFINITY, id=colocation-prim12-prim13-INFINITY) - * Resources prim13 is colocated with: - * prim11 (id=colocation-prim13-prim11-INFINITY - loop) -=#=#=#= End test: Recursively check locations and constraints for prim11 - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for prim11 -=#=#=#= Begin test: Check locations and constraints for prim11 in XML =#=#=#= - - - - - - - -=#=#=#= End test: Check locations and constraints for prim11 in XML - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for prim11 in XML -=#=#=#= Begin test: Recursively check locations and constraints for prim11 in XML =#=#=#= - - - - - - - - - - - -=#=#=#= End test: Recursively check locations and constraints for prim11 in XML - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for prim11 in XML -=#=#=#= Begin test: Check locations and constraints for prim12 =#=#=#= -Resources colocated with prim12: - * prim11 (score=INFINITY, id=colocation-prim11-prim12-INFINITY) -Resources prim12 is colocated with: - * prim13 (score=INFINITY, id=colocation-prim12-prim13-INFINITY) -=#=#=#= End test: Check locations and constraints for prim12 - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for prim12 -=#=#=#= Begin test: Recursively check locations and constraints for prim12 =#=#=#= -Resources colocated with prim12: - * prim11 (score=INFINITY, id=colocation-prim11-prim12-INFINITY) - * Resources colocated with prim11: - * prim13 (score=INFINITY, id=colocation-prim13-prim11-INFINITY) - * Resources colocated with prim13: - * prim12 (id=colocation-prim12-prim13-INFINITY - loop) -Resources prim12 is colocated with: - * prim13 (score=INFINITY, id=colocation-prim12-prim13-INFINITY) - * Resources prim13 is colocated with: - * prim11 (score=INFINITY, id=colocation-prim13-prim11-INFINITY) - * Resources prim11 is colocated with: - * prim12 (id=colocation-prim11-prim12-INFINITY - loop) -=#=#=#= End test: Recursively check locations and constraints for prim12 - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for prim12 -=#=#=#= Begin test: Check locations and constraints for prim12 in XML =#=#=#= - - - - - - - -=#=#=#= End test: Check locations and constraints for prim12 in XML - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for prim12 in XML -=#=#=#= Begin test: Recursively check locations and constraints for prim12 in XML =#=#=#= - - - - - - - - - - - -=#=#=#= End test: Recursively check locations and constraints for prim12 in XML - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for prim12 in XML -=#=#=#= Begin test: Check locations and constraints for prim13 =#=#=#= -Resources colocated with prim13: - * prim12 (score=INFINITY, id=colocation-prim12-prim13-INFINITY) -Resources prim13 is colocated with: - * prim11 (score=INFINITY, id=colocation-prim13-prim11-INFINITY) -=#=#=#= End test: Check locations and constraints for prim13 - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for prim13 -=#=#=#= Begin test: Recursively check locations and constraints for prim13 =#=#=#= -Resources colocated with prim13: - * prim12 (score=INFINITY, id=colocation-prim12-prim13-INFINITY) - * Resources colocated with prim12: - * prim11 (score=INFINITY, id=colocation-prim11-prim12-INFINITY) - * Resources colocated with prim11: - * prim13 (id=colocation-prim13-prim11-INFINITY - loop) -Resources prim13 is colocated with: - * prim11 (score=INFINITY, id=colocation-prim13-prim11-INFINITY) - * Resources prim11 is colocated with: - * prim12 (score=INFINITY, id=colocation-prim11-prim12-INFINITY) - * Resources prim12 is colocated with: - * prim13 (id=colocation-prim12-prim13-INFINITY - loop) -=#=#=#= End test: Recursively check locations and constraints for prim13 - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for prim13 -=#=#=#= Begin test: Check locations and constraints for prim13 in XML =#=#=#= - - - - - - - -=#=#=#= End test: Check locations and constraints for prim13 in XML - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for prim13 in XML -=#=#=#= Begin test: Recursively check locations and constraints for prim13 in XML =#=#=#= - - - - - - - - - - - -=#=#=#= End test: Recursively check locations and constraints for prim13 in XML - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for prim13 in XML -=#=#=#= Begin test: Check locations and constraints for group =#=#=#= -Resources colocated with group: - * prim7 (score=INFINITY, id=colocation-prim7-group-INFINITY) -=#=#=#= End test: Check locations and constraints for group - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for group -=#=#=#= Begin test: Recursively check locations and constraints for group =#=#=#= -Resources colocated with group: - * prim7 (score=INFINITY, id=colocation-prim7-group-INFINITY) -=#=#=#= End test: Recursively check locations and constraints for group - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for group -=#=#=#= Begin test: Check locations and constraints for group in XML =#=#=#= - - - - - - -=#=#=#= End test: Check locations and constraints for group in XML - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for group in XML -=#=#=#= Begin test: Recursively check locations and constraints for group in XML =#=#=#= - - - - - - -=#=#=#= End test: Recursively check locations and constraints for group in XML - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for group in XML -=#=#=#= Begin test: Check locations and constraints for clone =#=#=#= -Resources colocated with clone: - * prim9 (score=INFINITY, id=colocation-prim9-clone-INFINITY) -=#=#=#= End test: Check locations and constraints for clone - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for clone -=#=#=#= Begin test: Recursively check locations and constraints for clone =#=#=#= -Resources colocated with clone: - * prim9 (score=INFINITY, id=colocation-prim9-clone-INFINITY) -=#=#=#= End test: Recursively check locations and constraints for clone - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for clone -=#=#=#= Begin test: Check locations and constraints for clone in XML =#=#=#= - - - - - - -=#=#=#= End test: Check locations and constraints for clone in XML - OK (0) =#=#=#= -* Passed: crm_resource - Check locations and constraints for clone in XML -=#=#=#= Begin test: Recursively check locations and constraints for clone in XML =#=#=#= - - - - - - -=#=#=#= End test: Recursively check locations and constraints for clone in XML - OK (0) =#=#=#= -* Passed: crm_resource - Recursively check locations and constraints for clone in XML -=#=#=#= Begin test: Show resource digests =#=#=#= - - - - - - - - - - - - - - -=#=#=#= End test: Show resource digests - OK (0) =#=#=#= -* Passed: crm_resource - Show resource digests -=#=#=#= Begin test: Show resource digests with overrides =#=#=#= - - - - - - - - - - - - - - -=#=#=#= End test: Show resource digests with overrides - OK (0) =#=#=#= -* Passed: crm_resource - Show resource digests with overrides diff --git a/cts/cli/regression.upgrade.exp b/cts/cli/regression.upgrade.exp index 2210ba7..10f6309 100644 --- a/cts/cli/regression.upgrade.exp +++ b/cts/cli/regression.upgrade.exp @@ -85,11 +85,8 @@ update_validation debug: Configuration valid for schema: pacemaker-3.4 update_validation debug: pacemaker-3.4-style configuration is also valid for pacemaker-3.5 update_validation debug: Testing 'pacemaker-3.5' validation (19 of X) update_validation debug: Configuration valid for schema: pacemaker-3.5 -update_validation debug: pacemaker-3.5-style configuration is also valid for pacemaker-3.6 -update_validation debug: Testing 'pacemaker-3.6' validation (20 of X) -update_validation debug: Configuration valid for schema: pacemaker-3.6 -update_validation trace: Stopping at pacemaker-3.6 -update_validation info: Transformed the configuration from pacemaker-2.10 to pacemaker-3.6 +update_validation trace: Stopping at pacemaker-3.5 +update_validation info: Transformed the configuration from pacemaker-2.10 to pacemaker-3.5 =#=#=#= Current cib after: Upgrade to latest CIB schema (trigger 2.10.xsl + the wrapping) =#=#=#= diff --git a/cts/cli/regression.validity.exp b/cts/cli/regression.validity.exp index bd6f499..88ca98e 100644 --- a/cts/cli/regression.validity.exp +++ b/cts/cli/regression.validity.exp @@ -113,11 +113,7 @@ update_validation debug: Testing 'pacemaker-3.5' validation (19 of X) element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order update_validation trace: pacemaker-3.5 validation failed -update_validation debug: Testing 'pacemaker-3.6' validation (20 of X) -element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order -element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order -update_validation trace: pacemaker-3.6 validation failed -Cannot upgrade configuration (claiming schema pacemaker-1.2) to at least pacemaker-3.0 because it does not validate with any schema from pacemaker-1.2 to pacemaker-3.6 +Cannot upgrade configuration (claiming schema pacemaker-1.2) to at least pacemaker-3.0 because it does not validate with any schema from pacemaker-1.2 to pacemaker-3.5 =#=#=#= End test: Run crm_simulate with invalid CIB (enum violation) - Invalid configuration (78) =#=#=#= * Passed: crm_simulate - Run crm_simulate with invalid CIB (enum violation) =#=#=#= Begin test: Try to make resulting CIB invalid (unrecognized validate-with) =#=#=#= @@ -216,10 +212,7 @@ update_validation trace: pacemaker-3.4 validation failed update_validation debug: Testing 'pacemaker-3.5' validation (19 of X) element cib: Relax-NG validity error : Invalid attribute validate-with for element cib update_validation trace: pacemaker-3.5 validation failed -update_validation debug: Testing 'pacemaker-3.6' validation (20 of X) -element cib: Relax-NG validity error : Invalid attribute validate-with for element cib -update_validation trace: pacemaker-3.6 validation failed -Cannot upgrade configuration (claiming schema pacemaker-9999.0) to at least pacemaker-3.0 because it does not validate with any schema from unknown to pacemaker-3.6 +Cannot upgrade configuration (claiming schema pacemaker-9999.0) to at least pacemaker-3.0 because it does not validate with any schema from unknown to pacemaker-3.5 =#=#=#= End test: Run crm_simulate with invalid CIB (unrecognized validate-with) - Invalid configuration (78) =#=#=#= * Passed: crm_simulate - Run crm_simulate with invalid CIB (unrecognized validate-with) =#=#=#= Begin test: Try to make resulting CIB invalid, but possibly recoverable (valid with X.Y+1) =#=#=#= @@ -313,11 +306,8 @@ update_validation debug: Configuration valid for schema: pacemaker-3.4 update_validation debug: pacemaker-3.4-style configuration is also valid for pacemaker-3.5 update_validation debug: Testing 'pacemaker-3.5' validation (19 of X) update_validation debug: Configuration valid for schema: pacemaker-3.5 -update_validation debug: pacemaker-3.5-style configuration is also valid for pacemaker-3.6 -update_validation debug: Testing 'pacemaker-3.6' validation (20 of X) -update_validation debug: Configuration valid for schema: pacemaker-3.6 -update_validation trace: Stopping at pacemaker-3.6 -update_validation info: Transformed the configuration from pacemaker-1.2 to pacemaker-3.6 +update_validation trace: Stopping at pacemaker-3.5 +update_validation info: Transformed the configuration from pacemaker-1.2 to pacemaker-3.5 unpack_resources error: Resource start-up disabled since no STONITH resources have been defined unpack_resources error: Either configure some or disable STONITH with the stonith-enabled option unpack_resources error: NOTE: Clusters with shared data need STONITH to ensure data integrity @@ -427,8 +417,6 @@ element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order -element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order -element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order =#=#=#= Current cib after: Make resulting CIB invalid, and without validate-with attribute =#=#=#= @@ -490,8 +478,6 @@ validity.bad.xml:10: element rsc_order: Relax-NG validity error : Invalid attrib validity.bad.xml:10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order validity.bad.xml:10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order validity.bad.xml:10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order -validity.bad.xml:10: element rsc_order: Relax-NG validity error : Invalid attribute first-action for element rsc_order -validity.bad.xml:10: element rsc_order: Relax-NG validity error : Element constraints has extra content: rsc_order unpack_resources error: Resource start-up disabled since no STONITH resources have been defined unpack_resources error: Either configure some or disable STONITH with the stonith-enabled option unpack_resources error: NOTE: Clusters with shared data need STONITH to ensure data integrity diff --git a/cts/cts-cli.in b/cts/cts-cli.in index 96f5386..14b4ce9 100755 --- a/cts/cts-cli.in +++ b/cts/cts-cli.in @@ -1,6 +1,6 @@ #!@BASH_PATH@ # -# Copyright 2008-2021 the Pacemaker project contributors +# Copyright 2008-2020 the Pacemaker project contributors # # The version control history for this file may have further details. # @@ -768,41 +768,6 @@ function test_tools() { desc="Create an XML patchset" cmd="crm_diff -o $test_home/cli/crm_diff_old.xml -n $test_home/cli/crm_diff_new.xml" test_assert $CRM_EX_ERROR 0 - - export CIB_file="$test_home/cli/constraints.xml" - - for rsc in prim1 prim2 prim3 prim4 prim5 prim6 prim7 prim8 prim9 \ - prim10 prim11 prim12 prim13 group clone; do - desc="Check locations and constraints for $rsc" - cmd="crm_resource -a -r $rsc" - test_assert $CRM_EX_OK 0 - - desc="Recursively check locations and constraints for $rsc" - cmd="crm_resource -A -r $rsc" - test_assert $CRM_EX_OK 0 - - desc="Check locations and constraints for $rsc in XML" - cmd="crm_resource -a -r $rsc --output-as=xml" - test_assert $CRM_EX_OK 0 - - desc="Recursively check locations and constraints for $rsc in XML" - cmd="crm_resource -A -r $rsc --output-as=xml" - test_assert $CRM_EX_OK 0 - done - - unset CIB_file - - export CIB_file="$test_home/cli/crm_resource_digests.xml" - - desc="Show resource digests" - cmd="crm_resource --digests -r rsc1 -N node1 --output-as=xml" - test_assert $CRM_EX_OK 0 - - desc="Show resource digests with overrides" - cmd="$cmd CRM_meta_interval=10000 CRM_meta_timeout=20000" - test_assert $CRM_EX_OK 0 - - unset CIB_file } INVALID_PERIODS=( @@ -1639,7 +1604,7 @@ for t in $tests; do -e 's/last_change time=\".*\"/last_change time=\"\"/' \ -e 's/ api-version=\".*\" / api-version=\"X\" /' \ -e 's/ version=\".*\" / version=\"\" /' \ - -e 's/request=\".*\(crm_[a-zA-Z0-9]*\)/request=\"\1/' \ + -e 's/request=\".*crm_mon/request=\"crm_mon/' \ -e 's/crm_feature_set="[^"]*" //'\ -e 's/validate-with="[^"]*" //'\ -e 's/Created new pacemaker-.* configuration/Created new pacemaker configuration/'\ diff --git a/cts/cts-fencing.in b/cts/cts-fencing.in index 48bf188..4444024 100644 --- a/cts/cts-fencing.in +++ b/cts/cts-fencing.in @@ -1068,7 +1068,7 @@ class Tests(object): test.add_cmd("stonith_admin", "--output-as=xml -F node3 -t 5 -V") - test.add_cmd_check_stdout("stonith_admin", "--output-as=xml -H node3", 'action="off" target="node3" .* status="success"') + test.add_cmd_check_stdout("stonith_admin", "--output-as=xml -H node3", 'status="success" .* action="off" target="node3"') # simple test of dynamic list query for test_type in test_types: @@ -1168,7 +1168,7 @@ class Tests(object): test.add_cmd("stonith_admin", "--output-as=xml -R true1 -a fence_dummy -o \"mode=pass\" -o \"pcmk_host_list=%s\"" % (our_uname)) test.add_cmd("stonith_admin", "--output-as=xml -F %s -t 3" % (our_uname)) - test.add_stonith_log_pattern("as nodeid with fence action 'off' targeting %s" % (our_uname)) + test.add_stonith_log_pattern("For stonith action (off) for victim %s, adding nodeid" % (our_uname)) ### verify nodeid is _NOT_ supplied when nodeid is not in the metadata parameters test = self.new_test("cpg_do_not_supply_nodeid", diff --git a/cts/cts-scheduler.in b/cts/cts-scheduler.in index 185addb..23e6a91 100644 --- a/cts/cts-scheduler.in +++ b/cts/cts-scheduler.in @@ -145,7 +145,6 @@ TESTS = [ [ "location-date-rules-1", "Use location constraints with ineffective date-based rules" ], [ "location-date-rules-2", "Use location constraints with effective date-based rules" ], [ "nvpair-date-rules-1", "Use nvpair blocks with a variety of date-based rules" ], - [ "value-source", "Use location constraints with node attribute expressions using value-source" ], [ "rule-dbl-as-auto-number-match", "Floating-point rule values default to number comparison: match" ], [ "rule-dbl-as-auto-number-no-match", @@ -234,7 +233,6 @@ TESTS = [ [ "complex_enforce_colo", "Always enforce B with A INFINITY. (make sure heat-engine stops)" ], [ "coloc-dependee-should-stay", "Stickiness outweighs group colocation" ], [ "coloc-dependee-should-move", "Group colocation outweighs stickiness" ], - [ "colocation-influence", "Respect colocation influence" ], ], [ [ "rsc-sets-seq-true", "Resource Sets - sequential=false" ], diff --git a/cts/scheduler/asymmetrical-order-restart.dot b/cts/scheduler/asymmetrical-order-restart.dot index 8bb3a93..d12a4a5 100644 --- a/cts/scheduler/asymmetrical-order-restart.dot +++ b/cts/scheduler/asymmetrical-order-restart.dot @@ -1,4 +1,9 @@ digraph "g" { +"cesr104ipmi_monitor_60000 cesr105-p16" [ style=bold color="green" fontcolor="black"] +"cesr104ipmi_start_0 cesr105-p16" -> "cesr104ipmi_monitor_60000 cesr105-p16" [ style = bold] +"cesr104ipmi_start_0 cesr105-p16" [ style=bold color="green" fontcolor="black"] +"cesr104ipmi_stop_0 cesr105-p16" -> "cesr104ipmi_start_0 cesr105-p16" [ style = bold] +"cesr104ipmi_stop_0 cesr105-p16" [ style=bold color="green" fontcolor="black"] "sleep_b_monitor_10000 cesr109-p16" [ style=dashed color="red" fontcolor="black"] "sleep_b_start_0 cesr109-p16" -> "sleep_b_monitor_10000 cesr109-p16" [ style = dashed] "sleep_b_start_0 cesr109-p16" [ style=dashed color="red" fontcolor="black"] diff --git a/cts/scheduler/asymmetrical-order-restart.exp b/cts/scheduler/asymmetrical-order-restart.exp index c0b627a..bb4a2c5 100644 --- a/cts/scheduler/asymmetrical-order-restart.exp +++ b/cts/scheduler/asymmetrical-order-restart.exp @@ -1,6 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cts/scheduler/asymmetrical-order-restart.scores b/cts/scheduler/asymmetrical-order-restart.scores index 49bb33d..35fd8fe 100644 --- a/cts/scheduler/asymmetrical-order-restart.scores +++ b/cts/scheduler/asymmetrical-order-restart.scores @@ -1,6 +1,4 @@ Allocation scores: -Only 'private' parameters to cesr104ipmi_monitor_60000 on cesr105-p16 changed: 0:0;1167:0:0:540ff5bf-81ee-4648-97cb-e922b82b370c -Only 'private' parameters to cesr104ipmi_start_0 on cesr105-p16 changed: 0:0;1166:0:0:540ff5bf-81ee-4648-97cb-e922b82b370c Using the original execution date of: 2018-08-09 18:55:41Z pcmk__native_allocate: cesr104ipmi allocation score on cesr105-p16: 0 pcmk__native_allocate: cesr104ipmi allocation score on cesr109-p16: 0 diff --git a/cts/scheduler/asymmetrical-order-restart.summary b/cts/scheduler/asymmetrical-order-restart.summary index 7811801..9e2e9fd 100644 --- a/cts/scheduler/asymmetrical-order-restart.summary +++ b/cts/scheduler/asymmetrical-order-restart.summary @@ -8,12 +8,14 @@ Online: [ cesr105-p16 cesr109-p16 ] sleep_a (ocf::classe:anything): Stopped (disabled) sleep_b (ocf::classe:anything): FAILED cesr109-p16 -Only 'private' parameters to cesr104ipmi_start_0 on cesr105-p16 changed: 0:0;1166:0:0:540ff5bf-81ee-4648-97cb-e922b82b370c -Only 'private' parameters to cesr104ipmi_monitor_60000 on cesr105-p16 changed: 0:0;1167:0:0:540ff5bf-81ee-4648-97cb-e922b82b370c Transition Summary: + * Restart cesr104ipmi ( cesr105-p16 ) due to resource definition change * Stop sleep_b ( cesr109-p16 ) due to unrunnable sleep_a start Executing cluster transition: + * Resource action: cesr104ipmi stop on cesr105-p16 + * Resource action: cesr104ipmi start on cesr105-p16 + * Resource action: cesr104ipmi monitor=60000 on cesr105-p16 * Resource action: sleep_b stop on cesr109-p16 Using the original execution date of: 2018-08-09 18:55:41Z diff --git a/cts/scheduler/bug-cl-5247.dot b/cts/scheduler/bug-cl-5247.dot index f5d6fa3..71e816f 100644 --- a/cts/scheduler/bug-cl-5247.dot +++ b/cts/scheduler/bug-cl-5247.dot @@ -1,4 +1,22 @@ digraph "g" { +"grpStonith1_running_0" [ style=bold color="green" fontcolor="orange"] +"grpStonith1_start_0" -> "grpStonith1_running_0" [ style = bold] +"grpStonith1_start_0" -> "prmStonith1-2_start_0 bl460g8n4" [ style = bold] +"grpStonith1_start_0" [ style=bold color="green" fontcolor="orange"] +"grpStonith1_stop_0" -> "grpStonith1_stopped_0" [ style = bold] +"grpStonith1_stop_0" -> "prmStonith1-2_stop_0 bl460g8n4" [ style = bold] +"grpStonith1_stop_0" [ style=bold color="green" fontcolor="orange"] +"grpStonith1_stopped_0" -> "grpStonith1_start_0" [ style = bold] +"grpStonith1_stopped_0" [ style=bold color="green" fontcolor="orange"] +"grpStonith2_running_0" [ style=bold color="green" fontcolor="orange"] +"grpStonith2_start_0" -> "grpStonith2_running_0" [ style = bold] +"grpStonith2_start_0" -> "prmStonith2-2_start_0 bl460g8n3" [ style = bold] +"grpStonith2_start_0" [ style=bold color="green" fontcolor="orange"] +"grpStonith2_stop_0" -> "grpStonith2_stopped_0" [ style = bold] +"grpStonith2_stop_0" -> "prmStonith2-2_stop_0 bl460g8n3" [ style = bold] +"grpStonith2_stop_0" [ style=bold color="green" fontcolor="orange"] +"grpStonith2_stopped_0" -> "grpStonith2_start_0" [ style = bold] +"grpStonith2_stopped_0" [ style=bold color="green" fontcolor="orange"] "master-group_running_0" [ style=bold color="green" fontcolor="orange"] "master-group_start_0" -> "master-group_running_0" [ style = bold] "master-group_start_0" -> "vip-master_start_0 pgsr01" [ style = bold] @@ -71,11 +89,27 @@ "pgsr02_stop_0 bl460g8n4" [ style=bold color="green" fontcolor="black"] "prmDB2_stop_0 bl460g8n4" -> "stonith 'off' pgsr02" [ style = bold] "prmDB2_stop_0 bl460g8n4" [ style=bold color="green" fontcolor="black"] +"prmStonith1-2_monitor_3600000 bl460g8n4" [ style=bold color="green" fontcolor="black"] +"prmStonith1-2_start_0 bl460g8n4" -> "grpStonith1_running_0" [ style = bold] +"prmStonith1-2_start_0 bl460g8n4" -> "prmStonith1-2_monitor_3600000 bl460g8n4" [ style = bold] +"prmStonith1-2_start_0 bl460g8n4" [ style=bold color="green" fontcolor="black"] +"prmStonith1-2_stop_0 bl460g8n4" -> "grpStonith1_stopped_0" [ style = bold] +"prmStonith1-2_stop_0 bl460g8n4" -> "prmStonith1-2_start_0 bl460g8n4" [ style = bold] +"prmStonith1-2_stop_0 bl460g8n4" [ style=bold color="green" fontcolor="black"] +"prmStonith2-2_monitor_3600000 bl460g8n3" [ style=bold color="green" fontcolor="black"] +"prmStonith2-2_start_0 bl460g8n3" -> "grpStonith2_running_0" [ style = bold] +"prmStonith2-2_start_0 bl460g8n3" -> "prmStonith2-2_monitor_3600000 bl460g8n3" [ style = bold] +"prmStonith2-2_start_0 bl460g8n3" [ style=bold color="green" fontcolor="black"] +"prmStonith2-2_stop_0 bl460g8n3" -> "grpStonith2_stopped_0" [ style = bold] +"prmStonith2-2_stop_0 bl460g8n3" -> "prmStonith2-2_start_0 bl460g8n3" [ style = bold] +"prmStonith2-2_stop_0 bl460g8n3" [ style=bold color="green" fontcolor="black"] "stonith 'off' pgsr02" -> "master-group_stop_0" [ style = bold] "stonith 'off' pgsr02" -> "msPostgresql_stop_0" [ style = bold] "stonith 'off' pgsr02" -> "pgsql_demote_0 pgsr02" [ style = bold] "stonith 'off' pgsr02" -> "pgsql_post_notify_stonith_0" [ style = bold] "stonith 'off' pgsr02" -> "pgsql_stop_0 pgsr02" [ style = bold] +"stonith 'off' pgsr02" -> "prmStonith1-2_start_0 bl460g8n4" [ style = bold] +"stonith 'off' pgsr02" -> "prmStonith2-2_start_0 bl460g8n3" [ style = bold] "stonith 'off' pgsr02" -> "vip-master_start_0 pgsr01" [ style = bold] "stonith 'off' pgsr02" -> "vip-master_stop_0 pgsr02" [ style = bold] "stonith 'off' pgsr02" -> "vip-rep_start_0 pgsr01" [ style = bold] diff --git a/cts/scheduler/bug-cl-5247.exp b/cts/scheduler/bug-cl-5247.exp index 252e65a..446df3b 100644 --- a/cts/scheduler/bug-cl-5247.exp +++ b/cts/scheduler/bug-cl-5247.exp @@ -14,16 +14,206 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + @@ -36,7 +226,7 @@ - + @@ -51,7 +241,7 @@ - + @@ -69,7 +259,7 @@ - + @@ -81,7 +271,7 @@ - + @@ -94,7 +284,7 @@ - + @@ -103,7 +293,7 @@ - + @@ -116,7 +306,7 @@ - + @@ -124,7 +314,7 @@ - + @@ -137,16 +327,16 @@ - + - + - + @@ -159,7 +349,7 @@ - + @@ -168,7 +358,7 @@ - + @@ -184,7 +374,7 @@ - + @@ -199,16 +389,16 @@ - + - + - + @@ -223,7 +413,7 @@ - + @@ -235,7 +425,7 @@ - + @@ -253,7 +443,7 @@ - + @@ -268,7 +458,7 @@ - + @@ -281,7 +471,7 @@ - + @@ -294,7 +484,7 @@ - + @@ -307,7 +497,7 @@ - + @@ -323,7 +513,7 @@ - + @@ -342,7 +532,7 @@ - + @@ -357,7 +547,7 @@ - + @@ -372,7 +562,7 @@ - + @@ -387,7 +577,7 @@ - + @@ -395,7 +585,7 @@ - + @@ -410,7 +600,7 @@ - + @@ -422,7 +612,7 @@ - + @@ -437,7 +627,7 @@ - + @@ -452,7 +642,7 @@ - + @@ -467,7 +657,7 @@ - + @@ -479,7 +669,7 @@ - + @@ -494,7 +684,7 @@ - + @@ -512,16 +702,16 @@ - + - + - + @@ -533,16 +723,16 @@ - + - + - + diff --git a/cts/scheduler/bug-cl-5247.scores b/cts/scheduler/bug-cl-5247.scores index 90c7ca6..11a0152 100644 --- a/cts/scheduler/bug-cl-5247.scores +++ b/cts/scheduler/bug-cl-5247.scores @@ -1,8 +1,4 @@ Allocation scores: -Only 'private' parameters to prmStonith1-2_monitor_3600000 on bl460g8n4 changed: 0:0;12:4:0:6cacb40a-dbbb-49b0-bac7-1794a61d2910 -Only 'private' parameters to prmStonith1-2_start_0 on bl460g8n4 changed: 0:0;24:3:0:6cacb40a-dbbb-49b0-bac7-1794a61d2910 -Only 'private' parameters to prmStonith2-2_monitor_3600000 on bl460g8n3 changed: 0:0;19:4:0:6cacb40a-dbbb-49b0-bac7-1794a61d2910 -Only 'private' parameters to prmStonith2-2_start_0 on bl460g8n3 changed: 0:0;30:3:0:6cacb40a-dbbb-49b0-bac7-1794a61d2910 Using the original execution date of: 2015-08-12 02:53:40Z pcmk__clone_allocate: msPostgresql allocation score on bl460g8n3: -INFINITY pcmk__clone_allocate: msPostgresql allocation score on bl460g8n4: -INFINITY diff --git a/cts/scheduler/bug-cl-5247.summary b/cts/scheduler/bug-cl-5247.summary index 9e8959f..52664e6 100644 --- a/cts/scheduler/bug-cl-5247.summary +++ b/cts/scheduler/bug-cl-5247.summary @@ -17,19 +17,21 @@ GuestOnline: [ pgsr01:prmDB1 ] Masters: [ pgsr01 ] Stopped: [ bl460g8n3 bl460g8n4 ] -Only 'private' parameters to prmStonith1-2_start_0 on bl460g8n4 changed: 0:0;24:3:0:6cacb40a-dbbb-49b0-bac7-1794a61d2910 -Only 'private' parameters to prmStonith1-2_monitor_3600000 on bl460g8n4 changed: 0:0;12:4:0:6cacb40a-dbbb-49b0-bac7-1794a61d2910 -Only 'private' parameters to prmStonith2-2_start_0 on bl460g8n3 changed: 0:0;30:3:0:6cacb40a-dbbb-49b0-bac7-1794a61d2910 -Only 'private' parameters to prmStonith2-2_monitor_3600000 on bl460g8n3 changed: 0:0;19:4:0:6cacb40a-dbbb-49b0-bac7-1794a61d2910 Transition Summary: * Fence (off) pgsr02 (resource: prmDB2) 'guest is unclean' * Stop prmDB2 ( bl460g8n4 ) due to node availability + * Restart prmStonith1-2 ( bl460g8n4 ) due to resource definition change + * Restart prmStonith2-2 ( bl460g8n3 ) due to resource definition change * Recover vip-master ( pgsr02 -> pgsr01 ) * Recover vip-rep ( pgsr02 -> pgsr01 ) * Stop pgsql:0 ( Master pgsr02 ) due to node availability * Stop pgsr02 ( bl460g8n4 ) due to node availability Executing cluster transition: + * Pseudo action: grpStonith1_stop_0 + * Resource action: prmStonith1-2 stop on bl460g8n4 + * Pseudo action: grpStonith2_stop_0 + * Resource action: prmStonith2-2 stop on bl460g8n3 * Resource action: vip-master monitor on pgsr01 * Resource action: vip-rep monitor on pgsr01 * Pseudo action: msPostgresql_pre_notify_demote_0 @@ -37,13 +39,23 @@ Executing cluster transition: * Resource action: pgsr02 stop on bl460g8n4 * Resource action: pgsr02 monitor on bl460g8n3 * Resource action: prmDB2 stop on bl460g8n4 + * Pseudo action: grpStonith1_stopped_0 + * Pseudo action: grpStonith1_start_0 + * Pseudo action: grpStonith2_stopped_0 + * Pseudo action: grpStonith2_start_0 * Resource action: pgsql notify on pgsr01 * Pseudo action: msPostgresql_confirmed-pre_notify_demote_0 * Pseudo action: msPostgresql_demote_0 * Pseudo action: stonith-pgsr02-off on pgsr02 + * Resource action: prmStonith1-2 start on bl460g8n4 + * Resource action: prmStonith1-2 monitor=3600000 on bl460g8n4 + * Resource action: prmStonith2-2 start on bl460g8n3 + * Resource action: prmStonith2-2 monitor=3600000 on bl460g8n3 * Pseudo action: pgsql_post_notify_stop_0 * Pseudo action: pgsql_demote_0 * Pseudo action: msPostgresql_demoted_0 + * Pseudo action: grpStonith1_running_0 + * Pseudo action: grpStonith2_running_0 * Pseudo action: msPostgresql_post_notify_demoted_0 * Resource action: pgsql notify on pgsr01 * Pseudo action: msPostgresql_confirmed-post_notify_demoted_0 diff --git a/cts/scheduler/colocation-influence.dot b/cts/scheduler/colocation-influence.dot deleted file mode 100644 index 9573ab3..0000000 --- a/cts/scheduler/colocation-influence.dot +++ /dev/null @@ -1,92 +0,0 @@ - digraph "g" { -"bundle11-1_monitor_0 rhel7-1" -> "bundle11-1_start_0 rhel7-5" [ style = dashed] -"bundle11-1_monitor_0 rhel7-1" [ style=dashed color="red" fontcolor="black"] -"bundle11-1_monitor_0 rhel7-2" -> "bundle11-1_start_0 rhel7-5" [ style = dashed] -"bundle11-1_monitor_0 rhel7-2" [ style=dashed color="red" fontcolor="black"] -"bundle11-1_monitor_0 rhel7-3" -> "bundle11-1_start_0 rhel7-5" [ style = dashed] -"bundle11-1_monitor_0 rhel7-3" [ style=dashed color="red" fontcolor="black"] -"bundle11-1_monitor_0 rhel7-4" -> "bundle11-1_start_0 rhel7-5" [ style = dashed] -"bundle11-1_monitor_0 rhel7-4" [ style=dashed color="red" fontcolor="black"] -"bundle11-1_monitor_0 rhel7-5" -> "bundle11-1_start_0 rhel7-5" [ style = dashed] -"bundle11-1_monitor_0 rhel7-5" [ style=dashed color="red" fontcolor="black"] -"bundle11-1_monitor_30000 rhel7-5" [ style=dashed color="red" fontcolor="black"] -"bundle11-1_start_0 rhel7-5" -> "bundle11-1_monitor_30000 rhel7-5" [ style = dashed] -"bundle11-1_start_0 rhel7-5" -> "bundle11a:1_monitor_15000 bundle11-1" [ style = dashed] -"bundle11-1_start_0 rhel7-5" -> "bundle11a:1_start_0 bundle11-1" [ style = dashed] -"bundle11-1_start_0 rhel7-5" [ style=dashed color="red" fontcolor="black"] -"bundle11-clone_running_0" -> "bundle11_running_0" [ style = bold] -"bundle11-clone_running_0" [ style=bold color="green" fontcolor="orange"] -"bundle11-clone_start_0" -> "bundle11-clone_running_0" [ style = bold] -"bundle11-clone_start_0" -> "bundle11a:1_start_0 bundle11-1" [ style = dashed] -"bundle11-clone_start_0" [ style=bold color="green" fontcolor="orange"] -"bundle11_running_0" [ style=bold color="green" fontcolor="orange"] -"bundle11_start_0" -> "bundle11-clone_start_0" [ style = bold] -"bundle11_start_0" [ style=bold color="green" fontcolor="orange"] -"bundle11a:1_monitor_15000 bundle11-1" [ style=dashed color="red" fontcolor="black"] -"bundle11a:1_start_0 bundle11-1" -> "bundle11-clone_running_0" [ style = dashed] -"bundle11a:1_start_0 bundle11-1" -> "bundle11a:1_monitor_15000 bundle11-1" [ style = dashed] -"bundle11a:1_start_0 bundle11-1" [ style=dashed color="red" fontcolor="black"] -"group6a_stop_0" -> "group6a_stopped_0" [ style = bold] -"group6a_stop_0" -> "rsc6a1_stop_0 rhel7-2" [ style = bold] -"group6a_stop_0" -> "rsc6a2_stop_0 rhel7-2" [ style = bold] -"group6a_stop_0" [ style=bold color="green" fontcolor="orange"] -"group6a_stopped_0" [ style=bold color="green" fontcolor="orange"] -"group7a_stop_0" -> "group7a_stopped_0" [ style = bold] -"group7a_stop_0" -> "rsc7a2_stop_0 rhel7-3" [ style = bold] -"group7a_stop_0" [ style=bold color="green" fontcolor="orange"] -"group7a_stopped_0" [ style=bold color="green" fontcolor="orange"] -"rsc10a_monitor_10000 rhel7-3" [ style=bold color="green" fontcolor="black"] -"rsc10a_start_0 rhel7-3" -> "rsc10a_monitor_10000 rhel7-3" [ style = bold] -"rsc10a_start_0 rhel7-3" [ style=bold color="green" fontcolor="black"] -"rsc10a_stop_0 rhel7-2" -> "rsc10a_start_0 rhel7-3" [ style = bold] -"rsc10a_stop_0 rhel7-2" [ style=bold color="green" fontcolor="black"] -"rsc12b_stop_0 rhel7-1" [ style=bold color="green" fontcolor="black"] -"rsc13a_stop_0 rhel7-3" [ style=bold color="green" fontcolor="black"] -"rsc14a-clone_demote_0" -> "rsc14a-clone_demoted_0" [ style = bold] -"rsc14a-clone_demote_0" -> "rsc14a_demote_0 rhel7-4" [ style = bold] -"rsc14a-clone_demote_0" [ style=bold color="green" fontcolor="orange"] -"rsc14a-clone_demoted_0" -> "rsc14a-clone_stop_0" [ style = bold] -"rsc14a-clone_demoted_0" [ style=bold color="green" fontcolor="orange"] -"rsc14a-clone_stop_0" -> "rsc14a-clone_stopped_0" [ style = bold] -"rsc14a-clone_stop_0" -> "rsc14a_stop_0 rhel7-4" [ style = bold] -"rsc14a-clone_stop_0" [ style=bold color="green" fontcolor="orange"] -"rsc14a-clone_stopped_0" [ style=bold color="green" fontcolor="orange"] -"rsc14a_demote_0 rhel7-4" -> "rsc14a-clone_demoted_0" [ style = bold] -"rsc14a_demote_0 rhel7-4" -> "rsc14a_stop_0 rhel7-4" [ style = bold] -"rsc14a_demote_0 rhel7-4" [ style=bold color="green" fontcolor="black"] -"rsc14a_stop_0 rhel7-4" -> "rsc14a-clone_stopped_0" [ style = bold] -"rsc14a_stop_0 rhel7-4" [ style=bold color="green" fontcolor="black"] -"rsc1a_monitor_10000 rhel7-3" [ style=bold color="green" fontcolor="black"] -"rsc1a_start_0 rhel7-3" -> "rsc1a_monitor_10000 rhel7-3" [ style = bold] -"rsc1a_start_0 rhel7-3" [ style=bold color="green" fontcolor="black"] -"rsc1a_stop_0 rhel7-2" -> "rsc1a_start_0 rhel7-3" [ style = bold] -"rsc1a_stop_0 rhel7-2" [ style=bold color="green" fontcolor="black"] -"rsc1b_monitor_10000 rhel7-3" [ style=bold color="green" fontcolor="black"] -"rsc1b_start_0 rhel7-3" -> "rsc1b_monitor_10000 rhel7-3" [ style = bold] -"rsc1b_start_0 rhel7-3" [ style=bold color="green" fontcolor="black"] -"rsc1b_stop_0 rhel7-2" -> "rsc1b_start_0 rhel7-3" [ style = bold] -"rsc1b_stop_0 rhel7-2" [ style=bold color="green" fontcolor="black"] -"rsc2a_stop_0 rhel7-4" [ style=bold color="green" fontcolor="black"] -"rsc3a_monitor_10000 rhel7-2" [ style=bold color="green" fontcolor="black"] -"rsc3a_start_0 rhel7-2" -> "rsc3a_monitor_10000 rhel7-2" [ style = bold] -"rsc3a_start_0 rhel7-2" [ style=bold color="green" fontcolor="black"] -"rsc3b_monitor_10000 rhel7-2" [ style=bold color="green" fontcolor="black"] -"rsc3b_start_0 rhel7-2" -> "rsc3b_monitor_10000 rhel7-2" [ style = bold] -"rsc3b_start_0 rhel7-2" [ style=bold color="green" fontcolor="black"] -"rsc4a_stop_0 rhel7-3" [ style=bold color="green" fontcolor="black"] -"rsc5a_stop_0 rhel7-1" [ style=bold color="green" fontcolor="black"] -"rsc6a1_stop_0 rhel7-2" -> "group6a_stopped_0" [ style = bold] -"rsc6a1_stop_0 rhel7-2" [ style=bold color="green" fontcolor="black"] -"rsc6a2_stop_0 rhel7-2" -> "group6a_stopped_0" [ style = bold] -"rsc6a2_stop_0 rhel7-2" -> "rsc6a1_stop_0 rhel7-2" [ style = bold] -"rsc6a2_stop_0 rhel7-2" [ style=bold color="green" fontcolor="black"] -"rsc7a2_stop_0 rhel7-3" -> "group7a_stopped_0" [ style = bold] -"rsc7a2_stop_0 rhel7-3" [ style=bold color="green" fontcolor="black"] -"rsc8a-clone_stop_0" -> "rsc8a-clone_stopped_0" [ style = bold] -"rsc8a-clone_stop_0" -> "rsc8a_stop_0 rhel7-4" [ style = bold] -"rsc8a-clone_stop_0" [ style=bold color="green" fontcolor="orange"] -"rsc8a-clone_stopped_0" [ style=bold color="green" fontcolor="orange"] -"rsc8a_stop_0 rhel7-4" -> "rsc8a-clone_stopped_0" [ style = bold] -"rsc8a_stop_0 rhel7-4" [ style=bold color="green" fontcolor="black"] -"rsc9c_stop_0 rhel7-4" [ style=bold color="green" fontcolor="black"] -} diff --git a/cts/scheduler/colocation-influence.exp b/cts/scheduler/colocation-influence.exp deleted file mode 100644 index 410c46f..0000000 --- a/cts/scheduler/colocation-influence.exp +++ /dev/null @@ -1,455 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cts/scheduler/colocation-influence.scores b/cts/scheduler/colocation-influence.scores deleted file mode 100644 index 1437263..0000000 --- a/cts/scheduler/colocation-influence.scores +++ /dev/null @@ -1,673 +0,0 @@ -Allocation scores: -pcmk__bundle_allocate: bundle10 allocation score on rhel7-1: 0 -pcmk__bundle_allocate: bundle10 allocation score on rhel7-1: 0 -pcmk__bundle_allocate: bundle10 allocation score on rhel7-2: 0 -pcmk__bundle_allocate: bundle10 allocation score on rhel7-2: 0 -pcmk__bundle_allocate: bundle10 allocation score on rhel7-3: 0 -pcmk__bundle_allocate: bundle10 allocation score on rhel7-3: 0 -pcmk__bundle_allocate: bundle10 allocation score on rhel7-4: 0 -pcmk__bundle_allocate: bundle10 allocation score on rhel7-4: 0 -pcmk__bundle_allocate: bundle10 allocation score on rhel7-5: -INFINITY -pcmk__bundle_allocate: bundle10 allocation score on rhel7-5: -INFINITY -pcmk__bundle_allocate: bundle10-0 allocation score on rhel7-1: 0 -pcmk__bundle_allocate: bundle10-0 allocation score on rhel7-1: 0 -pcmk__bundle_allocate: bundle10-0 allocation score on rhel7-2: 10 -pcmk__bundle_allocate: bundle10-0 allocation score on rhel7-2: 10010 -pcmk__bundle_allocate: bundle10-0 allocation score on rhel7-3: 0 -pcmk__bundle_allocate: bundle10-0 allocation score on rhel7-3: 0 -pcmk__bundle_allocate: bundle10-0 allocation score on rhel7-4: 0 -pcmk__bundle_allocate: bundle10-0 allocation score on rhel7-4: 0 -pcmk__bundle_allocate: bundle10-0 allocation score on rhel7-5: 0 -pcmk__bundle_allocate: bundle10-0 allocation score on rhel7-5: 0 -pcmk__bundle_allocate: bundle10-1 allocation score on rhel7-1: 0 -pcmk__bundle_allocate: bundle10-1 allocation score on rhel7-1: 0 -pcmk__bundle_allocate: bundle10-1 allocation score on rhel7-2: 0 -pcmk__bundle_allocate: bundle10-1 allocation score on rhel7-2: 0 -pcmk__bundle_allocate: bundle10-1 allocation score on rhel7-3: 10 -pcmk__bundle_allocate: bundle10-1 allocation score on rhel7-3: 10010 -pcmk__bundle_allocate: bundle10-1 allocation score on rhel7-4: 0 -pcmk__bundle_allocate: bundle10-1 allocation score on rhel7-4: 0 -pcmk__bundle_allocate: bundle10-1 allocation score on rhel7-5: 0 -pcmk__bundle_allocate: bundle10-1 allocation score on rhel7-5: 0 -pcmk__bundle_allocate: bundle10-clone allocation score on bundle10-0: -INFINITY -pcmk__bundle_allocate: bundle10-clone allocation score on bundle10-0: 0 -pcmk__bundle_allocate: bundle10-clone allocation score on bundle10-1: -INFINITY -pcmk__bundle_allocate: bundle10-clone allocation score on bundle10-1: 0 -pcmk__bundle_allocate: bundle10-clone allocation score on rhel7-1: -INFINITY -pcmk__bundle_allocate: bundle10-clone allocation score on rhel7-1: 0 -pcmk__bundle_allocate: bundle10-clone allocation score on rhel7-2: -INFINITY -pcmk__bundle_allocate: bundle10-clone allocation score on rhel7-2: 0 -pcmk__bundle_allocate: bundle10-clone allocation score on rhel7-3: -INFINITY -pcmk__bundle_allocate: bundle10-clone allocation score on rhel7-3: 0 -pcmk__bundle_allocate: bundle10-clone allocation score on rhel7-4: -INFINITY -pcmk__bundle_allocate: bundle10-clone allocation score on rhel7-4: 0 -pcmk__bundle_allocate: bundle10-clone allocation score on rhel7-5: -INFINITY -pcmk__bundle_allocate: bundle10-clone allocation score on rhel7-5: 0 -pcmk__bundle_allocate: bundle10-docker-0 allocation score on rhel7-1: 0 -pcmk__bundle_allocate: bundle10-docker-0 allocation score on rhel7-1: 0 -pcmk__bundle_allocate: bundle10-docker-0 allocation score on rhel7-2: 10 -pcmk__bundle_allocate: bundle10-docker-0 allocation score on rhel7-2: 21 -pcmk__bundle_allocate: bundle10-docker-0 allocation score on rhel7-3: 0 -pcmk__bundle_allocate: bundle10-docker-0 allocation score on rhel7-3: 0 -pcmk__bundle_allocate: bundle10-docker-0 allocation score on rhel7-4: 0 -pcmk__bundle_allocate: bundle10-docker-0 allocation score on rhel7-4: 0 -pcmk__bundle_allocate: bundle10-docker-0 allocation score on rhel7-5: -INFINITY -pcmk__bundle_allocate: bundle10-docker-0 allocation score on rhel7-5: -INFINITY -pcmk__bundle_allocate: bundle10-docker-1 allocation score on rhel7-1: 0 -pcmk__bundle_allocate: bundle10-docker-1 allocation score on rhel7-1: 0 -pcmk__bundle_allocate: bundle10-docker-1 allocation score on rhel7-2: -INFINITY -pcmk__bundle_allocate: bundle10-docker-1 allocation score on rhel7-2: 0 -pcmk__bundle_allocate: bundle10-docker-1 allocation score on rhel7-3: 10 -pcmk__bundle_allocate: bundle10-docker-1 allocation score on rhel7-3: 21 -pcmk__bundle_allocate: bundle10-docker-1 allocation score on rhel7-4: 0 -pcmk__bundle_allocate: bundle10-docker-1 allocation score on rhel7-4: 0 -pcmk__bundle_allocate: bundle10-docker-1 allocation score on rhel7-5: -INFINITY -pcmk__bundle_allocate: bundle10-docker-1 allocation score on rhel7-5: -INFINITY -pcmk__bundle_allocate: bundle10-ip-192.168.122.131 allocation score on rhel7-1: -INFINITY -pcmk__bundle_allocate: bundle10-ip-192.168.122.131 allocation score on rhel7-1: 0 -pcmk__bundle_allocate: bundle10-ip-192.168.122.131 allocation score on rhel7-2: 10 -pcmk__bundle_allocate: bundle10-ip-192.168.122.131 allocation score on rhel7-2: 10 -pcmk__bundle_allocate: bundle10-ip-192.168.122.131 allocation score on rhel7-3: -INFINITY -pcmk__bundle_allocate: bundle10-ip-192.168.122.131 allocation score on rhel7-3: 0 -pcmk__bundle_allocate: bundle10-ip-192.168.122.131 allocation score on rhel7-4: -INFINITY -pcmk__bundle_allocate: bundle10-ip-192.168.122.131 allocation score on rhel7-4: 0 -pcmk__bundle_allocate: bundle10-ip-192.168.122.131 allocation score on rhel7-5: -INFINITY -pcmk__bundle_allocate: bundle10-ip-192.168.122.131 allocation score on rhel7-5: -INFINITY -pcmk__bundle_allocate: bundle10-ip-192.168.122.132 allocation score on rhel7-1: -INFINITY -pcmk__bundle_allocate: bundle10-ip-192.168.122.132 allocation score on rhel7-1: 0 -pcmk__bundle_allocate: bundle10-ip-192.168.122.132 allocation score on rhel7-2: -INFINITY -pcmk__bundle_allocate: bundle10-ip-192.168.122.132 allocation score on rhel7-2: 0 -pcmk__bundle_allocate: bundle10-ip-192.168.122.132 allocation score on rhel7-3: 10 -pcmk__bundle_allocate: bundle10-ip-192.168.122.132 allocation score on rhel7-3: 10 -pcmk__bundle_allocate: bundle10-ip-192.168.122.132 allocation score on rhel7-4: -INFINITY -pcmk__bundle_allocate: bundle10-ip-192.168.122.132 allocation score on rhel7-4: 0 -pcmk__bundle_allocate: bundle10-ip-192.168.122.132 allocation score on rhel7-5: -INFINITY -pcmk__bundle_allocate: bundle10-ip-192.168.122.132 allocation score on rhel7-5: -INFINITY -pcmk__bundle_allocate: bundle11 allocation score on rhel7-1: 0 -pcmk__bundle_allocate: bundle11 allocation score on rhel7-2: 0 -pcmk__bundle_allocate: bundle11 allocation score on rhel7-3: 0 -pcmk__bundle_allocate: bundle11 allocation score on rhel7-4: 0 -pcmk__bundle_allocate: bundle11 allocation score on rhel7-5: -INFINITY -pcmk__bundle_allocate: bundle11-0 allocation score on rhel7-1: 10 -pcmk__bundle_allocate: bundle11-0 allocation score on rhel7-2: 0 -pcmk__bundle_allocate: bundle11-0 allocation score on rhel7-3: 0 -pcmk__bundle_allocate: bundle11-0 allocation score on rhel7-4: 0 -pcmk__bundle_allocate: bundle11-0 allocation score on rhel7-5: 0 -pcmk__bundle_allocate: bundle11-1 allocation score on rhel7-1: 0 -pcmk__bundle_allocate: bundle11-1 allocation score on rhel7-2: 0 -pcmk__bundle_allocate: bundle11-1 allocation score on rhel7-3: 0 -pcmk__bundle_allocate: bundle11-1 allocation score on rhel7-4: 0 -pcmk__bundle_allocate: bundle11-1 allocation score on rhel7-5: 0 -pcmk__bundle_allocate: bundle11-clone allocation score on bundle11-0: -INFINITY -pcmk__bundle_allocate: bundle11-clone allocation score on bundle11-1: -INFINITY -pcmk__bundle_allocate: bundle11-clone allocation score on rhel7-1: 0 -pcmk__bundle_allocate: bundle11-clone allocation score on rhel7-2: 0 -pcmk__bundle_allocate: bundle11-clone allocation score on rhel7-3: 0 -pcmk__bundle_allocate: bundle11-clone allocation score on rhel7-4: 0 -pcmk__bundle_allocate: bundle11-clone allocation score on rhel7-5: 0 -pcmk__bundle_allocate: bundle11-docker-0 allocation score on rhel7-1: 10 -pcmk__bundle_allocate: bundle11-docker-0 allocation score on rhel7-2: 0 -pcmk__bundle_allocate: bundle11-docker-0 allocation score on rhel7-3: 0 -pcmk__bundle_allocate: bundle11-docker-0 allocation score on rhel7-4: 0 -pcmk__bundle_allocate: bundle11-docker-0 allocation score on rhel7-5: -INFINITY -pcmk__bundle_allocate: bundle11-docker-1 allocation score on rhel7-1: 0 -pcmk__bundle_allocate: bundle11-docker-1 allocation score on rhel7-2: 0 -pcmk__bundle_allocate: bundle11-docker-1 allocation score on rhel7-3: 0 -pcmk__bundle_allocate: bundle11-docker-1 allocation score on rhel7-4: 0 -pcmk__bundle_allocate: bundle11-docker-1 allocation score on rhel7-5: -INFINITY -pcmk__bundle_allocate: bundle11-ip-192.168.122.134 allocation score on rhel7-1: 10 -pcmk__bundle_allocate: bundle11-ip-192.168.122.134 allocation score on rhel7-2: 0 -pcmk__bundle_allocate: bundle11-ip-192.168.122.134 allocation score on rhel7-3: 0 -pcmk__bundle_allocate: bundle11-ip-192.168.122.134 allocation score on rhel7-4: 0 -pcmk__bundle_allocate: bundle11-ip-192.168.122.134 allocation score on rhel7-5: -INFINITY -pcmk__bundle_allocate: bundle11-ip-192.168.122.135 allocation score on rhel7-1: 0 -pcmk__bundle_allocate: bundle11-ip-192.168.122.135 allocation score on rhel7-2: 0 -pcmk__bundle_allocate: bundle11-ip-192.168.122.135 allocation score on rhel7-3: 0 -pcmk__bundle_allocate: bundle11-ip-192.168.122.135 allocation score on rhel7-4: 0 -pcmk__bundle_allocate: bundle11-ip-192.168.122.135 allocation score on rhel7-5: -INFINITY -pcmk__bundle_allocate: bundle11a:0 allocation score on bundle11-0: 510 -pcmk__bundle_allocate: bundle11a:1 allocation score on bundle11-1: 500 -pcmk__bundle_allocate: httpd:0 allocation score on bundle10-0: 510 -pcmk__bundle_allocate: httpd:0 allocation score on bundle10-0: INFINITY -pcmk__bundle_allocate: httpd:1 allocation score on bundle10-1: 510 -pcmk__bundle_allocate: httpd:1 allocation score on bundle10-1: INFINITY -pcmk__clone_allocate: bundle10-clone allocation score on bundle10-0: 0 -pcmk__clone_allocate: bundle10-clone allocation score on bundle10-1: 0 -pcmk__clone_allocate: bundle10-clone allocation score on rhel7-1: -INFINITY -pcmk__clone_allocate: bundle10-clone allocation score on rhel7-2: -INFINITY -pcmk__clone_allocate: bundle10-clone allocation score on rhel7-3: -INFINITY -pcmk__clone_allocate: bundle10-clone allocation score on rhel7-4: -INFINITY -pcmk__clone_allocate: bundle10-clone allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: bundle11-clone allocation score on bundle11-0: 0 -pcmk__clone_allocate: bundle11-clone allocation score on bundle11-1: 0 -pcmk__clone_allocate: bundle11-clone allocation score on rhel7-1: -INFINITY -pcmk__clone_allocate: bundle11-clone allocation score on rhel7-2: -INFINITY -pcmk__clone_allocate: bundle11-clone allocation score on rhel7-3: -INFINITY -pcmk__clone_allocate: bundle11-clone allocation score on rhel7-4: -INFINITY -pcmk__clone_allocate: bundle11-clone allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: bundle11a:0 allocation score on bundle11-0: INFINITY -pcmk__clone_allocate: bundle11a:1 allocation score on bundle11-1: INFINITY -pcmk__clone_allocate: httpd:0 allocation score on bundle10-0: INFINITY -pcmk__clone_allocate: httpd:1 allocation score on bundle10-1: INFINITY -pcmk__clone_allocate: rsc13b-clone allocation score on rhel7-1: 0 -pcmk__clone_allocate: rsc13b-clone allocation score on rhel7-2: 0 -pcmk__clone_allocate: rsc13b-clone allocation score on rhel7-3: 0 -pcmk__clone_allocate: rsc13b-clone allocation score on rhel7-4: 0 -pcmk__clone_allocate: rsc13b-clone allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: rsc13b:0 allocation score on rhel7-1: 0 -pcmk__clone_allocate: rsc13b:0 allocation score on rhel7-2: 0 -pcmk__clone_allocate: rsc13b:0 allocation score on rhel7-3: 20 -pcmk__clone_allocate: rsc13b:0 allocation score on rhel7-4: 0 -pcmk__clone_allocate: rsc13b:0 allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: rsc13b:1 allocation score on rhel7-1: 0 -pcmk__clone_allocate: rsc13b:1 allocation score on rhel7-2: 0 -pcmk__clone_allocate: rsc13b:1 allocation score on rhel7-3: 0 -pcmk__clone_allocate: rsc13b:1 allocation score on rhel7-4: 15 -pcmk__clone_allocate: rsc13b:1 allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: rsc13b:2 allocation score on rhel7-1: 15 -pcmk__clone_allocate: rsc13b:2 allocation score on rhel7-2: 0 -pcmk__clone_allocate: rsc13b:2 allocation score on rhel7-3: 0 -pcmk__clone_allocate: rsc13b:2 allocation score on rhel7-4: 0 -pcmk__clone_allocate: rsc13b:2 allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: rsc13b:3 allocation score on rhel7-1: 0 -pcmk__clone_allocate: rsc13b:3 allocation score on rhel7-2: 15 -pcmk__clone_allocate: rsc13b:3 allocation score on rhel7-3: 0 -pcmk__clone_allocate: rsc13b:3 allocation score on rhel7-4: 0 -pcmk__clone_allocate: rsc13b:3 allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: rsc13b:4 allocation score on rhel7-1: 5 -pcmk__clone_allocate: rsc13b:4 allocation score on rhel7-2: 5 -pcmk__clone_allocate: rsc13b:4 allocation score on rhel7-3: 10 -pcmk__clone_allocate: rsc13b:4 allocation score on rhel7-4: 5 -pcmk__clone_allocate: rsc13b:4 allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: rsc13b:5 allocation score on rhel7-1: 5 -pcmk__clone_allocate: rsc13b:5 allocation score on rhel7-2: 5 -pcmk__clone_allocate: rsc13b:5 allocation score on rhel7-3: 10 -pcmk__clone_allocate: rsc13b:5 allocation score on rhel7-4: 5 -pcmk__clone_allocate: rsc13b:5 allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: rsc13b:6 allocation score on rhel7-1: 5 -pcmk__clone_allocate: rsc13b:6 allocation score on rhel7-2: 5 -pcmk__clone_allocate: rsc13b:6 allocation score on rhel7-3: 10 -pcmk__clone_allocate: rsc13b:6 allocation score on rhel7-4: 5 -pcmk__clone_allocate: rsc13b:6 allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: rsc13b:7 allocation score on rhel7-1: 5 -pcmk__clone_allocate: rsc13b:7 allocation score on rhel7-2: 5 -pcmk__clone_allocate: rsc13b:7 allocation score on rhel7-3: 10 -pcmk__clone_allocate: rsc13b:7 allocation score on rhel7-4: 5 -pcmk__clone_allocate: rsc13b:7 allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: rsc13b:8 allocation score on rhel7-1: 5 -pcmk__clone_allocate: rsc13b:8 allocation score on rhel7-2: 5 -pcmk__clone_allocate: rsc13b:8 allocation score on rhel7-3: 10 -pcmk__clone_allocate: rsc13b:8 allocation score on rhel7-4: 5 -pcmk__clone_allocate: rsc13b:8 allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: rsc14a-clone allocation score on rhel7-1: 0 -pcmk__clone_allocate: rsc14a-clone allocation score on rhel7-2: 0 -pcmk__clone_allocate: rsc14a-clone allocation score on rhel7-3: 0 -pcmk__clone_allocate: rsc14a-clone allocation score on rhel7-4: -INFINITY -pcmk__clone_allocate: rsc14a-clone allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: rsc14a:0 allocation score on rhel7-1: 0 -pcmk__clone_allocate: rsc14a:0 allocation score on rhel7-2: 0 -pcmk__clone_allocate: rsc14a:0 allocation score on rhel7-3: 15 -pcmk__clone_allocate: rsc14a:0 allocation score on rhel7-4: -INFINITY -pcmk__clone_allocate: rsc14a:0 allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: rsc14a:1 allocation score on rhel7-1: 0 -pcmk__clone_allocate: rsc14a:1 allocation score on rhel7-2: 0 -pcmk__clone_allocate: rsc14a:1 allocation score on rhel7-3: 0 -pcmk__clone_allocate: rsc14a:1 allocation score on rhel7-4: -INFINITY -pcmk__clone_allocate: rsc14a:1 allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: rsc14a:2 allocation score on rhel7-1: 15 -pcmk__clone_allocate: rsc14a:2 allocation score on rhel7-2: 0 -pcmk__clone_allocate: rsc14a:2 allocation score on rhel7-3: 0 -pcmk__clone_allocate: rsc14a:2 allocation score on rhel7-4: -INFINITY -pcmk__clone_allocate: rsc14a:2 allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: rsc14a:3 allocation score on rhel7-1: 0 -pcmk__clone_allocate: rsc14a:3 allocation score on rhel7-2: 15 -pcmk__clone_allocate: rsc14a:3 allocation score on rhel7-3: 0 -pcmk__clone_allocate: rsc14a:3 allocation score on rhel7-4: -INFINITY -pcmk__clone_allocate: rsc14a:3 allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: rsc14a:4 allocation score on rhel7-1: 5 -pcmk__clone_allocate: rsc14a:4 allocation score on rhel7-2: 5 -pcmk__clone_allocate: rsc14a:4 allocation score on rhel7-3: 5 -pcmk__clone_allocate: rsc14a:4 allocation score on rhel7-4: -INFINITY -pcmk__clone_allocate: rsc14a:4 allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: rsc14a:5 allocation score on rhel7-1: 5 -pcmk__clone_allocate: rsc14a:5 allocation score on rhel7-2: 5 -pcmk__clone_allocate: rsc14a:5 allocation score on rhel7-3: 5 -pcmk__clone_allocate: rsc14a:5 allocation score on rhel7-4: -INFINITY -pcmk__clone_allocate: rsc14a:5 allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: rsc14a:6 allocation score on rhel7-1: 5 -pcmk__clone_allocate: rsc14a:6 allocation score on rhel7-2: 5 -pcmk__clone_allocate: rsc14a:6 allocation score on rhel7-3: 5 -pcmk__clone_allocate: rsc14a:6 allocation score on rhel7-4: -INFINITY -pcmk__clone_allocate: rsc14a:6 allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: rsc14a:7 allocation score on rhel7-1: 5 -pcmk__clone_allocate: rsc14a:7 allocation score on rhel7-2: 5 -pcmk__clone_allocate: rsc14a:7 allocation score on rhel7-3: 5 -pcmk__clone_allocate: rsc14a:7 allocation score on rhel7-4: -INFINITY -pcmk__clone_allocate: rsc14a:7 allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: rsc14a:8 allocation score on rhel7-1: 5 -pcmk__clone_allocate: rsc14a:8 allocation score on rhel7-2: 5 -pcmk__clone_allocate: rsc14a:8 allocation score on rhel7-3: 5 -pcmk__clone_allocate: rsc14a:8 allocation score on rhel7-4: -INFINITY -pcmk__clone_allocate: rsc14a:8 allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: rsc8a-clone allocation score on rhel7-1: 0 -pcmk__clone_allocate: rsc8a-clone allocation score on rhel7-2: 0 -pcmk__clone_allocate: rsc8a-clone allocation score on rhel7-3: 0 -pcmk__clone_allocate: rsc8a-clone allocation score on rhel7-4: -INFINITY -pcmk__clone_allocate: rsc8a-clone allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: rsc8a:0 allocation score on rhel7-1: 0 -pcmk__clone_allocate: rsc8a:0 allocation score on rhel7-2: 0 -pcmk__clone_allocate: rsc8a:0 allocation score on rhel7-3: 10 -pcmk__clone_allocate: rsc8a:0 allocation score on rhel7-4: -INFINITY -pcmk__clone_allocate: rsc8a:0 allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: rsc8a:1 allocation score on rhel7-1: 0 -pcmk__clone_allocate: rsc8a:1 allocation score on rhel7-2: 0 -pcmk__clone_allocate: rsc8a:1 allocation score on rhel7-3: 0 -pcmk__clone_allocate: rsc8a:1 allocation score on rhel7-4: -INFINITY -pcmk__clone_allocate: rsc8a:1 allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: rsc8a:2 allocation score on rhel7-1: 10 -pcmk__clone_allocate: rsc8a:2 allocation score on rhel7-2: 0 -pcmk__clone_allocate: rsc8a:2 allocation score on rhel7-3: 0 -pcmk__clone_allocate: rsc8a:2 allocation score on rhel7-4: -INFINITY -pcmk__clone_allocate: rsc8a:2 allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: rsc8b-clone allocation score on rhel7-1: 0 -pcmk__clone_allocate: rsc8b-clone allocation score on rhel7-2: 0 -pcmk__clone_allocate: rsc8b-clone allocation score on rhel7-3: 0 -pcmk__clone_allocate: rsc8b-clone allocation score on rhel7-4: 0 -pcmk__clone_allocate: rsc8b-clone allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: rsc8b:0 allocation score on rhel7-1: 0 -pcmk__clone_allocate: rsc8b:0 allocation score on rhel7-2: 0 -pcmk__clone_allocate: rsc8b:0 allocation score on rhel7-3: 10 -pcmk__clone_allocate: rsc8b:0 allocation score on rhel7-4: 0 -pcmk__clone_allocate: rsc8b:0 allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: rsc8b:1 allocation score on rhel7-1: 0 -pcmk__clone_allocate: rsc8b:1 allocation score on rhel7-2: 0 -pcmk__clone_allocate: rsc8b:1 allocation score on rhel7-3: 0 -pcmk__clone_allocate: rsc8b:1 allocation score on rhel7-4: 10 -pcmk__clone_allocate: rsc8b:1 allocation score on rhel7-5: -INFINITY -pcmk__clone_allocate: rsc8b:2 allocation score on rhel7-1: 10 -pcmk__clone_allocate: rsc8b:2 allocation score on rhel7-2: 0 -pcmk__clone_allocate: rsc8b:2 allocation score on rhel7-3: 0 -pcmk__clone_allocate: rsc8b:2 allocation score on rhel7-4: 0 -pcmk__clone_allocate: rsc8b:2 allocation score on rhel7-5: -INFINITY -pcmk__group_allocate: group5a allocation score on rhel7-1: 0 -pcmk__group_allocate: group5a allocation score on rhel7-2: 0 -pcmk__group_allocate: group5a allocation score on rhel7-3: 0 -pcmk__group_allocate: group5a allocation score on rhel7-4: 0 -pcmk__group_allocate: group5a allocation score on rhel7-5: -INFINITY -pcmk__group_allocate: group6a allocation score on rhel7-1: 0 -pcmk__group_allocate: group6a allocation score on rhel7-2: 0 -pcmk__group_allocate: group6a allocation score on rhel7-3: 0 -pcmk__group_allocate: group6a allocation score on rhel7-4: 0 -pcmk__group_allocate: group6a allocation score on rhel7-5: -INFINITY -pcmk__group_allocate: group7a allocation score on rhel7-1: 0 -pcmk__group_allocate: group7a allocation score on rhel7-2: 0 -pcmk__group_allocate: group7a allocation score on rhel7-3: 0 -pcmk__group_allocate: group7a allocation score on rhel7-4: 0 -pcmk__group_allocate: group7a allocation score on rhel7-5: -INFINITY -pcmk__group_allocate: rsc5a1 allocation score on rhel7-1: 10 -pcmk__group_allocate: rsc5a1 allocation score on rhel7-2: 0 -pcmk__group_allocate: rsc5a1 allocation score on rhel7-3: 0 -pcmk__group_allocate: rsc5a1 allocation score on rhel7-4: 0 -pcmk__group_allocate: rsc5a1 allocation score on rhel7-5: -INFINITY -pcmk__group_allocate: rsc5a2 allocation score on rhel7-1: 10 -pcmk__group_allocate: rsc5a2 allocation score on rhel7-2: 0 -pcmk__group_allocate: rsc5a2 allocation score on rhel7-3: 0 -pcmk__group_allocate: rsc5a2 allocation score on rhel7-4: 0 -pcmk__group_allocate: rsc5a2 allocation score on rhel7-5: 0 -pcmk__group_allocate: rsc6a1 allocation score on rhel7-1: 0 -pcmk__group_allocate: rsc6a1 allocation score on rhel7-2: -INFINITY -pcmk__group_allocate: rsc6a1 allocation score on rhel7-3: 0 -pcmk__group_allocate: rsc6a1 allocation score on rhel7-4: 0 -pcmk__group_allocate: rsc6a1 allocation score on rhel7-5: -INFINITY -pcmk__group_allocate: rsc6a2 allocation score on rhel7-1: 0 -pcmk__group_allocate: rsc6a2 allocation score on rhel7-2: 10 -pcmk__group_allocate: rsc6a2 allocation score on rhel7-3: 0 -pcmk__group_allocate: rsc6a2 allocation score on rhel7-4: 0 -pcmk__group_allocate: rsc6a2 allocation score on rhel7-5: 0 -pcmk__group_allocate: rsc7a1 allocation score on rhel7-1: 0 -pcmk__group_allocate: rsc7a1 allocation score on rhel7-2: 0 -pcmk__group_allocate: rsc7a1 allocation score on rhel7-3: 10 -pcmk__group_allocate: rsc7a1 allocation score on rhel7-4: 0 -pcmk__group_allocate: rsc7a1 allocation score on rhel7-5: -INFINITY -pcmk__group_allocate: rsc7a2 allocation score on rhel7-1: 0 -pcmk__group_allocate: rsc7a2 allocation score on rhel7-2: 0 -pcmk__group_allocate: rsc7a2 allocation score on rhel7-3: -INFINITY -pcmk__group_allocate: rsc7a2 allocation score on rhel7-4: 0 -pcmk__group_allocate: rsc7a2 allocation score on rhel7-5: 0 -pcmk__native_allocate: Fencing allocation score on rhel7-1: 10 -pcmk__native_allocate: Fencing allocation score on rhel7-2: 0 -pcmk__native_allocate: Fencing allocation score on rhel7-3: 0 -pcmk__native_allocate: Fencing allocation score on rhel7-4: 0 -pcmk__native_allocate: Fencing allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: bundle10-0 allocation score on rhel7-1: 0 -pcmk__native_allocate: bundle10-0 allocation score on rhel7-2: 10010 -pcmk__native_allocate: bundle10-0 allocation score on rhel7-3: 0 -pcmk__native_allocate: bundle10-0 allocation score on rhel7-4: 0 -pcmk__native_allocate: bundle10-0 allocation score on rhel7-5: 0 -pcmk__native_allocate: bundle10-1 allocation score on rhel7-1: 0 -pcmk__native_allocate: bundle10-1 allocation score on rhel7-2: 0 -pcmk__native_allocate: bundle10-1 allocation score on rhel7-3: 10010 -pcmk__native_allocate: bundle10-1 allocation score on rhel7-4: 0 -pcmk__native_allocate: bundle10-1 allocation score on rhel7-5: 0 -pcmk__native_allocate: bundle10-docker-0 allocation score on rhel7-1: 0 -pcmk__native_allocate: bundle10-docker-0 allocation score on rhel7-2: 21 -pcmk__native_allocate: bundle10-docker-0 allocation score on rhel7-3: 0 -pcmk__native_allocate: bundle10-docker-0 allocation score on rhel7-4: 0 -pcmk__native_allocate: bundle10-docker-0 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: bundle10-docker-1 allocation score on rhel7-1: 0 -pcmk__native_allocate: bundle10-docker-1 allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: bundle10-docker-1 allocation score on rhel7-3: 21 -pcmk__native_allocate: bundle10-docker-1 allocation score on rhel7-4: 0 -pcmk__native_allocate: bundle10-docker-1 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: bundle10-ip-192.168.122.131 allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: bundle10-ip-192.168.122.131 allocation score on rhel7-2: 10 -pcmk__native_allocate: bundle10-ip-192.168.122.131 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: bundle10-ip-192.168.122.131 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: bundle10-ip-192.168.122.131 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: bundle10-ip-192.168.122.132 allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: bundle10-ip-192.168.122.132 allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: bundle10-ip-192.168.122.132 allocation score on rhel7-3: 10 -pcmk__native_allocate: bundle10-ip-192.168.122.132 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: bundle10-ip-192.168.122.132 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: bundle11-0 allocation score on rhel7-1: 10010 -pcmk__native_allocate: bundle11-0 allocation score on rhel7-2: 0 -pcmk__native_allocate: bundle11-0 allocation score on rhel7-3: 0 -pcmk__native_allocate: bundle11-0 allocation score on rhel7-4: 0 -pcmk__native_allocate: bundle11-0 allocation score on rhel7-5: 0 -pcmk__native_allocate: bundle11-1 allocation score on rhel7-1: 0 -pcmk__native_allocate: bundle11-1 allocation score on rhel7-2: 0 -pcmk__native_allocate: bundle11-1 allocation score on rhel7-3: 0 -pcmk__native_allocate: bundle11-1 allocation score on rhel7-4: 0 -pcmk__native_allocate: bundle11-1 allocation score on rhel7-5: 0 -pcmk__native_allocate: bundle11-docker-0 allocation score on rhel7-1: 21 -pcmk__native_allocate: bundle11-docker-0 allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: bundle11-docker-0 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: bundle11-docker-0 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: bundle11-docker-0 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: bundle11-docker-1 allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: bundle11-docker-1 allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: bundle11-docker-1 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: bundle11-docker-1 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: bundle11-docker-1 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: bundle11-ip-192.168.122.134 allocation score on rhel7-1: 10 -pcmk__native_allocate: bundle11-ip-192.168.122.134 allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: bundle11-ip-192.168.122.134 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: bundle11-ip-192.168.122.134 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: bundle11-ip-192.168.122.134 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: bundle11-ip-192.168.122.135 allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: bundle11-ip-192.168.122.135 allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: bundle11-ip-192.168.122.135 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: bundle11-ip-192.168.122.135 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: bundle11-ip-192.168.122.135 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: bundle11a:0 allocation score on bundle11-0: INFINITY -pcmk__native_allocate: bundle11a:1 allocation score on bundle11-1: INFINITY -pcmk__native_allocate: httpd:0 allocation score on bundle10-0: INFINITY -pcmk__native_allocate: httpd:1 allocation score on bundle10-1: INFINITY -pcmk__native_allocate: rsc10a allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc10a allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc10a allocation score on rhel7-3: 0 -pcmk__native_allocate: rsc10a allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc10a allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc11a allocation score on rhel7-1: 10 -pcmk__native_allocate: rsc11a allocation score on rhel7-2: 0 -pcmk__native_allocate: rsc11a allocation score on rhel7-3: 0 -pcmk__native_allocate: rsc11a allocation score on rhel7-4: 0 -pcmk__native_allocate: rsc11a allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc12a allocation score on rhel7-1: 10 -pcmk__native_allocate: rsc12a allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc12a allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc12a allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc12a allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc12b allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc12b allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc12b allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc12b allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc12b allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc12c allocation score on rhel7-1: 10 -pcmk__native_allocate: rsc12c allocation score on rhel7-2: 0 -pcmk__native_allocate: rsc12c allocation score on rhel7-3: 0 -pcmk__native_allocate: rsc12c allocation score on rhel7-4: 0 -pcmk__native_allocate: rsc12c allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc13a allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc13a allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc13a allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc13a allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc13a allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc13b:0 allocation score on rhel7-1: 0 -pcmk__native_allocate: rsc13b:0 allocation score on rhel7-2: 0 -pcmk__native_allocate: rsc13b:0 allocation score on rhel7-3: 20 -pcmk__native_allocate: rsc13b:0 allocation score on rhel7-4: 0 -pcmk__native_allocate: rsc13b:0 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc13b:1 allocation score on rhel7-1: 0 -pcmk__native_allocate: rsc13b:1 allocation score on rhel7-2: 0 -pcmk__native_allocate: rsc13b:1 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc13b:1 allocation score on rhel7-4: 15 -pcmk__native_allocate: rsc13b:1 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc13b:2 allocation score on rhel7-1: 15 -pcmk__native_allocate: rsc13b:2 allocation score on rhel7-2: 0 -pcmk__native_allocate: rsc13b:2 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc13b:2 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc13b:2 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc13b:3 allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc13b:3 allocation score on rhel7-2: 15 -pcmk__native_allocate: rsc13b:3 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc13b:3 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc13b:3 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc13b:4 allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc13b:4 allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc13b:4 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc13b:4 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc13b:4 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc13b:5 allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc13b:5 allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc13b:5 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc13b:5 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc13b:5 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc13b:6 allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc13b:6 allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc13b:6 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc13b:6 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc13b:6 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc13b:7 allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc13b:7 allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc13b:7 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc13b:7 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc13b:7 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc13b:8 allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc13b:8 allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc13b:8 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc13b:8 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc13b:8 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc14a:0 allocation score on rhel7-1: 0 -pcmk__native_allocate: rsc14a:0 allocation score on rhel7-2: 0 -pcmk__native_allocate: rsc14a:0 allocation score on rhel7-3: 15 -pcmk__native_allocate: rsc14a:0 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc14a:0 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc14a:1 allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc14a:1 allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc14a:1 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc14a:1 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc14a:1 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc14a:2 allocation score on rhel7-1: 15 -pcmk__native_allocate: rsc14a:2 allocation score on rhel7-2: 0 -pcmk__native_allocate: rsc14a:2 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc14a:2 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc14a:2 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc14a:3 allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc14a:3 allocation score on rhel7-2: 15 -pcmk__native_allocate: rsc14a:3 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc14a:3 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc14a:3 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc14a:4 allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc14a:4 allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc14a:4 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc14a:4 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc14a:4 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc14a:5 allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc14a:5 allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc14a:5 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc14a:5 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc14a:5 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc14a:6 allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc14a:6 allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc14a:6 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc14a:6 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc14a:6 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc14a:7 allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc14a:7 allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc14a:7 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc14a:7 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc14a:7 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc14a:8 allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc14a:8 allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc14a:8 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc14a:8 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc14a:8 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc14b allocation score on rhel7-1: 0 -pcmk__native_allocate: rsc14b allocation score on rhel7-2: 0 -pcmk__native_allocate: rsc14b allocation score on rhel7-3: 0 -pcmk__native_allocate: rsc14b allocation score on rhel7-4: 10 -pcmk__native_allocate: rsc14b allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc1a allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc1a allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc1a allocation score on rhel7-3: 0 -pcmk__native_allocate: rsc1a allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc1a allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc1b allocation score on rhel7-1: 0 -pcmk__native_allocate: rsc1b allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc1b allocation score on rhel7-3: 0 -pcmk__native_allocate: rsc1b allocation score on rhel7-4: 0 -pcmk__native_allocate: rsc1b allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc2a allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc2a allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc2a allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc2a allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc2a allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc2b allocation score on rhel7-1: 0 -pcmk__native_allocate: rsc2b allocation score on rhel7-2: 0 -pcmk__native_allocate: rsc2b allocation score on rhel7-3: 0 -pcmk__native_allocate: rsc2b allocation score on rhel7-4: 10 -pcmk__native_allocate: rsc2b allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc3a allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc3a allocation score on rhel7-2: 0 -pcmk__native_allocate: rsc3a allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc3a allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc3a allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc3b allocation score on rhel7-1: 0 -pcmk__native_allocate: rsc3b allocation score on rhel7-2: 0 -pcmk__native_allocate: rsc3b allocation score on rhel7-3: 0 -pcmk__native_allocate: rsc3b allocation score on rhel7-4: 0 -pcmk__native_allocate: rsc3b allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc4a allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc4a allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc4a allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc4a allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc4a allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc4b allocation score on rhel7-1: 0 -pcmk__native_allocate: rsc4b allocation score on rhel7-2: 0 -pcmk__native_allocate: rsc4b allocation score on rhel7-3: 10 -pcmk__native_allocate: rsc4b allocation score on rhel7-4: 0 -pcmk__native_allocate: rsc4b allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc5a allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc5a allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc5a allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc5a allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc5a allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc5a1 allocation score on rhel7-1: 20 -pcmk__native_allocate: rsc5a1 allocation score on rhel7-2: 0 -pcmk__native_allocate: rsc5a1 allocation score on rhel7-3: 0 -pcmk__native_allocate: rsc5a1 allocation score on rhel7-4: 0 -pcmk__native_allocate: rsc5a1 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc5a2 allocation score on rhel7-1: 10 -pcmk__native_allocate: rsc5a2 allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc5a2 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc5a2 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc5a2 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc6a allocation score on rhel7-1: 0 -pcmk__native_allocate: rsc6a allocation score on rhel7-2: 10 -pcmk__native_allocate: rsc6a allocation score on rhel7-3: 0 -pcmk__native_allocate: rsc6a allocation score on rhel7-4: 0 -pcmk__native_allocate: rsc6a allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc6a1 allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc6a1 allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc6a1 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc6a1 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc6a1 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc6a2 allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc6a2 allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc6a2 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc6a2 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc6a2 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc7a1 allocation score on rhel7-1: 0 -pcmk__native_allocate: rsc7a1 allocation score on rhel7-2: 0 -pcmk__native_allocate: rsc7a1 allocation score on rhel7-3: 10 -pcmk__native_allocate: rsc7a1 allocation score on rhel7-4: 0 -pcmk__native_allocate: rsc7a1 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc7a2 allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc7a2 allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc7a2 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc7a2 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc7a2 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc8a:0 allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc8a:0 allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc8a:0 allocation score on rhel7-3: 10 -pcmk__native_allocate: rsc8a:0 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc8a:0 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc8a:1 allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc8a:1 allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc8a:1 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc8a:1 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc8a:1 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc8a:2 allocation score on rhel7-1: 10 -pcmk__native_allocate: rsc8a:2 allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc8a:2 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc8a:2 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc8a:2 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc8b:0 allocation score on rhel7-1: 0 -pcmk__native_allocate: rsc8b:0 allocation score on rhel7-2: 0 -pcmk__native_allocate: rsc8b:0 allocation score on rhel7-3: 10 -pcmk__native_allocate: rsc8b:0 allocation score on rhel7-4: 0 -pcmk__native_allocate: rsc8b:0 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc8b:1 allocation score on rhel7-1: 0 -pcmk__native_allocate: rsc8b:1 allocation score on rhel7-2: 0 -pcmk__native_allocate: rsc8b:1 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc8b:1 allocation score on rhel7-4: 10 -pcmk__native_allocate: rsc8b:1 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc8b:2 allocation score on rhel7-1: 10 -pcmk__native_allocate: rsc8b:2 allocation score on rhel7-2: 0 -pcmk__native_allocate: rsc8b:2 allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc8b:2 allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc8b:2 allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc9a allocation score on rhel7-1: 0 -pcmk__native_allocate: rsc9a allocation score on rhel7-2: 0 -pcmk__native_allocate: rsc9a allocation score on rhel7-3: 0 -pcmk__native_allocate: rsc9a allocation score on rhel7-4: 10 -pcmk__native_allocate: rsc9a allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc9b allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc9b allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc9b allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc9b allocation score on rhel7-4: 10 -pcmk__native_allocate: rsc9b allocation score on rhel7-5: -INFINITY -pcmk__native_allocate: rsc9c allocation score on rhel7-1: -INFINITY -pcmk__native_allocate: rsc9c allocation score on rhel7-2: -INFINITY -pcmk__native_allocate: rsc9c allocation score on rhel7-3: -INFINITY -pcmk__native_allocate: rsc9c allocation score on rhel7-4: -INFINITY -pcmk__native_allocate: rsc9c allocation score on rhel7-5: -INFINITY -rsc13b:0 promotion score on rhel7-3: 10 -rsc13b:1 promotion score on rhel7-4: 5 -rsc13b:2 promotion score on rhel7-1: 5 -rsc13b:3 promotion score on rhel7-2: 5 -rsc13b:4 promotion score on none: 0 -rsc13b:5 promotion score on none: 0 -rsc13b:6 promotion score on none: 0 -rsc13b:7 promotion score on none: 0 -rsc13b:8 promotion score on none: 0 -rsc14a:0 promotion score on rhel7-3: -INFINITY -rsc14a:1 promotion score on none: 0 -rsc14a:2 promotion score on rhel7-1: -INFINITY -rsc14a:3 promotion score on rhel7-2: -INFINITY -rsc14a:4 promotion score on none: 0 -rsc14a:5 promotion score on none: 0 -rsc14a:6 promotion score on none: 0 -rsc14a:7 promotion score on none: 0 -rsc14a:8 promotion score on none: 0 diff --git a/cts/scheduler/colocation-influence.summary b/cts/scheduler/colocation-influence.summary deleted file mode 100644 index 626e87a..0000000 --- a/cts/scheduler/colocation-influence.summary +++ /dev/null @@ -1,168 +0,0 @@ - -Current cluster status: -Online: [ rhel7-1 rhel7-2 rhel7-3 rhel7-4 rhel7-5 ] -GuestOnline: [ bundle10-0:bundle10-docker-0 bundle10-1:bundle10-docker-1 bundle11-0:bundle11-docker-0 ] - - Fencing (stonith:fence_xvm): Started rhel7-1 - rsc1a (ocf::pacemaker:Dummy): Started rhel7-2 - rsc1b (ocf::pacemaker:Dummy): Started rhel7-2 - rsc2a (ocf::pacemaker:Dummy): Started rhel7-4 - rsc2b (ocf::pacemaker:Dummy): Started rhel7-4 - rsc3a (ocf::pacemaker:Dummy): Stopped - rsc3b (ocf::pacemaker:Dummy): Stopped - rsc4a (ocf::pacemaker:Dummy): Started rhel7-3 - rsc4b (ocf::pacemaker:Dummy): Started rhel7-3 - rsc5a (ocf::pacemaker:Dummy): Started rhel7-1 - Resource Group: group5a - rsc5a1 (ocf::pacemaker:Dummy): Started rhel7-1 - rsc5a2 (ocf::pacemaker:Dummy): Started rhel7-1 - Resource Group: group6a - rsc6a1 (ocf::pacemaker:Dummy): Started rhel7-2 - rsc6a2 (ocf::pacemaker:Dummy): Started rhel7-2 - rsc6a (ocf::pacemaker:Dummy): Started rhel7-2 - Resource Group: group7a - rsc7a1 (ocf::pacemaker:Dummy): Started rhel7-3 - rsc7a2 (ocf::pacemaker:Dummy): Started rhel7-3 - Clone Set: rsc8a-clone [rsc8a] - Started: [ rhel7-1 rhel7-3 rhel7-4 ] - Clone Set: rsc8b-clone [rsc8b] - Started: [ rhel7-1 rhel7-3 rhel7-4 ] - rsc9a (ocf::pacemaker:Dummy): Started rhel7-4 - rsc9b (ocf::pacemaker:Dummy): Started rhel7-4 - rsc9c (ocf::pacemaker:Dummy): Started rhel7-4 - rsc10a (ocf::pacemaker:Dummy): Started rhel7-2 - rsc11a (ocf::pacemaker:Dummy): Started rhel7-1 - rsc12a (ocf::pacemaker:Dummy): Started rhel7-1 - rsc12b (ocf::pacemaker:Dummy): Started rhel7-1 - rsc12c (ocf::pacemaker:Dummy): Started rhel7-1 - Container bundle set: bundle10 [pcmktest:http] - bundle10-0 (192.168.122.131) (ocf::heartbeat:apache): Started rhel7-2 - bundle10-1 (192.168.122.132) (ocf::heartbeat:apache): Started rhel7-3 - Container bundle set: bundle11 [pcmktest:http] - bundle11-0 (192.168.122.134) (ocf::pacemaker:Dummy): Started rhel7-1 - bundle11-1 (192.168.122.135) (ocf::pacemaker:Dummy): Stopped - rsc13a (ocf::pacemaker:Dummy): Started rhel7-3 - Clone Set: rsc13b-clone [rsc13b] (promotable) - Masters: [ rhel7-3 ] - Slaves: [ rhel7-1 rhel7-2 rhel7-4 ] - Stopped: [ rhel7-5 ] - rsc14b (ocf::pacemaker:Dummy): Started rhel7-4 - Clone Set: rsc14a-clone [rsc14a] (promotable) - Masters: [ rhel7-4 ] - Slaves: [ rhel7-1 rhel7-2 rhel7-3 ] - Stopped: [ rhel7-5 ] - -Transition Summary: - * Move rsc1a ( rhel7-2 -> rhel7-3 ) - * Move rsc1b ( rhel7-2 -> rhel7-3 ) - * Stop rsc2a ( rhel7-4 ) due to node availability - * Start rsc3a ( rhel7-2 ) - * Start rsc3b ( rhel7-2 ) - * Stop rsc4a ( rhel7-3 ) due to node availability - * Stop rsc5a ( rhel7-1 ) due to node availability - * Stop rsc6a1 ( rhel7-2 ) due to node availability - * Stop rsc6a2 ( rhel7-2 ) due to node availability - * Stop rsc7a2 ( rhel7-3 ) due to node availability - * Stop rsc8a:1 ( rhel7-4 ) due to node availability - * Stop rsc9c ( rhel7-4 ) due to node availability - * Move rsc10a ( rhel7-2 -> rhel7-3 ) - * Stop rsc12b ( rhel7-1 ) due to node availability - * Start bundle11-1 ( rhel7-5 ) due to unrunnable bundle11-docker-1 start (blocked) - * Start bundle11a:1 ( bundle11-1 ) due to unrunnable bundle11-docker-1 start (blocked) - * Stop rsc13a ( rhel7-3 ) due to node availability - * Stop rsc14a:1 ( Master rhel7-4 ) due to node availability - -Executing cluster transition: - * Resource action: rsc1a stop on rhel7-2 - * Resource action: rsc1b stop on rhel7-2 - * Resource action: rsc2a stop on rhel7-4 - * Resource action: rsc3a start on rhel7-2 - * Resource action: rsc3b start on rhel7-2 - * Resource action: rsc4a stop on rhel7-3 - * Resource action: rsc5a stop on rhel7-1 - * Pseudo action: group6a_stop_0 - * Resource action: rsc6a2 stop on rhel7-2 - * Pseudo action: group7a_stop_0 - * Resource action: rsc7a2 stop on rhel7-3 - * Pseudo action: rsc8a-clone_stop_0 - * Resource action: rsc9c stop on rhel7-4 - * Resource action: rsc10a stop on rhel7-2 - * Resource action: rsc12b stop on rhel7-1 - * Resource action: rsc13a stop on rhel7-3 - * Pseudo action: rsc14a-clone_demote_0 - * Pseudo action: bundle11_start_0 - * Resource action: rsc1a start on rhel7-3 - * Resource action: rsc1b start on rhel7-3 - * Resource action: rsc3a monitor=10000 on rhel7-2 - * Resource action: rsc3b monitor=10000 on rhel7-2 - * Resource action: rsc6a1 stop on rhel7-2 - * Pseudo action: group7a_stopped_0 - * Resource action: rsc8a stop on rhel7-4 - * Pseudo action: rsc8a-clone_stopped_0 - * Resource action: rsc10a start on rhel7-3 - * Pseudo action: bundle11-clone_start_0 - * Resource action: rsc14a demote on rhel7-4 - * Pseudo action: rsc14a-clone_demoted_0 - * Pseudo action: rsc14a-clone_stop_0 - * Resource action: rsc1a monitor=10000 on rhel7-3 - * Resource action: rsc1b monitor=10000 on rhel7-3 - * Pseudo action: group6a_stopped_0 - * Resource action: rsc10a monitor=10000 on rhel7-3 - * Pseudo action: bundle11-clone_running_0 - * Resource action: rsc14a stop on rhel7-4 - * Pseudo action: rsc14a-clone_stopped_0 - * Pseudo action: bundle11_running_0 - -Revised cluster status: -Online: [ rhel7-1 rhel7-2 rhel7-3 rhel7-4 rhel7-5 ] -GuestOnline: [ bundle10-0:bundle10-docker-0 bundle10-1:bundle10-docker-1 bundle11-0:bundle11-docker-0 ] - - Fencing (stonith:fence_xvm): Started rhel7-1 - rsc1a (ocf::pacemaker:Dummy): Started rhel7-3 - rsc1b (ocf::pacemaker:Dummy): Started rhel7-3 - rsc2a (ocf::pacemaker:Dummy): Stopped - rsc2b (ocf::pacemaker:Dummy): Started rhel7-4 - rsc3a (ocf::pacemaker:Dummy): Started rhel7-2 - rsc3b (ocf::pacemaker:Dummy): Started rhel7-2 - rsc4a (ocf::pacemaker:Dummy): Stopped - rsc4b (ocf::pacemaker:Dummy): Started rhel7-3 - rsc5a (ocf::pacemaker:Dummy): Stopped - Resource Group: group5a - rsc5a1 (ocf::pacemaker:Dummy): Started rhel7-1 - rsc5a2 (ocf::pacemaker:Dummy): Started rhel7-1 - Resource Group: group6a - rsc6a1 (ocf::pacemaker:Dummy): Stopped - rsc6a2 (ocf::pacemaker:Dummy): Stopped - rsc6a (ocf::pacemaker:Dummy): Started rhel7-2 - Resource Group: group7a - rsc7a1 (ocf::pacemaker:Dummy): Started rhel7-3 - rsc7a2 (ocf::pacemaker:Dummy): Stopped - Clone Set: rsc8a-clone [rsc8a] - Started: [ rhel7-1 rhel7-3 ] - Stopped: [ rhel7-2 rhel7-4 rhel7-5 ] - Clone Set: rsc8b-clone [rsc8b] - Started: [ rhel7-1 rhel7-3 rhel7-4 ] - rsc9a (ocf::pacemaker:Dummy): Started rhel7-4 - rsc9b (ocf::pacemaker:Dummy): Started rhel7-4 - rsc9c (ocf::pacemaker:Dummy): Stopped - rsc10a (ocf::pacemaker:Dummy): Started rhel7-3 - rsc11a (ocf::pacemaker:Dummy): Started rhel7-1 - rsc12a (ocf::pacemaker:Dummy): Started rhel7-1 - rsc12b (ocf::pacemaker:Dummy): Stopped - rsc12c (ocf::pacemaker:Dummy): Started rhel7-1 - Container bundle set: bundle10 [pcmktest:http] - bundle10-0 (192.168.122.131) (ocf::heartbeat:apache): Started rhel7-2 - bundle10-1 (192.168.122.132) (ocf::heartbeat:apache): Started rhel7-3 - Container bundle set: bundle11 [pcmktest:http] - bundle11-0 (192.168.122.134) (ocf::pacemaker:Dummy): Started rhel7-1 - bundle11-1 (192.168.122.135) (ocf::pacemaker:Dummy): Stopped - rsc13a (ocf::pacemaker:Dummy): Stopped - Clone Set: rsc13b-clone [rsc13b] (promotable) - Masters: [ rhel7-3 ] - Slaves: [ rhel7-1 rhel7-2 rhel7-4 ] - Stopped: [ rhel7-5 ] - rsc14b (ocf::pacemaker:Dummy): Started rhel7-4 - Clone Set: rsc14a-clone [rsc14a] (promotable) - Slaves: [ rhel7-1 rhel7-2 rhel7-3 ] - Stopped: [ rhel7-4 rhel7-5 ] - diff --git a/cts/scheduler/colocation-influence.xml b/cts/scheduler/colocation-influence.xml deleted file mode 100644 index 5962cd2..0000000 --- a/cts/scheduler/colocation-influence.xml +++ /dev/null @@ -1,1298 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cts/scheduler/nested-remote-recovery.dot b/cts/scheduler/nested-remote-recovery.dot index 2afc6e9..02a267f 100644 --- a/cts/scheduler/nested-remote-recovery.dot +++ b/cts/scheduler/nested-remote-recovery.dot @@ -86,4 +86,49 @@ "stonith 'reboot' galera-bundle-0" -> "galera_promote_0 galera-bundle-0" [ style = bold] "stonith 'reboot' galera-bundle-0" -> "galera_start_0 galera-bundle-0" [ style = bold] "stonith 'reboot' galera-bundle-0" [ style=bold color="green" fontcolor="orange"] +"stonith-fence_ipmilan-5254000203a2_monitor_60000 controller-2" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-5254000203a2_start_0 controller-2" -> "stonith-fence_ipmilan-5254000203a2_monitor_60000 controller-2" [ style = bold] +"stonith-fence_ipmilan-5254000203a2_start_0 controller-2" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-5254000203a2_stop_0 controller-2" -> "stonith-fence_ipmilan-5254000203a2_start_0 controller-2" [ style = bold] +"stonith-fence_ipmilan-5254000203a2_stop_0 controller-2" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-5254002f6d57_monitor_60000 controller-1" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-5254002f6d57_start_0 controller-1" -> "stonith-fence_ipmilan-5254002f6d57_monitor_60000 controller-1" [ style = bold] +"stonith-fence_ipmilan-5254002f6d57_start_0 controller-1" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-5254002f6d57_stop_0 controller-1" -> "stonith-fence_ipmilan-5254002f6d57_start_0 controller-1" [ style = bold] +"stonith-fence_ipmilan-5254002f6d57_stop_0 controller-1" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-5254003296a5_monitor_60000 controller-1" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-5254003296a5_start_0 controller-1" -> "stonith-fence_ipmilan-5254003296a5_monitor_60000 controller-1" [ style = bold] +"stonith-fence_ipmilan-5254003296a5_start_0 controller-1" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-5254003296a5_stop_0 controller-1" -> "stonith-fence_ipmilan-5254003296a5_start_0 controller-1" [ style = bold] +"stonith-fence_ipmilan-5254003296a5_stop_0 controller-1" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-5254005f9a33_monitor_60000 controller-2" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-5254005f9a33_start_0 controller-2" -> "stonith-fence_ipmilan-5254005f9a33_monitor_60000 controller-2" [ style = bold] +"stonith-fence_ipmilan-5254005f9a33_start_0 controller-2" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-5254005f9a33_stop_0 controller-2" -> "stonith-fence_ipmilan-5254005f9a33_start_0 controller-2" [ style = bold] +"stonith-fence_ipmilan-5254005f9a33_stop_0 controller-2" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-52540065418e_monitor_60000 controller-2" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-52540065418e_start_0 controller-2" -> "stonith-fence_ipmilan-52540065418e_monitor_60000 controller-2" [ style = bold] +"stonith-fence_ipmilan-52540065418e_start_0 controller-2" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-52540065418e_stop_0 controller-2" -> "stonith-fence_ipmilan-52540065418e_start_0 controller-2" [ style = bold] +"stonith-fence_ipmilan-52540065418e_stop_0 controller-2" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-52540066e27e_monitor_60000 controller-1" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-52540066e27e_start_0 controller-1" -> "stonith-fence_ipmilan-52540066e27e_monitor_60000 controller-1" [ style = bold] +"stonith-fence_ipmilan-52540066e27e_start_0 controller-1" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-52540066e27e_stop_0 controller-1" -> "stonith-fence_ipmilan-52540066e27e_start_0 controller-1" [ style = bold] +"stonith-fence_ipmilan-52540066e27e_stop_0 controller-1" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-52540098c9ff_monitor_60000 controller-1" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-52540098c9ff_start_0 controller-1" -> "stonith-fence_ipmilan-52540098c9ff_monitor_60000 controller-1" [ style = bold] +"stonith-fence_ipmilan-52540098c9ff_start_0 controller-1" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-52540098c9ff_stop_0 controller-1" -> "stonith-fence_ipmilan-52540098c9ff_start_0 controller-1" [ style = bold] +"stonith-fence_ipmilan-52540098c9ff_stop_0 controller-1" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400a16c0d_monitor_60000 controller-1" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400a16c0d_start_0 controller-1" -> "stonith-fence_ipmilan-525400a16c0d_monitor_60000 controller-1" [ style = bold] +"stonith-fence_ipmilan-525400a16c0d_start_0 controller-1" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400a16c0d_stop_0 controller-1" -> "stonith-fence_ipmilan-525400a16c0d_start_0 controller-1" [ style = bold] +"stonith-fence_ipmilan-525400a16c0d_stop_0 controller-1" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400aab9d9_monitor_60000 controller-2" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400aab9d9_start_0 controller-2" -> "stonith-fence_ipmilan-525400aab9d9_monitor_60000 controller-2" [ style = bold] +"stonith-fence_ipmilan-525400aab9d9_start_0 controller-2" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400aab9d9_stop_0 controller-2" -> "stonith-fence_ipmilan-525400aab9d9_start_0 controller-2" [ style = bold] +"stonith-fence_ipmilan-525400aab9d9_stop_0 controller-2" [ style=bold color="green" fontcolor="black"] } diff --git a/cts/scheduler/nested-remote-recovery.exp b/cts/scheduler/nested-remote-recovery.exp index 795a6ea..37c51c1 100644 --- a/cts/scheduler/nested-remote-recovery.exp +++ b/cts/scheduler/nested-remote-recovery.exp @@ -1,45 +1,45 @@ - + - + - + - + - + - + - + - + - + - + @@ -48,23 +48,23 @@ - + - + - + - + - + @@ -73,121 +73,121 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -196,40 +196,40 @@ - + - + - + - + - + - + - + - + @@ -239,7 +239,7 @@ - + @@ -255,10 +255,10 @@ - + - + @@ -271,29 +271,29 @@ - + - + - + - + - + @@ -312,12 +312,327 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -331,62 +646,62 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -395,49 +710,49 @@ - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/cts/scheduler/nested-remote-recovery.scores b/cts/scheduler/nested-remote-recovery.scores index 83ae5aa..e3b75dd 100644 --- a/cts/scheduler/nested-remote-recovery.scores +++ b/cts/scheduler/nested-remote-recovery.scores @@ -1,22 +1,4 @@ Allocation scores: -Only 'private' parameters to stonith-fence_ipmilan-5254000203a2_monitor_60000 on controller-2 changed: 0:0;216:2:0:018a4c7f-d5cb-4ef8-85a4-031ed2cffd23 -Only 'private' parameters to stonith-fence_ipmilan-5254000203a2_start_0 on controller-2 changed: 0:0;222:1:0:018a4c7f-d5cb-4ef8-85a4-031ed2cffd23 -Only 'private' parameters to stonith-fence_ipmilan-5254002f6d57_monitor_60000 on controller-1 changed: 0:0;229:2:0:79eb6bb3-23ce-41d1-863c-4f68a738af58 -Only 'private' parameters to stonith-fence_ipmilan-5254002f6d57_start_0 on controller-1 changed: 0:0;237:1:0:79eb6bb3-23ce-41d1-863c-4f68a738af58 -Only 'private' parameters to stonith-fence_ipmilan-5254003296a5_monitor_60000 on controller-1 changed: 0:0;216:2:0:79eb6bb3-23ce-41d1-863c-4f68a738af58 -Only 'private' parameters to stonith-fence_ipmilan-5254003296a5_start_0 on controller-1 changed: 0:0;224:1:0:79eb6bb3-23ce-41d1-863c-4f68a738af58 -Only 'private' parameters to stonith-fence_ipmilan-5254005f9a33_monitor_60000 on controller-2 changed: 0:0;211:2:0:018a4c7f-d5cb-4ef8-85a4-031ed2cffd23 -Only 'private' parameters to stonith-fence_ipmilan-5254005f9a33_start_0 on controller-2 changed: 0:0;217:1:0:018a4c7f-d5cb-4ef8-85a4-031ed2cffd23 -Only 'private' parameters to stonith-fence_ipmilan-52540065418e_monitor_60000 on controller-2 changed: 0:0;223:2:0:018a4c7f-d5cb-4ef8-85a4-031ed2cffd23 -Only 'private' parameters to stonith-fence_ipmilan-52540065418e_start_0 on controller-2 changed: 0:0;229:1:0:018a4c7f-d5cb-4ef8-85a4-031ed2cffd23 -Only 'private' parameters to stonith-fence_ipmilan-52540066e27e_monitor_60000 on controller-1 changed: 0:0;219:2:0:79eb6bb3-23ce-41d1-863c-4f68a738af58 -Only 'private' parameters to stonith-fence_ipmilan-52540066e27e_start_0 on controller-1 changed: 0:0;227:1:0:79eb6bb3-23ce-41d1-863c-4f68a738af58 -Only 'private' parameters to stonith-fence_ipmilan-52540098c9ff_monitor_60000 on controller-1 changed: 0:0;211:2:0:79eb6bb3-23ce-41d1-863c-4f68a738af58 -Only 'private' parameters to stonith-fence_ipmilan-52540098c9ff_start_0 on controller-1 changed: 0:0;219:1:0:79eb6bb3-23ce-41d1-863c-4f68a738af58 -Only 'private' parameters to stonith-fence_ipmilan-525400a16c0d_monitor_60000 on controller-1 changed: 0:0;229:2:0:018a4c7f-d5cb-4ef8-85a4-031ed2cffd23 -Only 'private' parameters to stonith-fence_ipmilan-525400a16c0d_start_0 on controller-1 changed: 0:0;235:1:0:018a4c7f-d5cb-4ef8-85a4-031ed2cffd23 -Only 'private' parameters to stonith-fence_ipmilan-525400aab9d9_monitor_60000 on controller-2 changed: 0:0;226:2:0:018a4c7f-d5cb-4ef8-85a4-031ed2cffd23 -Only 'private' parameters to stonith-fence_ipmilan-525400aab9d9_start_0 on controller-2 changed: 0:0;232:1:0:018a4c7f-d5cb-4ef8-85a4-031ed2cffd23 Using the original execution date of: 2018-09-11 21:23:25Z galera:0 promotion score on galera-bundle-0: 100 galera:1 promotion score on galera-bundle-1: 100 diff --git a/cts/scheduler/nested-remote-recovery.summary b/cts/scheduler/nested-remote-recovery.summary index fef6ba3..a8552b7 100644 --- a/cts/scheduler/nested-remote-recovery.summary +++ b/cts/scheduler/nested-remote-recovery.summary @@ -45,32 +45,50 @@ GuestOnline: [ galera-bundle-1:galera-bundle-docker-1 galera-bundle-2:galera-bun stonith-fence_ipmilan-525400a16c0d (stonith:fence_ipmilan): Started controller-1 stonith-fence_ipmilan-5254002f6d57 (stonith:fence_ipmilan): Started controller-1 -Only 'private' parameters to stonith-fence_ipmilan-525400aab9d9_start_0 on controller-2 changed: 0:0;232:1:0:018a4c7f-d5cb-4ef8-85a4-031ed2cffd23 -Only 'private' parameters to stonith-fence_ipmilan-525400aab9d9_monitor_60000 on controller-2 changed: 0:0;226:2:0:018a4c7f-d5cb-4ef8-85a4-031ed2cffd23 -Only 'private' parameters to stonith-fence_ipmilan-5254000203a2_start_0 on controller-2 changed: 0:0;222:1:0:018a4c7f-d5cb-4ef8-85a4-031ed2cffd23 -Only 'private' parameters to stonith-fence_ipmilan-5254000203a2_monitor_60000 on controller-2 changed: 0:0;216:2:0:018a4c7f-d5cb-4ef8-85a4-031ed2cffd23 -Only 'private' parameters to stonith-fence_ipmilan-52540065418e_start_0 on controller-2 changed: 0:0;229:1:0:018a4c7f-d5cb-4ef8-85a4-031ed2cffd23 -Only 'private' parameters to stonith-fence_ipmilan-52540065418e_monitor_60000 on controller-2 changed: 0:0;223:2:0:018a4c7f-d5cb-4ef8-85a4-031ed2cffd23 -Only 'private' parameters to stonith-fence_ipmilan-5254005f9a33_start_0 on controller-2 changed: 0:0;217:1:0:018a4c7f-d5cb-4ef8-85a4-031ed2cffd23 -Only 'private' parameters to stonith-fence_ipmilan-5254005f9a33_monitor_60000 on controller-2 changed: 0:0;211:2:0:018a4c7f-d5cb-4ef8-85a4-031ed2cffd23 -Only 'private' parameters to stonith-fence_ipmilan-5254002f6d57_start_0 on controller-1 changed: 0:0;237:1:0:79eb6bb3-23ce-41d1-863c-4f68a738af58 -Only 'private' parameters to stonith-fence_ipmilan-5254002f6d57_monitor_60000 on controller-1 changed: 0:0;229:2:0:79eb6bb3-23ce-41d1-863c-4f68a738af58 -Only 'private' parameters to stonith-fence_ipmilan-52540066e27e_start_0 on controller-1 changed: 0:0;227:1:0:79eb6bb3-23ce-41d1-863c-4f68a738af58 -Only 'private' parameters to stonith-fence_ipmilan-52540066e27e_monitor_60000 on controller-1 changed: 0:0;219:2:0:79eb6bb3-23ce-41d1-863c-4f68a738af58 -Only 'private' parameters to stonith-fence_ipmilan-525400a16c0d_start_0 on controller-1 changed: 0:0;235:1:0:018a4c7f-d5cb-4ef8-85a4-031ed2cffd23 -Only 'private' parameters to stonith-fence_ipmilan-525400a16c0d_monitor_60000 on controller-1 changed: 0:0;229:2:0:018a4c7f-d5cb-4ef8-85a4-031ed2cffd23 -Only 'private' parameters to stonith-fence_ipmilan-5254003296a5_start_0 on controller-1 changed: 0:0;224:1:0:79eb6bb3-23ce-41d1-863c-4f68a738af58 -Only 'private' parameters to stonith-fence_ipmilan-5254003296a5_monitor_60000 on controller-1 changed: 0:0;216:2:0:79eb6bb3-23ce-41d1-863c-4f68a738af58 -Only 'private' parameters to stonith-fence_ipmilan-52540098c9ff_start_0 on controller-1 changed: 0:0;219:1:0:79eb6bb3-23ce-41d1-863c-4f68a738af58 -Only 'private' parameters to stonith-fence_ipmilan-52540098c9ff_monitor_60000 on controller-1 changed: 0:0;211:2:0:79eb6bb3-23ce-41d1-863c-4f68a738af58 Transition Summary: * Fence (reboot) galera-bundle-0 (resource: galera-bundle-docker-0) 'guest is unclean' * Recover galera-bundle-docker-0 ( database-0 ) * Recover galera-bundle-0 ( controller-0 ) * Recover galera:0 ( Master galera-bundle-0 ) + * Restart stonith-fence_ipmilan-5254005f9a33 ( controller-2 ) due to resource definition change + * Restart stonith-fence_ipmilan-52540098c9ff ( controller-1 ) due to resource definition change + * Restart stonith-fence_ipmilan-5254000203a2 ( controller-2 ) due to resource definition change + * Restart stonith-fence_ipmilan-5254003296a5 ( controller-1 ) due to resource definition change + * Restart stonith-fence_ipmilan-52540066e27e ( controller-1 ) due to resource definition change + * Restart stonith-fence_ipmilan-52540065418e ( controller-2 ) due to resource definition change + * Restart stonith-fence_ipmilan-525400aab9d9 ( controller-2 ) due to resource definition change + * Restart stonith-fence_ipmilan-525400a16c0d ( controller-1 ) due to resource definition change + * Restart stonith-fence_ipmilan-5254002f6d57 ( controller-1 ) due to resource definition change Executing cluster transition: * Resource action: galera-bundle-0 stop on controller-0 + * Resource action: stonith-fence_ipmilan-5254005f9a33 stop on controller-2 + * Resource action: stonith-fence_ipmilan-5254005f9a33 start on controller-2 + * Resource action: stonith-fence_ipmilan-5254005f9a33 monitor=60000 on controller-2 + * Resource action: stonith-fence_ipmilan-52540098c9ff stop on controller-1 + * Resource action: stonith-fence_ipmilan-52540098c9ff start on controller-1 + * Resource action: stonith-fence_ipmilan-52540098c9ff monitor=60000 on controller-1 + * Resource action: stonith-fence_ipmilan-5254000203a2 stop on controller-2 + * Resource action: stonith-fence_ipmilan-5254000203a2 start on controller-2 + * Resource action: stonith-fence_ipmilan-5254000203a2 monitor=60000 on controller-2 + * Resource action: stonith-fence_ipmilan-5254003296a5 stop on controller-1 + * Resource action: stonith-fence_ipmilan-5254003296a5 start on controller-1 + * Resource action: stonith-fence_ipmilan-5254003296a5 monitor=60000 on controller-1 + * Resource action: stonith-fence_ipmilan-52540066e27e stop on controller-1 + * Resource action: stonith-fence_ipmilan-52540066e27e start on controller-1 + * Resource action: stonith-fence_ipmilan-52540066e27e monitor=60000 on controller-1 + * Resource action: stonith-fence_ipmilan-52540065418e stop on controller-2 + * Resource action: stonith-fence_ipmilan-52540065418e start on controller-2 + * Resource action: stonith-fence_ipmilan-52540065418e monitor=60000 on controller-2 + * Resource action: stonith-fence_ipmilan-525400aab9d9 stop on controller-2 + * Resource action: stonith-fence_ipmilan-525400aab9d9 start on controller-2 + * Resource action: stonith-fence_ipmilan-525400aab9d9 monitor=60000 on controller-2 + * Resource action: stonith-fence_ipmilan-525400a16c0d stop on controller-1 + * Resource action: stonith-fence_ipmilan-525400a16c0d start on controller-1 + * Resource action: stonith-fence_ipmilan-525400a16c0d monitor=60000 on controller-1 + * Resource action: stonith-fence_ipmilan-5254002f6d57 stop on controller-1 + * Resource action: stonith-fence_ipmilan-5254002f6d57 start on controller-1 + * Resource action: stonith-fence_ipmilan-5254002f6d57 monitor=60000 on controller-1 * Pseudo action: galera-bundle_demote_0 * Pseudo action: galera-bundle-master_demote_0 * Pseudo action: galera_demote_0 diff --git a/cts/scheduler/no-promote-on-unrunnable-guest.dot b/cts/scheduler/no-promote-on-unrunnable-guest.dot index b9696fc..6063640 100644 --- a/cts/scheduler/no-promote-on-unrunnable-guest.dot +++ b/cts/scheduler/no-promote-on-unrunnable-guest.dot @@ -110,4 +110,19 @@ "ovndb_servers_stop_0 ovn-dbs-bundle-0" -> "ovn-dbs-bundle-master_stopped_0" [ style = bold] "ovndb_servers_stop_0 ovn-dbs-bundle-0" -> "ovndb_servers_start_0 ovn-dbs-bundle-0" [ style = dashed] "ovndb_servers_stop_0 ovn-dbs-bundle-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-5254005e097a_monitor_60000 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-5254005e097a_start_0 controller-0" -> "stonith-fence_ipmilan-5254005e097a_monitor_60000 controller-0" [ style = bold] +"stonith-fence_ipmilan-5254005e097a_start_0 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-5254005e097a_stop_0 controller-0" -> "stonith-fence_ipmilan-5254005e097a_start_0 controller-0" [ style = bold] +"stonith-fence_ipmilan-5254005e097a_stop_0 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400985679_monitor_60000 controller-1" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400985679_start_0 controller-1" -> "stonith-fence_ipmilan-525400985679_monitor_60000 controller-1" [ style = bold] +"stonith-fence_ipmilan-525400985679_start_0 controller-1" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400985679_stop_0 controller-1" -> "stonith-fence_ipmilan-525400985679_start_0 controller-1" [ style = bold] +"stonith-fence_ipmilan-525400985679_stop_0 controller-1" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400afe30e_monitor_60000 controller-2" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400afe30e_start_0 controller-2" -> "stonith-fence_ipmilan-525400afe30e_monitor_60000 controller-2" [ style = bold] +"stonith-fence_ipmilan-525400afe30e_start_0 controller-2" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400afe30e_stop_0 controller-2" -> "stonith-fence_ipmilan-525400afe30e_start_0 controller-2" [ style = bold] +"stonith-fence_ipmilan-525400afe30e_stop_0 controller-2" [ style=bold color="green" fontcolor="black"] } diff --git a/cts/scheduler/no-promote-on-unrunnable-guest.exp b/cts/scheduler/no-promote-on-unrunnable-guest.exp index b675aed..4417f6e 100644 --- a/cts/scheduler/no-promote-on-unrunnable-guest.exp +++ b/cts/scheduler/no-promote-on-unrunnable-guest.exp @@ -8,23 +8,23 @@ - + - + - + - + @@ -37,7 +37,7 @@ - + @@ -50,7 +50,7 @@ - + @@ -63,7 +63,7 @@ - + @@ -76,32 +76,32 @@ - + - + - + - + - + - + @@ -111,7 +111,7 @@ - + @@ -133,7 +133,7 @@ - + @@ -146,7 +146,7 @@ - + @@ -159,7 +159,7 @@ - + @@ -172,19 +172,19 @@ - + - + - + @@ -196,28 +196,28 @@ - + - + - + - + - + @@ -229,61 +229,61 @@ - + - + - + - + - + - + - + - + - + - + - + - + @@ -295,28 +295,28 @@ - + - + - + - + - + @@ -331,7 +331,7 @@ - + @@ -339,131 +339,131 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -473,69 +473,174 @@ - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/cts/scheduler/no-promote-on-unrunnable-guest.scores b/cts/scheduler/no-promote-on-unrunnable-guest.scores index 3e6776f..f368ad4 100644 --- a/cts/scheduler/no-promote-on-unrunnable-guest.scores +++ b/cts/scheduler/no-promote-on-unrunnable-guest.scores @@ -1,10 +1,4 @@ Allocation scores: -Only 'private' parameters to stonith-fence_ipmilan-5254005e097a_monitor_60000 on controller-0 changed: 0:0;218:60:0:515fab44-df8e-4e73-a22c-ed4886e03330 -Only 'private' parameters to stonith-fence_ipmilan-5254005e097a_start_0 on controller-0 changed: 0:0;217:60:0:515fab44-df8e-4e73-a22c-ed4886e03330 -Only 'private' parameters to stonith-fence_ipmilan-525400985679_monitor_60000 on controller-1 changed: 0:0;224:64:0:515fab44-df8e-4e73-a22c-ed4886e03330 -Only 'private' parameters to stonith-fence_ipmilan-525400985679_start_0 on controller-1 changed: 0:0;223:64:0:515fab44-df8e-4e73-a22c-ed4886e03330 -Only 'private' parameters to stonith-fence_ipmilan-525400afe30e_monitor_60000 on controller-2 changed: 0:0;220:60:0:515fab44-df8e-4e73-a22c-ed4886e03330 -Only 'private' parameters to stonith-fence_ipmilan-525400afe30e_start_0 on controller-2 changed: 0:0;219:60:0:515fab44-df8e-4e73-a22c-ed4886e03330 Using the original execution date of: 2020-05-14 10:49:31Z galera:0 promotion score on galera-bundle-0: 100 galera:1 promotion score on galera-bundle-1: 100 diff --git a/cts/scheduler/no-promote-on-unrunnable-guest.summary b/cts/scheduler/no-promote-on-unrunnable-guest.summary index fdc2668..fd6b926 100644 --- a/cts/scheduler/no-promote-on-unrunnable-guest.summary +++ b/cts/scheduler/no-promote-on-unrunnable-guest.summary @@ -26,21 +26,27 @@ GuestOnline: [ galera-bundle-0:galera-bundle-podman-0 galera-bundle-1:galera-bun Container bundle: openstack-cinder-volume [cluster.common.tag/rhosp16-openstack-cinder-volume:pcmklatest] openstack-cinder-volume-podman-0 (ocf::heartbeat:podman): Started controller-0 -Only 'private' parameters to stonith-fence_ipmilan-5254005e097a_start_0 on controller-0 changed: 0:0;217:60:0:515fab44-df8e-4e73-a22c-ed4886e03330 -Only 'private' parameters to stonith-fence_ipmilan-5254005e097a_monitor_60000 on controller-0 changed: 0:0;218:60:0:515fab44-df8e-4e73-a22c-ed4886e03330 -Only 'private' parameters to stonith-fence_ipmilan-525400985679_start_0 on controller-1 changed: 0:0;223:64:0:515fab44-df8e-4e73-a22c-ed4886e03330 -Only 'private' parameters to stonith-fence_ipmilan-525400985679_monitor_60000 on controller-1 changed: 0:0;224:64:0:515fab44-df8e-4e73-a22c-ed4886e03330 -Only 'private' parameters to stonith-fence_ipmilan-525400afe30e_start_0 on controller-2 changed: 0:0;219:60:0:515fab44-df8e-4e73-a22c-ed4886e03330 -Only 'private' parameters to stonith-fence_ipmilan-525400afe30e_monitor_60000 on controller-2 changed: 0:0;220:60:0:515fab44-df8e-4e73-a22c-ed4886e03330 Transition Summary: * Stop ovn-dbs-bundle-podman-0 ( controller-0 ) due to node availability * Stop ovn-dbs-bundle-0 ( controller-0 ) due to unrunnable ovn-dbs-bundle-podman-0 start * Stop ovndb_servers:0 ( Slave ovn-dbs-bundle-0 ) due to unrunnable ovn-dbs-bundle-podman-0 start * Promote ovndb_servers:1 ( Slave -> Master ovn-dbs-bundle-1 ) + * Restart stonith-fence_ipmilan-5254005e097a ( controller-0 ) due to resource definition change + * Restart stonith-fence_ipmilan-525400afe30e ( controller-2 ) due to resource definition change + * Restart stonith-fence_ipmilan-525400985679 ( controller-1 ) due to resource definition change Executing cluster transition: * Resource action: ovndb_servers cancel=30000 on ovn-dbs-bundle-1 * Pseudo action: ovn-dbs-bundle-master_pre_notify_stop_0 + * Resource action: stonith-fence_ipmilan-5254005e097a stop on controller-0 + * Resource action: stonith-fence_ipmilan-5254005e097a start on controller-0 + * Resource action: stonith-fence_ipmilan-5254005e097a monitor=60000 on controller-0 + * Resource action: stonith-fence_ipmilan-525400afe30e stop on controller-2 + * Resource action: stonith-fence_ipmilan-525400afe30e start on controller-2 + * Resource action: stonith-fence_ipmilan-525400afe30e monitor=60000 on controller-2 + * Resource action: stonith-fence_ipmilan-525400985679 stop on controller-1 + * Resource action: stonith-fence_ipmilan-525400985679 start on controller-1 + * Resource action: stonith-fence_ipmilan-525400985679 monitor=60000 on controller-1 * Pseudo action: ovn-dbs-bundle_stop_0 * Resource action: ovndb_servers notify on ovn-dbs-bundle-0 * Resource action: ovndb_servers notify on ovn-dbs-bundle-1 diff --git a/cts/scheduler/notifs-for-unrunnable.dot b/cts/scheduler/notifs-for-unrunnable.dot index aa4039e..f17e9b4 100644 --- a/cts/scheduler/notifs-for-unrunnable.dot +++ b/cts/scheduler/notifs-for-unrunnable.dot @@ -74,4 +74,19 @@ "redis:0_start_0 redis-bundle-0" -> "redis:0_monitor_45000 redis-bundle-0" [ style = dashed] "redis:0_start_0 redis-bundle-0" -> "redis:0_monitor_60000 redis-bundle-0" [ style = dashed] "redis:0_start_0 redis-bundle-0" [ style=dashed color="red" fontcolor="black"] +"stonith-fence_ipmilan-5254002ff217_monitor_60000 controller-2" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-5254002ff217_start_0 controller-2" -> "stonith-fence_ipmilan-5254002ff217_monitor_60000 controller-2" [ style = bold] +"stonith-fence_ipmilan-5254002ff217_start_0 controller-2" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-5254002ff217_stop_0 controller-2" -> "stonith-fence_ipmilan-5254002ff217_start_0 controller-2" [ style = bold] +"stonith-fence_ipmilan-5254002ff217_stop_0 controller-2" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-5254008f971a_monitor_60000 controller-1" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-5254008f971a_start_0 controller-1" -> "stonith-fence_ipmilan-5254008f971a_monitor_60000 controller-1" [ style = bold] +"stonith-fence_ipmilan-5254008f971a_start_0 controller-1" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-5254008f971a_stop_0 controller-1" -> "stonith-fence_ipmilan-5254008f971a_start_0 controller-1" [ style = bold] +"stonith-fence_ipmilan-5254008f971a_stop_0 controller-1" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400fec0c8_monitor_60000 controller-1" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400fec0c8_start_0 controller-1" -> "stonith-fence_ipmilan-525400fec0c8_monitor_60000 controller-1" [ style = bold] +"stonith-fence_ipmilan-525400fec0c8_start_0 controller-1" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400fec0c8_stop_0 controller-1" -> "stonith-fence_ipmilan-525400fec0c8_start_0 controller-1" [ style = bold] +"stonith-fence_ipmilan-525400fec0c8_stop_0 controller-1" [ style=bold color="green" fontcolor="black"] } diff --git a/cts/scheduler/notifs-for-unrunnable.exp b/cts/scheduler/notifs-for-unrunnable.exp index 44bb4c3..82067ae 100644 --- a/cts/scheduler/notifs-for-unrunnable.exp +++ b/cts/scheduler/notifs-for-unrunnable.exp @@ -1,46 +1,46 @@ - + - + - + - + - + - + - + - + @@ -48,97 +48,97 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -146,86 +146,191 @@ - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/cts/scheduler/notifs-for-unrunnable.scores b/cts/scheduler/notifs-for-unrunnable.scores index 8434da8..cd9df1c 100644 --- a/cts/scheduler/notifs-for-unrunnable.scores +++ b/cts/scheduler/notifs-for-unrunnable.scores @@ -1,10 +1,4 @@ Allocation scores: -Only 'private' parameters to stonith-fence_ipmilan-5254002ff217_monitor_60000 on controller-2 changed: 0:0;181:2:0:8b283351-71e8-4848-b470-8664f73af1e9 -Only 'private' parameters to stonith-fence_ipmilan-5254002ff217_start_0 on controller-2 changed: 0:0;180:2:0:8b283351-71e8-4848-b470-8664f73af1e9 -Only 'private' parameters to stonith-fence_ipmilan-5254008f971a_monitor_60000 on controller-1 changed: 0:0;183:2:0:8b283351-71e8-4848-b470-8664f73af1e9 -Only 'private' parameters to stonith-fence_ipmilan-5254008f971a_start_0 on controller-1 changed: 0:0;182:2:0:8b283351-71e8-4848-b470-8664f73af1e9 -Only 'private' parameters to stonith-fence_ipmilan-525400fec0c8_monitor_60000 on controller-1 changed: 0:0;179:2:0:8b283351-71e8-4848-b470-8664f73af1e9 -Only 'private' parameters to stonith-fence_ipmilan-525400fec0c8_start_0 on controller-1 changed: 0:0;178:2:0:8b283351-71e8-4848-b470-8664f73af1e9 Using the original execution date of: 2018-02-13 23:40:47Z galera:0 promotion score on galera-bundle-0: -1 galera:1 promotion score on galera-bundle-1: 100 diff --git a/cts/scheduler/notifs-for-unrunnable.summary b/cts/scheduler/notifs-for-unrunnable.summary index 3f1680c..d8d00fd 100644 --- a/cts/scheduler/notifs-for-unrunnable.summary +++ b/cts/scheduler/notifs-for-unrunnable.summary @@ -32,12 +32,6 @@ GuestOnline: [ galera-bundle-1:galera-bundle-docker-1 galera-bundle-2:galera-bun stonith-fence_ipmilan-5254002ff217 (stonith:fence_ipmilan): Started controller-2 stonith-fence_ipmilan-5254008f971a (stonith:fence_ipmilan): Started controller-1 -Only 'private' parameters to stonith-fence_ipmilan-525400fec0c8_start_0 on controller-1 changed: 0:0;178:2:0:8b283351-71e8-4848-b470-8664f73af1e9 -Only 'private' parameters to stonith-fence_ipmilan-525400fec0c8_monitor_60000 on controller-1 changed: 0:0;179:2:0:8b283351-71e8-4848-b470-8664f73af1e9 -Only 'private' parameters to stonith-fence_ipmilan-5254008f971a_start_0 on controller-1 changed: 0:0;182:2:0:8b283351-71e8-4848-b470-8664f73af1e9 -Only 'private' parameters to stonith-fence_ipmilan-5254008f971a_monitor_60000 on controller-1 changed: 0:0;183:2:0:8b283351-71e8-4848-b470-8664f73af1e9 -Only 'private' parameters to stonith-fence_ipmilan-5254002ff217_start_0 on controller-2 changed: 0:0;180:2:0:8b283351-71e8-4848-b470-8664f73af1e9 -Only 'private' parameters to stonith-fence_ipmilan-5254002ff217_monitor_60000 on controller-2 changed: 0:0;181:2:0:8b283351-71e8-4848-b470-8664f73af1e9 Transition Summary: * Start rabbitmq-bundle-0 ( controller-1 ) due to unrunnable rabbitmq-bundle-docker-0 start (blocked) * Start rabbitmq:0 ( rabbitmq-bundle-0 ) due to unrunnable rabbitmq-bundle-docker-0 start (blocked) @@ -45,10 +39,22 @@ Transition Summary: * Start galera:0 ( galera-bundle-0 ) due to unrunnable galera-bundle-docker-0 start (blocked) * Start redis-bundle-0 ( controller-1 ) due to unrunnable redis-bundle-docker-0 start (blocked) * Start redis:0 ( redis-bundle-0 ) due to unrunnable redis-bundle-docker-0 start (blocked) + * Restart stonith-fence_ipmilan-525400fec0c8 ( controller-1 ) due to resource definition change + * Restart stonith-fence_ipmilan-5254002ff217 ( controller-2 ) due to resource definition change + * Restart stonith-fence_ipmilan-5254008f971a ( controller-1 ) due to resource definition change Executing cluster transition: * Pseudo action: rabbitmq-bundle-clone_pre_notify_start_0 * Pseudo action: redis-bundle-master_pre_notify_start_0 + * Resource action: stonith-fence_ipmilan-525400fec0c8 stop on controller-1 + * Resource action: stonith-fence_ipmilan-525400fec0c8 start on controller-1 + * Resource action: stonith-fence_ipmilan-525400fec0c8 monitor=60000 on controller-1 + * Resource action: stonith-fence_ipmilan-5254002ff217 stop on controller-2 + * Resource action: stonith-fence_ipmilan-5254002ff217 start on controller-2 + * Resource action: stonith-fence_ipmilan-5254002ff217 monitor=60000 on controller-2 + * Resource action: stonith-fence_ipmilan-5254008f971a stop on controller-1 + * Resource action: stonith-fence_ipmilan-5254008f971a start on controller-1 + * Resource action: stonith-fence_ipmilan-5254008f971a monitor=60000 on controller-1 * Pseudo action: redis-bundle_start_0 * Pseudo action: galera-bundle_start_0 * Pseudo action: rabbitmq-bundle_start_0 diff --git a/cts/scheduler/on-fail-ignore.dot b/cts/scheduler/on-fail-ignore.dot index d8f1c9f..66d22cc 100644 --- a/cts/scheduler/on-fail-ignore.dot +++ b/cts/scheduler/on-fail-ignore.dot @@ -1,2 +1,12 @@ digraph "g" { +"fence_db1_monitor_60000 407892-db2" [ style=bold color="green" fontcolor="black"] +"fence_db1_start_0 407892-db2" -> "fence_db1_monitor_60000 407892-db2" [ style = bold] +"fence_db1_start_0 407892-db2" [ style=bold color="green" fontcolor="black"] +"fence_db1_stop_0 407892-db2" -> "fence_db1_start_0 407892-db2" [ style = bold] +"fence_db1_stop_0 407892-db2" [ style=bold color="green" fontcolor="black"] +"fence_db2_monitor_60000 407888-db1" [ style=bold color="green" fontcolor="black"] +"fence_db2_start_0 407888-db1" -> "fence_db2_monitor_60000 407888-db1" [ style = bold] +"fence_db2_start_0 407888-db1" [ style=bold color="green" fontcolor="black"] +"fence_db2_stop_0 407888-db1" -> "fence_db2_start_0 407888-db1" [ style = bold] +"fence_db2_stop_0 407888-db1" [ style=bold color="green" fontcolor="black"] } diff --git a/cts/scheduler/on-fail-ignore.exp b/cts/scheduler/on-fail-ignore.exp index 56e315f..fc3fb5b 100644 --- a/cts/scheduler/on-fail-ignore.exp +++ b/cts/scheduler/on-fail-ignore.exp @@ -1 +1,72 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cts/scheduler/on-fail-ignore.scores b/cts/scheduler/on-fail-ignore.scores index 64c9896..85040ba 100644 --- a/cts/scheduler/on-fail-ignore.scores +++ b/cts/scheduler/on-fail-ignore.scores @@ -1,8 +1,4 @@ Allocation scores: -Only 'private' parameters to fence_db1_monitor_60000 on 407892-db2 changed: 0:0;5:3:0:dcc10f17-10a1-4e5d-89af-ef7ff033520d -Only 'private' parameters to fence_db1_start_0 on 407892-db2 changed: 0:0;4:3:0:dcc10f17-10a1-4e5d-89af-ef7ff033520d -Only 'private' parameters to fence_db2_monitor_60000 on 407888-db1 changed: 0:0;8:4:0:dcc10f17-10a1-4e5d-89af-ef7ff033520d -Only 'private' parameters to fence_db2_start_0 on 407888-db1 changed: 0:0;7:4:0:dcc10f17-10a1-4e5d-89af-ef7ff033520d Using the original execution date of: 2017-10-26 14:23:50Z pcmk__native_allocate: fence_db1 allocation score on 407888-db1: 0 pcmk__native_allocate: fence_db1 allocation score on 407892-db2: 100 diff --git a/cts/scheduler/on-fail-ignore.summary b/cts/scheduler/on-fail-ignore.summary index 7605f37..fb4b0f3 100644 --- a/cts/scheduler/on-fail-ignore.summary +++ b/cts/scheduler/on-fail-ignore.summary @@ -7,13 +7,17 @@ Online: [ 407888-db1 407892-db2 ] fence_db2 (stonith:fence_ipmilan): Started 407888-db1 nfs_snet_ip (ocf::heartbeat:IPaddr2): Started 407888-db1 (failure ignored) -Only 'private' parameters to fence_db2_start_0 on 407888-db1 changed: 0:0;7:4:0:dcc10f17-10a1-4e5d-89af-ef7ff033520d -Only 'private' parameters to fence_db2_monitor_60000 on 407888-db1 changed: 0:0;8:4:0:dcc10f17-10a1-4e5d-89af-ef7ff033520d -Only 'private' parameters to fence_db1_start_0 on 407892-db2 changed: 0:0;4:3:0:dcc10f17-10a1-4e5d-89af-ef7ff033520d -Only 'private' parameters to fence_db1_monitor_60000 on 407892-db2 changed: 0:0;5:3:0:dcc10f17-10a1-4e5d-89af-ef7ff033520d Transition Summary: + * Restart fence_db1 ( 407892-db2 ) due to resource definition change + * Restart fence_db2 ( 407888-db1 ) due to resource definition change Executing cluster transition: + * Resource action: fence_db1 stop on 407892-db2 + * Resource action: fence_db1 start on 407892-db2 + * Resource action: fence_db1 monitor=60000 on 407892-db2 + * Resource action: fence_db2 stop on 407888-db1 + * Resource action: fence_db2 start on 407888-db1 + * Resource action: fence_db2 monitor=60000 on 407888-db1 Using the original execution date of: 2017-10-26 14:23:50Z Revised cluster status: diff --git a/cts/scheduler/remote-recover-all.dot b/cts/scheduler/remote-recover-all.dot index d513ce4..819e5eb 100644 --- a/cts/scheduler/remote-recover-all.dot +++ b/cts/scheduler/remote-recover-all.dot @@ -117,6 +117,8 @@ "stonith 'reboot' galera-2" -> "ip-172.17.4.11_start_0 controller-2" [ style = bold] "stonith 'reboot' galera-2" -> "stonith 'reboot' messaging-1" [ style = bold] "stonith 'reboot' galera-2" -> "stonith-fence_ipmilan-5254005bdbb5_start_0 controller-2" [ style = bold] +"stonith 'reboot' galera-2" -> "stonith-fence_ipmilan-525400b4f6bd_start_0 controller-0" [ style = bold] +"stonith 'reboot' galera-2" -> "stonith-fence_ipmilan-525400bbf613_start_0 controller-0" [ style = bold] "stonith 'reboot' galera-2" [ style=bold color="green" fontcolor="black"] "stonith 'reboot' messaging-1" -> "galera-0_start_0 controller-2" [ style = bold] "stonith 'reboot' messaging-1" -> "ip-172.17.1.14_start_0 controller-2" [ style = bold] @@ -126,10 +128,22 @@ "stonith 'reboot' messaging-1" -> "rabbitmq_post_notify_stonith_0" [ style = bold] "stonith 'reboot' messaging-1" -> "rabbitmq_stop_0 messaging-1" [ style = bold] "stonith 'reboot' messaging-1" -> "stonith-fence_ipmilan-5254005bdbb5_start_0 controller-2" [ style = bold] +"stonith 'reboot' messaging-1" -> "stonith-fence_ipmilan-525400b4f6bd_start_0 controller-0" [ style = bold] +"stonith 'reboot' messaging-1" -> "stonith-fence_ipmilan-525400bbf613_start_0 controller-0" [ style = bold] "stonith 'reboot' messaging-1" [ style=bold color="green" fontcolor="black"] "stonith-fence_ipmilan-5254005bdbb5_monitor_60000 controller-2" [ style=bold color="green" fontcolor="black"] "stonith-fence_ipmilan-5254005bdbb5_start_0 controller-2" -> "stonith-fence_ipmilan-5254005bdbb5_monitor_60000 controller-2" [ style = bold] "stonith-fence_ipmilan-5254005bdbb5_start_0 controller-2" [ style=bold color="green" fontcolor="black"] "stonith-fence_ipmilan-5254005bdbb5_stop_0 controller-1" -> "stonith-fence_ipmilan-5254005bdbb5_start_0 controller-2" [ style = bold] "stonith-fence_ipmilan-5254005bdbb5_stop_0 controller-1" [ style=bold color="green" fontcolor="orange"] +"stonith-fence_ipmilan-525400b4f6bd_monitor_60000 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400b4f6bd_start_0 controller-0" -> "stonith-fence_ipmilan-525400b4f6bd_monitor_60000 controller-0" [ style = bold] +"stonith-fence_ipmilan-525400b4f6bd_start_0 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400b4f6bd_stop_0 controller-0" -> "stonith-fence_ipmilan-525400b4f6bd_start_0 controller-0" [ style = bold] +"stonith-fence_ipmilan-525400b4f6bd_stop_0 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400bbf613_monitor_60000 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400bbf613_start_0 controller-0" -> "stonith-fence_ipmilan-525400bbf613_monitor_60000 controller-0" [ style = bold] +"stonith-fence_ipmilan-525400bbf613_start_0 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400bbf613_stop_0 controller-0" -> "stonith-fence_ipmilan-525400bbf613_start_0 controller-0" [ style = bold] +"stonith-fence_ipmilan-525400bbf613_stop_0 controller-0" [ style=bold color="green" fontcolor="black"] } diff --git a/cts/scheduler/remote-recover-all.exp b/cts/scheduler/remote-recover-all.exp index 7edc970..0cb51f6 100644 --- a/cts/scheduler/remote-recover-all.exp +++ b/cts/scheduler/remote-recover-all.exp @@ -1,7 +1,7 @@ - + @@ -9,27 +9,27 @@ - + - + - + - + @@ -41,7 +41,7 @@ - + @@ -49,7 +49,7 @@ - + @@ -113,13 +113,13 @@ - + - + @@ -128,22 +128,22 @@ - + - + - + - + @@ -155,16 +155,16 @@ - + - + - + @@ -173,13 +173,13 @@ - + - + @@ -195,28 +195,28 @@ - + - + - + - + - + @@ -224,28 +224,28 @@ - + - + - + - + - + @@ -284,7 +284,7 @@ - + @@ -293,7 +293,7 @@ - + @@ -306,7 +306,7 @@ - + @@ -319,7 +319,7 @@ - + @@ -335,7 +335,7 @@ - + @@ -348,7 +348,7 @@ - + @@ -357,13 +357,13 @@ - + - + @@ -375,28 +375,28 @@ - + - + - + - + - + @@ -408,7 +408,7 @@ - + @@ -416,22 +416,22 @@ - + - + - + - + @@ -440,26 +440,26 @@ - + - + - + - + @@ -469,7 +469,7 @@ - + @@ -481,7 +481,7 @@ - + @@ -490,26 +490,26 @@ - + - + - + - + @@ -519,7 +519,7 @@ - + @@ -531,7 +531,7 @@ - + @@ -540,26 +540,26 @@ - + - + - + - + @@ -569,7 +569,7 @@ - + @@ -581,7 +581,7 @@ - + @@ -590,13 +590,13 @@ - + - + @@ -605,28 +605,28 @@ - + - + - + - + - + @@ -638,6 +638,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -649,7 +731,7 @@ - + @@ -668,7 +750,7 @@ - + @@ -676,7 +758,7 @@ - + @@ -691,7 +773,7 @@ - + @@ -706,7 +788,7 @@ - + diff --git a/cts/scheduler/remote-recover-all.scores b/cts/scheduler/remote-recover-all.scores index 82f53ed..e411dfd 100644 --- a/cts/scheduler/remote-recover-all.scores +++ b/cts/scheduler/remote-recover-all.scores @@ -1,8 +1,4 @@ Allocation scores: -Only 'private' parameters to stonith-fence_ipmilan-525400b4f6bd_monitor_60000 on controller-0 changed: 0:0;132:18:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400b4f6bd_start_0 on controller-0 changed: 0:0;126:17:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400bbf613_monitor_60000 on controller-0 changed: 0:0;129:18:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400bbf613_start_0 on controller-0 changed: 0:0;124:17:0:e47e0f5b-bac4-432e-9993-f38bc43128ea Using the original execution date of: 2017-05-03 13:33:24Z galera:0 promotion score on galera-1: 100 galera:1 promotion score on none: 0 diff --git a/cts/scheduler/remote-recover-all.summary b/cts/scheduler/remote-recover-all.summary index 988114f..6b64e42 100644 --- a/cts/scheduler/remote-recover-all.summary +++ b/cts/scheduler/remote-recover-all.summary @@ -37,10 +37,6 @@ RemoteOnline: [ galera-0 galera-1 galera-2 messaging-0 messaging-1 messaging-2 ] stonith-fence_ipmilan-525400b4f6bd (stonith:fence_ipmilan): Started controller-0 stonith-fence_ipmilan-5254005bdbb5 (stonith:fence_ipmilan): Started controller-1 (UNCLEAN) -Only 'private' parameters to stonith-fence_ipmilan-525400bbf613_start_0 on controller-0 changed: 0:0;124:17:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400bbf613_monitor_60000 on controller-0 changed: 0:0;129:18:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400b4f6bd_start_0 on controller-0 changed: 0:0;126:17:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400b4f6bd_monitor_60000 on controller-0 changed: 0:0;132:18:0:e47e0f5b-bac4-432e-9993-f38bc43128ea Transition Summary: * Fence (reboot) messaging-1 'resources are active and the connection is unrecoverable' * Fence (reboot) galera-2 'resources are active and the connection is unrecoverable' @@ -55,6 +51,8 @@ Transition Summary: * Move ip-172.17.1.17 ( controller-1 -> controller-2 ) * Move ip-172.17.4.11 ( controller-1 -> controller-2 ) * Stop haproxy:0 ( controller-1 ) due to node availability + * Restart stonith-fence_ipmilan-525400bbf613 ( controller-0 ) due to resource definition change + * Restart stonith-fence_ipmilan-525400b4f6bd ( controller-0 ) due to resource definition change * Move stonith-fence_ipmilan-5254005bdbb5 ( controller-1 -> controller-2 ) Executing cluster transition: @@ -63,6 +61,8 @@ Executing cluster transition: * Pseudo action: galera-2_stop_0 * Pseudo action: galera-master_demote_0 * Pseudo action: redis-master_pre_notify_stop_0 + * Resource action: stonith-fence_ipmilan-525400bbf613 stop on controller-0 + * Resource action: stonith-fence_ipmilan-525400b4f6bd stop on controller-0 * Pseudo action: stonith-fence_ipmilan-5254005bdbb5_stop_0 * Fencing controller-1 (reboot) * Pseudo action: redis_post_notify_stop_0 @@ -90,6 +90,10 @@ Executing cluster transition: * Pseudo action: ip-172.17.1.14_stop_0 * Pseudo action: ip-172.17.1.17_stop_0 * Pseudo action: ip-172.17.4.11_stop_0 + * Resource action: stonith-fence_ipmilan-525400bbf613 start on controller-0 + * Resource action: stonith-fence_ipmilan-525400bbf613 monitor=60000 on controller-0 + * Resource action: stonith-fence_ipmilan-525400b4f6bd start on controller-0 + * Resource action: stonith-fence_ipmilan-525400b4f6bd monitor=60000 on controller-0 * Resource action: stonith-fence_ipmilan-5254005bdbb5 start on controller-2 * Resource action: galera-0 monitor=20000 on controller-2 * Resource action: rabbitmq notify on messaging-2 diff --git a/cts/scheduler/remote-recover-connection.dot b/cts/scheduler/remote-recover-connection.dot index 86192f3..33c4fd0 100644 --- a/cts/scheduler/remote-recover-connection.dot +++ b/cts/scheduler/remote-recover-connection.dot @@ -95,4 +95,14 @@ "stonith-fence_ipmilan-5254005bdbb5_start_0 controller-2" [ style=bold color="green" fontcolor="black"] "stonith-fence_ipmilan-5254005bdbb5_stop_0 controller-1" -> "stonith-fence_ipmilan-5254005bdbb5_start_0 controller-2" [ style = bold] "stonith-fence_ipmilan-5254005bdbb5_stop_0 controller-1" [ style=bold color="green" fontcolor="orange"] +"stonith-fence_ipmilan-525400b4f6bd_monitor_60000 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400b4f6bd_start_0 controller-0" -> "stonith-fence_ipmilan-525400b4f6bd_monitor_60000 controller-0" [ style = bold] +"stonith-fence_ipmilan-525400b4f6bd_start_0 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400b4f6bd_stop_0 controller-0" -> "stonith-fence_ipmilan-525400b4f6bd_start_0 controller-0" [ style = bold] +"stonith-fence_ipmilan-525400b4f6bd_stop_0 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400bbf613_monitor_60000 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400bbf613_start_0 controller-0" -> "stonith-fence_ipmilan-525400bbf613_monitor_60000 controller-0" [ style = bold] +"stonith-fence_ipmilan-525400bbf613_start_0 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400bbf613_stop_0 controller-0" -> "stonith-fence_ipmilan-525400bbf613_start_0 controller-0" [ style = bold] +"stonith-fence_ipmilan-525400bbf613_stop_0 controller-0" [ style=bold color="green" fontcolor="black"] } diff --git a/cts/scheduler/remote-recover-connection.exp b/cts/scheduler/remote-recover-connection.exp index cfcba98..d1d33c8 100644 --- a/cts/scheduler/remote-recover-connection.exp +++ b/cts/scheduler/remote-recover-connection.exp @@ -1,33 +1,33 @@ - + - + - + - + - + @@ -35,33 +35,33 @@ - + - + - + - + - + @@ -69,33 +69,33 @@ - + - + - + - + - + @@ -110,7 +110,7 @@ - + @@ -123,7 +123,7 @@ - + @@ -136,7 +136,7 @@ - + @@ -172,7 +172,7 @@ - + @@ -181,7 +181,7 @@ - + @@ -194,7 +194,7 @@ - + @@ -207,7 +207,7 @@ - + @@ -223,7 +223,7 @@ - + @@ -236,7 +236,7 @@ - + @@ -245,13 +245,13 @@ - + - + @@ -263,28 +263,28 @@ - + - + - + - + - + @@ -296,7 +296,7 @@ - + @@ -304,22 +304,22 @@ - + - + - + - + @@ -328,26 +328,26 @@ - + - + - + - + @@ -357,13 +357,13 @@ - + - + @@ -372,26 +372,26 @@ - + - + - + - + @@ -401,13 +401,13 @@ - + - + @@ -416,26 +416,26 @@ - + - + - + - + @@ -445,13 +445,13 @@ - + - + @@ -460,13 +460,13 @@ - + - + @@ -475,28 +475,28 @@ - + - + - + - + - + @@ -508,6 +508,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -519,7 +589,7 @@ - + @@ -532,7 +602,7 @@ - + @@ -540,7 +610,7 @@ - + diff --git a/cts/scheduler/remote-recover-connection.scores b/cts/scheduler/remote-recover-connection.scores index 391d7c8..328f1d3 100644 --- a/cts/scheduler/remote-recover-connection.scores +++ b/cts/scheduler/remote-recover-connection.scores @@ -1,8 +1,4 @@ Allocation scores: -Only 'private' parameters to stonith-fence_ipmilan-525400b4f6bd_monitor_60000 on controller-0 changed: 0:0;132:18:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400b4f6bd_start_0 on controller-0 changed: 0:0;126:17:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400bbf613_monitor_60000 on controller-0 changed: 0:0;129:18:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400bbf613_start_0 on controller-0 changed: 0:0;124:17:0:e47e0f5b-bac4-432e-9993-f38bc43128ea Using the original execution date of: 2017-05-03 13:33:24Z galera:0 promotion score on galera-1: 100 galera:1 promotion score on galera-2: 100 diff --git a/cts/scheduler/remote-recover-connection.summary b/cts/scheduler/remote-recover-connection.summary index f87c150..bacd5a9 100644 --- a/cts/scheduler/remote-recover-connection.summary +++ b/cts/scheduler/remote-recover-connection.summary @@ -37,10 +37,6 @@ RemoteOnline: [ galera-0 galera-1 galera-2 messaging-0 messaging-1 messaging-2 ] stonith-fence_ipmilan-525400b4f6bd (stonith:fence_ipmilan): Started controller-0 stonith-fence_ipmilan-5254005bdbb5 (stonith:fence_ipmilan): Started controller-1 (UNCLEAN) -Only 'private' parameters to stonith-fence_ipmilan-525400bbf613_start_0 on controller-0 changed: 0:0;124:17:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400bbf613_monitor_60000 on controller-0 changed: 0:0;129:18:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400b4f6bd_start_0 on controller-0 changed: 0:0;126:17:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400b4f6bd_monitor_60000 on controller-0 changed: 0:0;132:18:0:e47e0f5b-bac4-432e-9993-f38bc43128ea Transition Summary: * Fence (reboot) controller-1 'peer is no longer part of the cluster' * Move messaging-1 ( controller-1 -> controller-2 ) @@ -51,6 +47,8 @@ Transition Summary: * Move ip-172.17.1.17 ( controller-1 -> controller-2 ) * Move ip-172.17.4.11 ( controller-1 -> controller-2 ) * Stop haproxy:0 ( controller-1 ) due to node availability + * Restart stonith-fence_ipmilan-525400bbf613 ( controller-0 ) due to resource definition change + * Restart stonith-fence_ipmilan-525400b4f6bd ( controller-0 ) due to resource definition change * Move stonith-fence_ipmilan-5254005bdbb5 ( controller-1 -> controller-2 ) Executing cluster transition: @@ -58,6 +56,12 @@ Executing cluster transition: * Pseudo action: galera-0_stop_0 * Pseudo action: galera-2_stop_0 * Pseudo action: redis-master_pre_notify_stop_0 + * Resource action: stonith-fence_ipmilan-525400bbf613 stop on controller-0 + * Resource action: stonith-fence_ipmilan-525400bbf613 start on controller-0 + * Resource action: stonith-fence_ipmilan-525400bbf613 monitor=60000 on controller-0 + * Resource action: stonith-fence_ipmilan-525400b4f6bd stop on controller-0 + * Resource action: stonith-fence_ipmilan-525400b4f6bd start on controller-0 + * Resource action: stonith-fence_ipmilan-525400b4f6bd monitor=60000 on controller-0 * Pseudo action: stonith-fence_ipmilan-5254005bdbb5_stop_0 * Fencing controller-1 (reboot) * Resource action: messaging-1 start on controller-2 diff --git a/cts/scheduler/remote-recover-no-resources.dot b/cts/scheduler/remote-recover-no-resources.dot index bae902f..8db3fb6 100644 --- a/cts/scheduler/remote-recover-no-resources.dot +++ b/cts/scheduler/remote-recover-no-resources.dot @@ -102,10 +102,22 @@ "stonith 'reboot' messaging-1" -> "rabbitmq_post_notify_stonith_0" [ style = bold] "stonith 'reboot' messaging-1" -> "rabbitmq_stop_0 messaging-1" [ style = bold] "stonith 'reboot' messaging-1" -> "stonith-fence_ipmilan-5254005bdbb5_start_0 controller-2" [ style = bold] +"stonith 'reboot' messaging-1" -> "stonith-fence_ipmilan-525400b4f6bd_start_0 controller-0" [ style = bold] +"stonith 'reboot' messaging-1" -> "stonith-fence_ipmilan-525400bbf613_start_0 controller-0" [ style = bold] "stonith 'reboot' messaging-1" [ style=bold color="green" fontcolor="black"] "stonith-fence_ipmilan-5254005bdbb5_monitor_60000 controller-2" [ style=bold color="green" fontcolor="black"] "stonith-fence_ipmilan-5254005bdbb5_start_0 controller-2" -> "stonith-fence_ipmilan-5254005bdbb5_monitor_60000 controller-2" [ style = bold] "stonith-fence_ipmilan-5254005bdbb5_start_0 controller-2" [ style=bold color="green" fontcolor="black"] "stonith-fence_ipmilan-5254005bdbb5_stop_0 controller-1" -> "stonith-fence_ipmilan-5254005bdbb5_start_0 controller-2" [ style = bold] "stonith-fence_ipmilan-5254005bdbb5_stop_0 controller-1" [ style=bold color="green" fontcolor="orange"] +"stonith-fence_ipmilan-525400b4f6bd_monitor_60000 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400b4f6bd_start_0 controller-0" -> "stonith-fence_ipmilan-525400b4f6bd_monitor_60000 controller-0" [ style = bold] +"stonith-fence_ipmilan-525400b4f6bd_start_0 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400b4f6bd_stop_0 controller-0" -> "stonith-fence_ipmilan-525400b4f6bd_start_0 controller-0" [ style = bold] +"stonith-fence_ipmilan-525400b4f6bd_stop_0 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400bbf613_monitor_60000 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400bbf613_start_0 controller-0" -> "stonith-fence_ipmilan-525400bbf613_monitor_60000 controller-0" [ style = bold] +"stonith-fence_ipmilan-525400bbf613_start_0 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400bbf613_stop_0 controller-0" -> "stonith-fence_ipmilan-525400bbf613_start_0 controller-0" [ style = bold] +"stonith-fence_ipmilan-525400bbf613_stop_0 controller-0" [ style=bold color="green" fontcolor="black"] } diff --git a/cts/scheduler/remote-recover-no-resources.exp b/cts/scheduler/remote-recover-no-resources.exp index 394933f..90470fb 100644 --- a/cts/scheduler/remote-recover-no-resources.exp +++ b/cts/scheduler/remote-recover-no-resources.exp @@ -1,7 +1,7 @@ - + @@ -9,27 +9,27 @@ - + - + - + - + @@ -38,7 +38,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -110,13 +110,13 @@ - + - + @@ -125,22 +125,22 @@ - + - + - + - + @@ -159,7 +159,7 @@ - + @@ -195,7 +195,7 @@ - + @@ -204,7 +204,7 @@ - + @@ -217,7 +217,7 @@ - + @@ -230,7 +230,7 @@ - + @@ -246,7 +246,7 @@ - + @@ -259,7 +259,7 @@ - + @@ -268,13 +268,13 @@ - + - + @@ -286,28 +286,28 @@ - + - + - + - + - + @@ -319,7 +319,7 @@ - + @@ -327,22 +327,22 @@ - + - + - + - + @@ -351,26 +351,26 @@ - + - + - + - + @@ -380,7 +380,7 @@ - + @@ -389,7 +389,7 @@ - + @@ -398,26 +398,26 @@ - + - + - + - + @@ -427,7 +427,7 @@ - + @@ -436,7 +436,7 @@ - + @@ -445,26 +445,26 @@ - + - + - + - + @@ -474,7 +474,7 @@ - + @@ -483,7 +483,7 @@ - + @@ -492,13 +492,13 @@ - + - + @@ -507,28 +507,28 @@ - + - + - + - + - + @@ -540,6 +540,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -551,7 +627,7 @@ - + @@ -567,7 +643,7 @@ - + @@ -575,7 +651,7 @@ - + @@ -590,7 +666,7 @@ - + diff --git a/cts/scheduler/remote-recover-no-resources.scores b/cts/scheduler/remote-recover-no-resources.scores index cd4444c..378974e 100644 --- a/cts/scheduler/remote-recover-no-resources.scores +++ b/cts/scheduler/remote-recover-no-resources.scores @@ -1,8 +1,4 @@ Allocation scores: -Only 'private' parameters to stonith-fence_ipmilan-525400b4f6bd_monitor_60000 on controller-0 changed: 0:0;132:18:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400b4f6bd_start_0 on controller-0 changed: 0:0;126:17:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400bbf613_monitor_60000 on controller-0 changed: 0:0;129:18:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400bbf613_start_0 on controller-0 changed: 0:0;124:17:0:e47e0f5b-bac4-432e-9993-f38bc43128ea Using the original execution date of: 2017-05-03 13:33:24Z galera:0 promotion score on galera-1: 100 galera:1 promotion score on galera-0: 100 diff --git a/cts/scheduler/remote-recover-no-resources.summary b/cts/scheduler/remote-recover-no-resources.summary index 16ac8ac..7f2a90c 100644 --- a/cts/scheduler/remote-recover-no-resources.summary +++ b/cts/scheduler/remote-recover-no-resources.summary @@ -37,10 +37,6 @@ RemoteOnline: [ galera-0 galera-1 galera-2 messaging-0 messaging-1 messaging-2 ] stonith-fence_ipmilan-525400b4f6bd (stonith:fence_ipmilan): Started controller-0 stonith-fence_ipmilan-5254005bdbb5 (stonith:fence_ipmilan): Started controller-1 (UNCLEAN) -Only 'private' parameters to stonith-fence_ipmilan-525400bbf613_start_0 on controller-0 changed: 0:0;124:17:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400bbf613_monitor_60000 on controller-0 changed: 0:0;129:18:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400b4f6bd_start_0 on controller-0 changed: 0:0;126:17:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400b4f6bd_monitor_60000 on controller-0 changed: 0:0;132:18:0:e47e0f5b-bac4-432e-9993-f38bc43128ea Transition Summary: * Fence (reboot) messaging-1 'resources are active and the connection is unrecoverable' * Fence (reboot) controller-1 'peer is no longer part of the cluster' @@ -53,6 +49,8 @@ Transition Summary: * Move ip-172.17.1.17 ( controller-1 -> controller-2 ) * Move ip-172.17.4.11 ( controller-1 -> controller-2 ) * Stop haproxy:0 ( controller-1 ) due to node availability + * Restart stonith-fence_ipmilan-525400bbf613 ( controller-0 ) due to resource definition change + * Restart stonith-fence_ipmilan-525400b4f6bd ( controller-0 ) due to resource definition change * Move stonith-fence_ipmilan-5254005bdbb5 ( controller-1 -> controller-2 ) Executing cluster transition: @@ -60,6 +58,8 @@ Executing cluster transition: * Pseudo action: galera-0_stop_0 * Pseudo action: galera-2_stop_0 * Pseudo action: redis-master_pre_notify_stop_0 + * Resource action: stonith-fence_ipmilan-525400bbf613 stop on controller-0 + * Resource action: stonith-fence_ipmilan-525400b4f6bd stop on controller-0 * Pseudo action: stonith-fence_ipmilan-5254005bdbb5_stop_0 * Fencing controller-1 (reboot) * Pseudo action: redis_post_notify_stop_0 @@ -77,6 +77,10 @@ Executing cluster transition: * Pseudo action: redis-master_stopped_0 * Pseudo action: haproxy_stop_0 * Pseudo action: haproxy-clone_stopped_0 + * Resource action: stonith-fence_ipmilan-525400bbf613 start on controller-0 + * Resource action: stonith-fence_ipmilan-525400bbf613 monitor=60000 on controller-0 + * Resource action: stonith-fence_ipmilan-525400b4f6bd start on controller-0 + * Resource action: stonith-fence_ipmilan-525400b4f6bd monitor=60000 on controller-0 * Resource action: stonith-fence_ipmilan-5254005bdbb5 start on controller-2 * Resource action: galera-0 monitor=20000 on controller-2 * Resource action: rabbitmq notify on messaging-2 diff --git a/cts/scheduler/remote-recover-unknown.dot b/cts/scheduler/remote-recover-unknown.dot index eea6eea..902e0b5 100644 --- a/cts/scheduler/remote-recover-unknown.dot +++ b/cts/scheduler/remote-recover-unknown.dot @@ -101,6 +101,8 @@ "stonith 'reboot' galera-2" -> "ip-172.17.4.11_start_0 controller-2" [ style = bold] "stonith 'reboot' galera-2" -> "stonith 'reboot' messaging-1" [ style = bold] "stonith 'reboot' galera-2" -> "stonith-fence_ipmilan-5254005bdbb5_start_0 controller-2" [ style = bold] +"stonith 'reboot' galera-2" -> "stonith-fence_ipmilan-525400b4f6bd_start_0 controller-0" [ style = bold] +"stonith 'reboot' galera-2" -> "stonith-fence_ipmilan-525400bbf613_start_0 controller-0" [ style = bold] "stonith 'reboot' galera-2" [ style=bold color="green" fontcolor="black"] "stonith 'reboot' messaging-1" -> "galera-0_start_0 controller-2" [ style = bold] "stonith 'reboot' messaging-1" -> "ip-172.17.1.14_start_0 controller-2" [ style = bold] @@ -110,10 +112,22 @@ "stonith 'reboot' messaging-1" -> "rabbitmq_post_notify_stonith_0" [ style = bold] "stonith 'reboot' messaging-1" -> "rabbitmq_stop_0 messaging-1" [ style = bold] "stonith 'reboot' messaging-1" -> "stonith-fence_ipmilan-5254005bdbb5_start_0 controller-2" [ style = bold] +"stonith 'reboot' messaging-1" -> "stonith-fence_ipmilan-525400b4f6bd_start_0 controller-0" [ style = bold] +"stonith 'reboot' messaging-1" -> "stonith-fence_ipmilan-525400bbf613_start_0 controller-0" [ style = bold] "stonith 'reboot' messaging-1" [ style=bold color="green" fontcolor="black"] "stonith-fence_ipmilan-5254005bdbb5_monitor_60000 controller-2" [ style=bold color="green" fontcolor="black"] "stonith-fence_ipmilan-5254005bdbb5_start_0 controller-2" -> "stonith-fence_ipmilan-5254005bdbb5_monitor_60000 controller-2" [ style = bold] "stonith-fence_ipmilan-5254005bdbb5_start_0 controller-2" [ style=bold color="green" fontcolor="black"] "stonith-fence_ipmilan-5254005bdbb5_stop_0 controller-1" -> "stonith-fence_ipmilan-5254005bdbb5_start_0 controller-2" [ style = bold] "stonith-fence_ipmilan-5254005bdbb5_stop_0 controller-1" [ style=bold color="green" fontcolor="orange"] +"stonith-fence_ipmilan-525400b4f6bd_monitor_60000 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400b4f6bd_start_0 controller-0" -> "stonith-fence_ipmilan-525400b4f6bd_monitor_60000 controller-0" [ style = bold] +"stonith-fence_ipmilan-525400b4f6bd_start_0 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400b4f6bd_stop_0 controller-0" -> "stonith-fence_ipmilan-525400b4f6bd_start_0 controller-0" [ style = bold] +"stonith-fence_ipmilan-525400b4f6bd_stop_0 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400bbf613_monitor_60000 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400bbf613_start_0 controller-0" -> "stonith-fence_ipmilan-525400bbf613_monitor_60000 controller-0" [ style = bold] +"stonith-fence_ipmilan-525400bbf613_start_0 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400bbf613_stop_0 controller-0" -> "stonith-fence_ipmilan-525400bbf613_start_0 controller-0" [ style = bold] +"stonith-fence_ipmilan-525400bbf613_stop_0 controller-0" [ style=bold color="green" fontcolor="black"] } diff --git a/cts/scheduler/remote-recover-unknown.exp b/cts/scheduler/remote-recover-unknown.exp index 1d14684..82cb65f 100644 --- a/cts/scheduler/remote-recover-unknown.exp +++ b/cts/scheduler/remote-recover-unknown.exp @@ -1,7 +1,7 @@ - + @@ -9,27 +9,27 @@ - + - + - + - + @@ -41,7 +41,7 @@ - + @@ -49,7 +49,7 @@ - + @@ -113,13 +113,13 @@ - + - + @@ -128,22 +128,22 @@ - + - + - + - + @@ -162,7 +162,7 @@ - + @@ -198,7 +198,7 @@ - + @@ -207,7 +207,7 @@ - + @@ -220,7 +220,7 @@ - + @@ -233,7 +233,7 @@ - + @@ -249,7 +249,7 @@ - + @@ -262,7 +262,7 @@ - + @@ -271,13 +271,13 @@ - + - + @@ -289,28 +289,28 @@ - + - + - + - + - + @@ -322,7 +322,7 @@ - + @@ -330,22 +330,22 @@ - + - + - + - + @@ -354,26 +354,26 @@ - + - + - + - + @@ -383,7 +383,7 @@ - + @@ -395,7 +395,7 @@ - + @@ -404,26 +404,26 @@ - + - + - + - + @@ -433,7 +433,7 @@ - + @@ -445,7 +445,7 @@ - + @@ -454,26 +454,26 @@ - + - + - + - + @@ -483,7 +483,7 @@ - + @@ -495,7 +495,7 @@ - + @@ -504,13 +504,13 @@ - + - + @@ -519,28 +519,28 @@ - + - + - + - + - + @@ -552,6 +552,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -563,7 +645,7 @@ - + @@ -582,7 +664,7 @@ - + @@ -590,7 +672,7 @@ - + @@ -605,7 +687,7 @@ - + @@ -620,7 +702,7 @@ - + diff --git a/cts/scheduler/remote-recover-unknown.scores b/cts/scheduler/remote-recover-unknown.scores index cd4444c..378974e 100644 --- a/cts/scheduler/remote-recover-unknown.scores +++ b/cts/scheduler/remote-recover-unknown.scores @@ -1,8 +1,4 @@ Allocation scores: -Only 'private' parameters to stonith-fence_ipmilan-525400b4f6bd_monitor_60000 on controller-0 changed: 0:0;132:18:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400b4f6bd_start_0 on controller-0 changed: 0:0;126:17:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400bbf613_monitor_60000 on controller-0 changed: 0:0;129:18:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400bbf613_start_0 on controller-0 changed: 0:0;124:17:0:e47e0f5b-bac4-432e-9993-f38bc43128ea Using the original execution date of: 2017-05-03 13:33:24Z galera:0 promotion score on galera-1: 100 galera:1 promotion score on galera-0: 100 diff --git a/cts/scheduler/remote-recover-unknown.summary b/cts/scheduler/remote-recover-unknown.summary index af5f724..330c4cb 100644 --- a/cts/scheduler/remote-recover-unknown.summary +++ b/cts/scheduler/remote-recover-unknown.summary @@ -37,10 +37,6 @@ RemoteOnline: [ galera-0 galera-1 galera-2 messaging-0 messaging-1 messaging-2 ] stonith-fence_ipmilan-525400b4f6bd (stonith:fence_ipmilan): Started controller-0 stonith-fence_ipmilan-5254005bdbb5 (stonith:fence_ipmilan): Started controller-1 (UNCLEAN) -Only 'private' parameters to stonith-fence_ipmilan-525400bbf613_start_0 on controller-0 changed: 0:0;124:17:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400bbf613_monitor_60000 on controller-0 changed: 0:0;129:18:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400b4f6bd_start_0 on controller-0 changed: 0:0;126:17:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400b4f6bd_monitor_60000 on controller-0 changed: 0:0;132:18:0:e47e0f5b-bac4-432e-9993-f38bc43128ea Transition Summary: * Fence (reboot) galera-2 'resources are in an unknown state and the connection is unrecoverable' * Fence (reboot) messaging-1 'resources are active and the connection is unrecoverable' @@ -54,6 +50,8 @@ Transition Summary: * Move ip-172.17.1.17 ( controller-1 -> controller-2 ) * Move ip-172.17.4.11 ( controller-1 -> controller-2 ) * Stop haproxy:0 ( controller-1 ) due to node availability + * Restart stonith-fence_ipmilan-525400bbf613 ( controller-0 ) due to resource definition change + * Restart stonith-fence_ipmilan-525400b4f6bd ( controller-0 ) due to resource definition change * Move stonith-fence_ipmilan-5254005bdbb5 ( controller-1 -> controller-2 ) Executing cluster transition: @@ -61,6 +59,8 @@ Executing cluster transition: * Pseudo action: galera-0_stop_0 * Pseudo action: galera-2_stop_0 * Pseudo action: redis-master_pre_notify_stop_0 + * Resource action: stonith-fence_ipmilan-525400bbf613 stop on controller-0 + * Resource action: stonith-fence_ipmilan-525400b4f6bd stop on controller-0 * Pseudo action: stonith-fence_ipmilan-5254005bdbb5_stop_0 * Fencing controller-1 (reboot) * Pseudo action: redis_post_notify_stop_0 @@ -79,6 +79,10 @@ Executing cluster transition: * Pseudo action: redis-master_stopped_0 * Pseudo action: haproxy_stop_0 * Pseudo action: haproxy-clone_stopped_0 + * Resource action: stonith-fence_ipmilan-525400bbf613 start on controller-0 + * Resource action: stonith-fence_ipmilan-525400bbf613 monitor=60000 on controller-0 + * Resource action: stonith-fence_ipmilan-525400b4f6bd start on controller-0 + * Resource action: stonith-fence_ipmilan-525400b4f6bd monitor=60000 on controller-0 * Resource action: stonith-fence_ipmilan-5254005bdbb5 start on controller-2 * Resource action: galera-0 monitor=20000 on controller-2 * Resource action: rabbitmq notify on messaging-2 diff --git a/cts/scheduler/remote-recovery.dot b/cts/scheduler/remote-recovery.dot index 86192f3..33c4fd0 100644 --- a/cts/scheduler/remote-recovery.dot +++ b/cts/scheduler/remote-recovery.dot @@ -95,4 +95,14 @@ "stonith-fence_ipmilan-5254005bdbb5_start_0 controller-2" [ style=bold color="green" fontcolor="black"] "stonith-fence_ipmilan-5254005bdbb5_stop_0 controller-1" -> "stonith-fence_ipmilan-5254005bdbb5_start_0 controller-2" [ style = bold] "stonith-fence_ipmilan-5254005bdbb5_stop_0 controller-1" [ style=bold color="green" fontcolor="orange"] +"stonith-fence_ipmilan-525400b4f6bd_monitor_60000 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400b4f6bd_start_0 controller-0" -> "stonith-fence_ipmilan-525400b4f6bd_monitor_60000 controller-0" [ style = bold] +"stonith-fence_ipmilan-525400b4f6bd_start_0 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400b4f6bd_stop_0 controller-0" -> "stonith-fence_ipmilan-525400b4f6bd_start_0 controller-0" [ style = bold] +"stonith-fence_ipmilan-525400b4f6bd_stop_0 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400bbf613_monitor_60000 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400bbf613_start_0 controller-0" -> "stonith-fence_ipmilan-525400bbf613_monitor_60000 controller-0" [ style = bold] +"stonith-fence_ipmilan-525400bbf613_start_0 controller-0" [ style=bold color="green" fontcolor="black"] +"stonith-fence_ipmilan-525400bbf613_stop_0 controller-0" -> "stonith-fence_ipmilan-525400bbf613_start_0 controller-0" [ style = bold] +"stonith-fence_ipmilan-525400bbf613_stop_0 controller-0" [ style=bold color="green" fontcolor="black"] } diff --git a/cts/scheduler/remote-recovery.exp b/cts/scheduler/remote-recovery.exp index cfcba98..d1d33c8 100644 --- a/cts/scheduler/remote-recovery.exp +++ b/cts/scheduler/remote-recovery.exp @@ -1,33 +1,33 @@ - + - + - + - + - + @@ -35,33 +35,33 @@ - + - + - + - + - + @@ -69,33 +69,33 @@ - + - + - + - + - + @@ -110,7 +110,7 @@ - + @@ -123,7 +123,7 @@ - + @@ -136,7 +136,7 @@ - + @@ -172,7 +172,7 @@ - + @@ -181,7 +181,7 @@ - + @@ -194,7 +194,7 @@ - + @@ -207,7 +207,7 @@ - + @@ -223,7 +223,7 @@ - + @@ -236,7 +236,7 @@ - + @@ -245,13 +245,13 @@ - + - + @@ -263,28 +263,28 @@ - + - + - + - + - + @@ -296,7 +296,7 @@ - + @@ -304,22 +304,22 @@ - + - + - + - + @@ -328,26 +328,26 @@ - + - + - + - + @@ -357,13 +357,13 @@ - + - + @@ -372,26 +372,26 @@ - + - + - + - + @@ -401,13 +401,13 @@ - + - + @@ -416,26 +416,26 @@ - + - + - + - + @@ -445,13 +445,13 @@ - + - + @@ -460,13 +460,13 @@ - + - + @@ -475,28 +475,28 @@ - + - + - + - + - + @@ -508,6 +508,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -519,7 +589,7 @@ - + @@ -532,7 +602,7 @@ - + @@ -540,7 +610,7 @@ - + diff --git a/cts/scheduler/remote-recovery.scores b/cts/scheduler/remote-recovery.scores index 391d7c8..328f1d3 100644 --- a/cts/scheduler/remote-recovery.scores +++ b/cts/scheduler/remote-recovery.scores @@ -1,8 +1,4 @@ Allocation scores: -Only 'private' parameters to stonith-fence_ipmilan-525400b4f6bd_monitor_60000 on controller-0 changed: 0:0;132:18:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400b4f6bd_start_0 on controller-0 changed: 0:0;126:17:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400bbf613_monitor_60000 on controller-0 changed: 0:0;129:18:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400bbf613_start_0 on controller-0 changed: 0:0;124:17:0:e47e0f5b-bac4-432e-9993-f38bc43128ea Using the original execution date of: 2017-05-03 13:33:24Z galera:0 promotion score on galera-1: 100 galera:1 promotion score on galera-2: 100 diff --git a/cts/scheduler/remote-recovery.summary b/cts/scheduler/remote-recovery.summary index f87c150..bacd5a9 100644 --- a/cts/scheduler/remote-recovery.summary +++ b/cts/scheduler/remote-recovery.summary @@ -37,10 +37,6 @@ RemoteOnline: [ galera-0 galera-1 galera-2 messaging-0 messaging-1 messaging-2 ] stonith-fence_ipmilan-525400b4f6bd (stonith:fence_ipmilan): Started controller-0 stonith-fence_ipmilan-5254005bdbb5 (stonith:fence_ipmilan): Started controller-1 (UNCLEAN) -Only 'private' parameters to stonith-fence_ipmilan-525400bbf613_start_0 on controller-0 changed: 0:0;124:17:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400bbf613_monitor_60000 on controller-0 changed: 0:0;129:18:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400b4f6bd_start_0 on controller-0 changed: 0:0;126:17:0:e47e0f5b-bac4-432e-9993-f38bc43128ea -Only 'private' parameters to stonith-fence_ipmilan-525400b4f6bd_monitor_60000 on controller-0 changed: 0:0;132:18:0:e47e0f5b-bac4-432e-9993-f38bc43128ea Transition Summary: * Fence (reboot) controller-1 'peer is no longer part of the cluster' * Move messaging-1 ( controller-1 -> controller-2 ) @@ -51,6 +47,8 @@ Transition Summary: * Move ip-172.17.1.17 ( controller-1 -> controller-2 ) * Move ip-172.17.4.11 ( controller-1 -> controller-2 ) * Stop haproxy:0 ( controller-1 ) due to node availability + * Restart stonith-fence_ipmilan-525400bbf613 ( controller-0 ) due to resource definition change + * Restart stonith-fence_ipmilan-525400b4f6bd ( controller-0 ) due to resource definition change * Move stonith-fence_ipmilan-5254005bdbb5 ( controller-1 -> controller-2 ) Executing cluster transition: @@ -58,6 +56,12 @@ Executing cluster transition: * Pseudo action: galera-0_stop_0 * Pseudo action: galera-2_stop_0 * Pseudo action: redis-master_pre_notify_stop_0 + * Resource action: stonith-fence_ipmilan-525400bbf613 stop on controller-0 + * Resource action: stonith-fence_ipmilan-525400bbf613 start on controller-0 + * Resource action: stonith-fence_ipmilan-525400bbf613 monitor=60000 on controller-0 + * Resource action: stonith-fence_ipmilan-525400b4f6bd stop on controller-0 + * Resource action: stonith-fence_ipmilan-525400b4f6bd start on controller-0 + * Resource action: stonith-fence_ipmilan-525400b4f6bd monitor=60000 on controller-0 * Pseudo action: stonith-fence_ipmilan-5254005bdbb5_stop_0 * Fencing controller-1 (reboot) * Resource action: messaging-1 start on controller-2 diff --git a/cts/scheduler/value-source.dot b/cts/scheduler/value-source.dot deleted file mode 100644 index dfb61e9..0000000 --- a/cts/scheduler/value-source.dot +++ /dev/null @@ -1,29 +0,0 @@ - digraph "g" { -"Fencing_monitor_120000 rhel7-1" [ style=bold color="green" fontcolor="black"] -"Fencing_start_0 rhel7-1" -> "Fencing_monitor_120000 rhel7-1" [ style = bold] -"Fencing_start_0 rhel7-1" [ style=bold color="green" fontcolor="black"] -"insane-rsc_monitor_10000 rhel7-4" [ style=bold color="green" fontcolor="black"] -"insane-rsc_start_0 rhel7-4" -> "insane-rsc_monitor_10000 rhel7-4" [ style = bold] -"insane-rsc_start_0 rhel7-4" [ style=bold color="green" fontcolor="black"] -"invert-match_monitor_10000 rhel7-1" [ style=bold color="green" fontcolor="black"] -"invert-match_start_0 rhel7-1" -> "invert-match_monitor_10000 rhel7-1" [ style = bold] -"invert-match_start_0 rhel7-1" [ style=bold color="green" fontcolor="black"] -"meta-rsc_monitor_10000 rhel7-5" [ style=bold color="green" fontcolor="black"] -"meta-rsc_start_0 rhel7-5" -> "meta-rsc_monitor_10000 rhel7-5" [ style = bold] -"meta-rsc_start_0 rhel7-5" [ style=bold color="green" fontcolor="black"] -"rsc1_monitor_10000 rhel7-4" [ style=bold color="green" fontcolor="black"] -"rsc1_start_0 rhel7-4" -> "rsc1_monitor_10000 rhel7-4" [ style = bold] -"rsc1_start_0 rhel7-4" [ style=bold color="green" fontcolor="black"] -"rsc2_monitor_10000 rhel7-5" [ style=bold color="green" fontcolor="black"] -"rsc2_start_0 rhel7-5" -> "rsc2_monitor_10000 rhel7-5" [ style = bold] -"rsc2_start_0 rhel7-5" [ style=bold color="green" fontcolor="black"] -"set-rsc1_monitor_10000 rhel7-3" [ style=bold color="green" fontcolor="black"] -"set-rsc1_start_0 rhel7-3" -> "set-rsc1_monitor_10000 rhel7-3" [ style = bold] -"set-rsc1_start_0 rhel7-3" [ style=bold color="green" fontcolor="black"] -"set-rsc2_monitor_10000 rhel7-4" [ style=bold color="green" fontcolor="black"] -"set-rsc2_start_0 rhel7-4" -> "set-rsc2_monitor_10000 rhel7-4" [ style = bold] -"set-rsc2_start_0 rhel7-4" [ style=bold color="green" fontcolor="black"] -"single-rsc_monitor_10000 rhel7-2" [ style=bold color="green" fontcolor="black"] -"single-rsc_start_0 rhel7-2" -> "single-rsc_monitor_10000 rhel7-2" [ style = bold] -"single-rsc_start_0 rhel7-2" [ style=bold color="green" fontcolor="black"] -} diff --git a/cts/scheduler/value-source.exp b/cts/scheduler/value-source.exp deleted file mode 100644 index 4bf469f..0000000 --- a/cts/scheduler/value-source.exp +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cts/scheduler/value-source.scores b/cts/scheduler/value-source.scores deleted file mode 100644 index 1f781c4..0000000 --- a/cts/scheduler/value-source.scores +++ /dev/null @@ -1,47 +0,0 @@ -Allocation scores: -Using the original execution date of: 2020-11-12 21:28:08Z -pcmk__native_allocate: Fencing allocation score on rhel7-1: 0 -pcmk__native_allocate: Fencing allocation score on rhel7-2: 0 -pcmk__native_allocate: Fencing allocation score on rhel7-3: 0 -pcmk__native_allocate: Fencing allocation score on rhel7-4: 0 -pcmk__native_allocate: Fencing allocation score on rhel7-5: 0 -pcmk__native_allocate: insane-rsc allocation score on rhel7-1: 0 -pcmk__native_allocate: insane-rsc allocation score on rhel7-2: 0 -pcmk__native_allocate: insane-rsc allocation score on rhel7-3: 0 -pcmk__native_allocate: insane-rsc allocation score on rhel7-4: INFINITY -pcmk__native_allocate: insane-rsc allocation score on rhel7-5: 0 -pcmk__native_allocate: invert-match allocation score on rhel7-1: INFINITY -pcmk__native_allocate: invert-match allocation score on rhel7-2: 0 -pcmk__native_allocate: invert-match allocation score on rhel7-3: 0 -pcmk__native_allocate: invert-match allocation score on rhel7-4: 0 -pcmk__native_allocate: invert-match allocation score on rhel7-5: 0 -pcmk__native_allocate: meta-rsc allocation score on rhel7-1: 0 -pcmk__native_allocate: meta-rsc allocation score on rhel7-2: 0 -pcmk__native_allocate: meta-rsc allocation score on rhel7-3: 0 -pcmk__native_allocate: meta-rsc allocation score on rhel7-4: INFINITY -pcmk__native_allocate: meta-rsc allocation score on rhel7-5: INFINITY -pcmk__native_allocate: rsc1 allocation score on rhel7-1: 0 -pcmk__native_allocate: rsc1 allocation score on rhel7-2: 0 -pcmk__native_allocate: rsc1 allocation score on rhel7-3: 0 -pcmk__native_allocate: rsc1 allocation score on rhel7-4: INFINITY -pcmk__native_allocate: rsc1 allocation score on rhel7-5: INFINITY -pcmk__native_allocate: rsc2 allocation score on rhel7-1: 0 -pcmk__native_allocate: rsc2 allocation score on rhel7-2: 0 -pcmk__native_allocate: rsc2 allocation score on rhel7-3: 0 -pcmk__native_allocate: rsc2 allocation score on rhel7-4: 0 -pcmk__native_allocate: rsc2 allocation score on rhel7-5: INFINITY -pcmk__native_allocate: set-rsc1 allocation score on rhel7-1: 0 -pcmk__native_allocate: set-rsc1 allocation score on rhel7-2: 0 -pcmk__native_allocate: set-rsc1 allocation score on rhel7-3: INFINITY -pcmk__native_allocate: set-rsc1 allocation score on rhel7-4: 0 -pcmk__native_allocate: set-rsc1 allocation score on rhel7-5: 0 -pcmk__native_allocate: set-rsc2 allocation score on rhel7-1: 0 -pcmk__native_allocate: set-rsc2 allocation score on rhel7-2: 0 -pcmk__native_allocate: set-rsc2 allocation score on rhel7-3: 0 -pcmk__native_allocate: set-rsc2 allocation score on rhel7-4: INFINITY -pcmk__native_allocate: set-rsc2 allocation score on rhel7-5: 0 -pcmk__native_allocate: single-rsc allocation score on rhel7-1: 0 -pcmk__native_allocate: single-rsc allocation score on rhel7-2: INFINITY -pcmk__native_allocate: single-rsc allocation score on rhel7-3: 0 -pcmk__native_allocate: single-rsc allocation score on rhel7-4: 0 -pcmk__native_allocate: single-rsc allocation score on rhel7-5: 0 diff --git a/cts/scheduler/value-source.summary b/cts/scheduler/value-source.summary deleted file mode 100644 index a9b0392..0000000 --- a/cts/scheduler/value-source.summary +++ /dev/null @@ -1,60 +0,0 @@ -Using the original execution date of: 2020-11-12 21:28:08Z - -Current cluster status: -Online: [ rhel7-1 rhel7-2 rhel7-3 rhel7-4 rhel7-5 ] - - Fencing (stonith:fence_xvm): Stopped - rsc1 (ocf::pacemaker:Dummy): Stopped - rsc2 (ocf::pacemaker:Dummy): Stopped - invert-match (ocf::pacemaker:Dummy): Stopped - single-rsc (ocf::pacemaker:Dummy): Stopped - set-rsc1 (ocf::pacemaker:Dummy): Stopped - set-rsc2 (ocf::pacemaker:Dummy): Stopped - meta-rsc (ocf::pacemaker:Dummy): Stopped - insane-rsc (ocf::pacemaker:Dummy): Stopped - -Transition Summary: - * Start Fencing ( rhel7-1 ) - * Start rsc1 ( rhel7-4 ) - * Start rsc2 ( rhel7-5 ) - * Start invert-match ( rhel7-1 ) - * Start single-rsc ( rhel7-2 ) - * Start set-rsc1 ( rhel7-3 ) - * Start set-rsc2 ( rhel7-4 ) - * Start meta-rsc ( rhel7-5 ) - * Start insane-rsc ( rhel7-4 ) - -Executing cluster transition: - * Resource action: Fencing start on rhel7-1 - * Resource action: rsc1 start on rhel7-4 - * Resource action: rsc2 start on rhel7-5 - * Resource action: invert-match start on rhel7-1 - * Resource action: single-rsc start on rhel7-2 - * Resource action: set-rsc1 start on rhel7-3 - * Resource action: set-rsc2 start on rhel7-4 - * Resource action: meta-rsc start on rhel7-5 - * Resource action: insane-rsc start on rhel7-4 - * Resource action: Fencing monitor=120000 on rhel7-1 - * Resource action: rsc1 monitor=10000 on rhel7-4 - * Resource action: rsc2 monitor=10000 on rhel7-5 - * Resource action: invert-match monitor=10000 on rhel7-1 - * Resource action: single-rsc monitor=10000 on rhel7-2 - * Resource action: set-rsc1 monitor=10000 on rhel7-3 - * Resource action: set-rsc2 monitor=10000 on rhel7-4 - * Resource action: meta-rsc monitor=10000 on rhel7-5 - * Resource action: insane-rsc monitor=10000 on rhel7-4 -Using the original execution date of: 2020-11-12 21:28:08Z - -Revised cluster status: -Online: [ rhel7-1 rhel7-2 rhel7-3 rhel7-4 rhel7-5 ] - - Fencing (stonith:fence_xvm): Started rhel7-1 - rsc1 (ocf::pacemaker:Dummy): Started rhel7-4 - rsc2 (ocf::pacemaker:Dummy): Started rhel7-5 - invert-match (ocf::pacemaker:Dummy): Started rhel7-1 - single-rsc (ocf::pacemaker:Dummy): Started rhel7-2 - set-rsc1 (ocf::pacemaker:Dummy): Started rhel7-3 - set-rsc2 (ocf::pacemaker:Dummy): Started rhel7-4 - meta-rsc (ocf::pacemaker:Dummy): Started rhel7-5 - insane-rsc (ocf::pacemaker:Dummy): Started rhel7-4 - diff --git a/cts/scheduler/value-source.xml b/cts/scheduler/value-source.xml deleted file mode 100644 index 95e7d57..0000000 --- a/cts/scheduler/value-source.xml +++ /dev/null @@ -1,463 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/daemons/controld/controld_execd.c b/daemons/controld/controld_execd.c index 0122e2b..f4dc414 100644 --- a/daemons/controld/controld_execd.c +++ b/daemons/controld/controld_execd.c @@ -498,10 +498,39 @@ build_parameter_list(const lrmd_event_data_t *op, { char *list = NULL; size_t len = 0; + size_t max = 0; + + /* Newer resource agents support the "private" parameter attribute to + * indicate sensitive parameters. For backward compatibility with older + * agents, this list is used if the agent doesn't specify any as "private". + */ + const char *secure_terms[] = { + "password", + "passwd", + "user", + }; + + if (!pcmk_is_set(metadata->ra_flags, ra_uses_private) + && (param_type == ra_param_private)) { + + max = DIMOF(secure_terms); + } for (GList *iter = metadata->ra_params; iter != NULL; iter = iter->next) { struct ra_param_s *param = (struct ra_param_s *) iter->data; - bool accept = pcmk_is_set(param->rap_flags, param_type); + bool accept = FALSE; + + if (pcmk_is_set(param->rap_flags, param_type)) { + accept = TRUE; + + } else if (max) { + for (int lpc = 0; lpc < max; lpc++) { + if (pcmk__str_eq(secure_terms[lpc], param->rap_name, pcmk__str_casei)) { + accept = TRUE; + break; + } + } + } if (accept) { crm_trace("Attr %s is %s", param->rap_name, ra_param_flag2text(param_type)); diff --git a/daemons/controld/controld_metadata.c b/daemons/controld/controld_metadata.c index ef6281e..da9da60 100644 --- a/daemons/controld/controld_metadata.c +++ b/daemons/controld/controld_metadata.c @@ -182,7 +182,6 @@ metadata_cache_update(GHashTable *mdc, lrmd_rsc_info_t *rsc, xmlNode *metadata = NULL; xmlNode *match = NULL; struct ra_metadata_s *md = NULL; - bool any_private_params = false; CRM_CHECK(mdc && rsc && metadata_str, return NULL); @@ -239,28 +238,12 @@ metadata_cache_update(GHashTable *mdc, lrmd_rsc_info_t *rsc, goto err; } if (pcmk_is_set(p->rap_flags, ra_param_private)) { - any_private_params = true; + controld_set_ra_flags(md, key, ra_uses_private); } md->ra_params = g_list_prepend(md->ra_params, p); } } - /* Newer resource agents support the "private" parameter attribute to - * indicate sensitive parameters. For backward compatibility with older - * agents, implicitly treat a few common names as private when the agent - * doesn't specify any explicitly. - */ - if (!any_private_params) { - for (GList *iter = md->ra_params; iter != NULL; iter = iter->next) { - struct ra_param_s *p = iter->data; - - if (pcmk__str_any_of(p->rap_name, "password", "passwd", "user", - NULL)) { - controld_set_ra_param_flags(p, ra_param_private); - } - } - } - g_hash_table_replace(mdc, key, md); free_xml(metadata); return md; diff --git a/daemons/controld/controld_metadata.h b/daemons/controld/controld_metadata.h index 398d12a..010092f 100644 --- a/daemons/controld/controld_metadata.h +++ b/daemons/controld/controld_metadata.h @@ -12,6 +12,7 @@ enum ra_flags_e { ra_supports_reload = 0x01, + ra_uses_private = 0x02, }; enum ra_param_flags_e { diff --git a/daemons/execd/cts-exec-helper.c b/daemons/execd/cts-exec-helper.c index 423b54d..8be8e18 100644 --- a/daemons/execd/cts-exec-helper.c +++ b/daemons/execd/cts-exec-helper.c @@ -482,12 +482,13 @@ generate_params(void) goto param_gen_bail; } - params = pe_rsc_params(rsc, NULL, data_set); + params = crm_str_table_new(); meta = crm_str_table_new(); + get_rsc_attributes(params, rsc, NULL, data_set); get_meta_attributes(meta, rsc, NULL, data_set); - if (params != NULL) { + if (params) { char *key = NULL; char *value = NULL; @@ -495,6 +496,7 @@ generate_params(void) while (g_hash_table_iter_next(&iter, (gpointer *) & key, (gpointer *) & value)) { options.params = lrmd_key_value_add(options.params, key, value); } + g_hash_table_destroy(params); } if (meta) { diff --git a/daemons/fenced/cts-fence-helper.c b/daemons/fenced/cts-fence-helper.c index af006b5..a248829 100644 --- a/daemons/fenced/cts-fence-helper.c +++ b/daemons/fenced/cts-fence-helper.c @@ -26,7 +26,6 @@ #include #include -#include #include #include @@ -185,8 +184,7 @@ run_fence_failure_test(void) { stonith_key_value_t *params = NULL; - params = stonith_key_value_add(params, PCMK_STONITH_HOST_MAP, - "false_1_node1=1,2 false_1_node2=3,4"); + params = stonith_key_value_add(params, "pcmk_host_map", "false_1_node1=1,2 false_1_node2=3,4"); params = stonith_key_value_add(params, "mode", "fail"); single_test(st-> @@ -210,8 +208,7 @@ run_fence_failure_rollover_test(void) { stonith_key_value_t *params = NULL; - params = stonith_key_value_add(params, PCMK_STONITH_HOST_MAP, - "false_1_node1=1,2 false_1_node2=3,4"); + params = stonith_key_value_add(params, "pcmk_host_map", "false_1_node1=1,2 false_1_node2=3,4"); params = stonith_key_value_add(params, "mode", "fail"); single_test(st-> @@ -219,8 +216,7 @@ run_fence_failure_rollover_test(void) "Register device1 for rollover test", 1, 0); stonith_key_value_freeall(params, 1, 1); params = NULL; - params = stonith_key_value_add(params, PCMK_STONITH_HOST_MAP, - "false_1_node1=1,2 false_1_node2=3,4"); + params = stonith_key_value_add(params, "pcmk_host_map", "false_1_node1=1,2 false_1_node2=3,4"); params = stonith_key_value_add(params, "mode", "pass"); single_test(st-> @@ -248,8 +244,7 @@ run_standard_test(void) { stonith_key_value_t *params = NULL; - params = stonith_key_value_add(params, PCMK_STONITH_HOST_MAP, - "false_1_node1=1,2 false_1_node2=3,4"); + params = stonith_key_value_add(params, "pcmk_host_map", "false_1_node1=1,2 false_1_node2=3,4"); params = stonith_key_value_add(params, "mode", "pass"); params = stonith_key_value_add(params, "mock_dynamic_hosts", "false_1_node1 false_1_node2"); @@ -325,8 +320,7 @@ standard_dev_test(void) crm_exit(CRM_EX_DISCONNECT); } - params = stonith_key_value_add(params, PCMK_STONITH_HOST_MAP, - "some-host=pcmk-7 true_1_node1=3,4"); + params = stonith_key_value_add(params, "pcmk_host_map", "some-host=pcmk-7 true_1_node1=3,4"); rc = st->cmds->register_device(st, st_opts, "test-id", "stonith-ng", "fence_xvm", params); crm_debug("Register: %d", rc); @@ -504,22 +498,19 @@ test_register_async_devices(int check_event) char buf[16] = { 0, }; stonith_key_value_t *params = NULL; - params = stonith_key_value_add(params, PCMK_STONITH_HOST_MAP, - "false_1_node1=1,2"); + params = stonith_key_value_add(params, "pcmk_host_map", "false_1_node1=1,2"); params = stonith_key_value_add(params, "mode", "fail"); st->cmds->register_device(st, st_opts, "false_1", "stonith-ng", "fence_dummy", params); stonith_key_value_freeall(params, 1, 1); params = NULL; - params = stonith_key_value_add(params, PCMK_STONITH_HOST_MAP, - "true_1_node1=1,2"); + params = stonith_key_value_add(params, "pcmk_host_map", "true_1_node1=1,2"); params = stonith_key_value_add(params, "mode", "pass"); st->cmds->register_device(st, st_opts, "true_1", "stonith-ng", "fence_dummy", params); stonith_key_value_freeall(params, 1, 1); params = NULL; - params = stonith_key_value_add(params, PCMK_STONITH_HOST_MAP, - "custom_timeout_node1=1,2"); + params = stonith_key_value_add(params, "pcmk_host_map", "custom_timeout_node1=1,2"); params = stonith_key_value_add(params, "mode", "fail"); params = stonith_key_value_add(params, "delay", "1000"); snprintf(buf, sizeof(buf) - 1, "%d", MAINLOOP_DEFAULT_TIMEOUT + CUSTOM_TIMEOUT_ADDITION); diff --git a/daemons/fenced/fenced_commands.c b/daemons/fenced/fenced_commands.c index 22b0bcd..8d085d4 100644 --- a/daemons/fenced/fenced_commands.c +++ b/daemons/fenced/fenced_commands.c @@ -128,7 +128,7 @@ get_action_delay_max(stonith_device_t * device, const char * action) return 0; } - value = g_hash_table_lookup(device->params, PCMK_STONITH_DELAY_MAX); + value = g_hash_table_lookup(device->params, STONITH_ATTR_DELAY_MAX); if (value) { delay_max = crm_parse_interval_spec(value) / 1000; } @@ -146,7 +146,7 @@ get_action_delay_base(stonith_device_t * device, const char * action) return 0; } - value = g_hash_table_lookup(device->params, PCMK_STONITH_DELAY_BASE); + value = g_hash_table_lookup(device->params, STONITH_ATTR_DELAY_BASE); if (value) { delay_base = crm_parse_interval_spec(value) / 1000; } @@ -269,7 +269,7 @@ get_action_limit(stonith_device_t * device) const char *value = NULL; int action_limit = 1; - value = g_hash_table_lookup(device->params, PCMK_STONITH_ACTION_LIMIT); + value = g_hash_table_lookup(device->params, STONITH_ATTR_ACTION_LIMIT); if (value) { action_limit = crm_parse_int(value, "1"); if (action_limit == 0) { @@ -897,12 +897,12 @@ build_device_from_xml(xmlNode * msg) device->namespace = crm_element_value_copy(dev, "namespace"); device->params = xml2device_params(device->id, dev); - value = g_hash_table_lookup(device->params, PCMK_STONITH_HOST_LIST); + value = g_hash_table_lookup(device->params, STONITH_ATTR_HOSTLIST); if (value) { device->targets = stonith__parse_targets(value); } - value = g_hash_table_lookup(device->params, PCMK_STONITH_HOST_MAP); + value = g_hash_table_lookup(device->params, STONITH_ATTR_HOSTMAP); device->aliases = build_port_aliases(value, &(device->targets)); device->agent_metadata = get_agent_metadata(device->agent); @@ -942,13 +942,13 @@ target_list_type(stonith_device_t * dev) { const char *check_type = NULL; - check_type = g_hash_table_lookup(dev->params, PCMK_STONITH_HOST_CHECK); + check_type = g_hash_table_lookup(dev->params, STONITH_ATTR_HOSTCHECK); if (check_type == NULL) { - if (g_hash_table_lookup(dev->params, PCMK_STONITH_HOST_LIST)) { + if (g_hash_table_lookup(dev->params, STONITH_ATTR_HOSTLIST)) { check_type = "static-list"; - } else if (g_hash_table_lookup(dev->params, PCMK_STONITH_HOST_MAP)) { + } else if (g_hash_table_lookup(dev->params, STONITH_ATTR_HOSTMAP)) { check_type = "static-list"; } else if (pcmk_is_set(dev->flags, st_device_supports_list)) { check_type = "dynamic-list"; @@ -1067,8 +1067,7 @@ dynamic_list_search_cb(GPid pid, int rc, const char *output, gpointer user_data) if (rc != 0 && !dev->targets) { crm_notice("Disabling port list queries for %s (%d): %s", dev->id, rc, output); /* Fall back to status */ - g_hash_table_replace(dev->params, - strdup(PCMK_STONITH_HOST_CHECK), strdup("status")); + g_hash_table_replace(dev->params, strdup(STONITH_ATTR_HOSTCHECK), strdup("status")); g_list_free_full(dev->targets, free); dev->targets = NULL; @@ -1659,7 +1658,7 @@ can_fence_host_with_device(stonith_device_t * dev, struct device_search_s *searc if (string_in_list(dev->targets, host)) { can = TRUE; - } else if (g_hash_table_lookup(dev->params, PCMK_STONITH_HOST_MAP) + } else if (g_hash_table_lookup(dev->params, STONITH_ATTR_HOSTMAP) && g_hash_table_lookup(dev->aliases, host)) { can = TRUE; } @@ -1690,8 +1689,8 @@ can_fence_host_with_device(stonith_device_t * dev, struct device_search_s *searc /* we'll respond to this search request async in the cb */ return; } else { - crm_err("Invalid value for " PCMK_STONITH_HOST_CHECK ": %s", check_type); - check_type = "Invalid " PCMK_STONITH_HOST_CHECK; + crm_err("Invalid value for " STONITH_ATTR_HOSTCHECK ": %s", check_type); + check_type = "Invalid " STONITH_ATTR_HOSTCHECK; } if (pcmk__str_eq(host, alias, pcmk__str_casei)) { diff --git a/daemons/fenced/pacemaker-fenced.c b/daemons/fenced/pacemaker-fenced.c index 5274d96..092f604 100644 --- a/daemons/fenced/pacemaker-fenced.c +++ b/daemons/fenced/pacemaker-fenced.c @@ -642,7 +642,6 @@ static void cib_device_update(pe_resource_t *rsc, pe_working_set_t *data_set) /* Our node is allowed, so update the device information */ int rc; xmlNode *data; - GHashTable *rsc_params = NULL; GHashTableIter gIter; stonith_key_value_t *params = NULL; @@ -651,12 +650,12 @@ static void cib_device_update(pe_resource_t *rsc, pe_working_set_t *data_set) const char *rsc_provides = NULL; crm_debug("Device %s is allowed on %s: score=%d", rsc->id, stonith_our_uname, node->weight); - rsc_params = pe_rsc_params(rsc, node, data_set); + get_rsc_attributes(rsc->parameters, rsc, node, data_set); get_meta_attributes(rsc->meta, rsc, node, data_set); - rsc_provides = g_hash_table_lookup(rsc->meta, PCMK_STONITH_PROVIDES); + rsc_provides = g_hash_table_lookup(rsc->meta, XML_RSC_ATTR_PROVIDES); - g_hash_table_iter_init(&gIter, rsc_params); + g_hash_table_iter_init(&gIter, rsc->parameters); while (g_hash_table_iter_next(&gIter, (gpointer *) & name, (gpointer *) & value)) { if (!name || !value) { continue; @@ -1332,8 +1331,7 @@ main(int argc, char **argv) printf(" \n"); #endif - printf(" \n", - PCMK_STONITH_HOST_ARGUMENT); + printf(" \n", STONITH_ATTR_HOSTARG); printf (" Advanced use only: An alternate parameter to supply instead of 'port'\n"); printf @@ -1344,8 +1342,7 @@ main(int argc, char **argv) printf(" \n"); printf(" \n"); - printf(" \n", - PCMK_STONITH_HOST_MAP); + printf(" \n", STONITH_ATTR_HOSTMAP); printf (" A mapping of host names to ports numbers for devices that do not support host names.\n"); printf @@ -1353,28 +1350,25 @@ main(int argc, char **argv) printf(" \n"); printf(" \n"); - printf(" \n", - PCMK_STONITH_HOST_LIST); - printf(" A list of machines controlled by " - "this device (Optional unless %s=static-list).\n", - PCMK_STONITH_HOST_CHECK); + printf(" \n", STONITH_ATTR_HOSTLIST); + printf + (" A list of machines controlled by this device (Optional unless %s=static-list).\n", + STONITH_ATTR_HOSTCHECK); printf(" \n"); printf(" \n"); - printf(" \n", - PCMK_STONITH_HOST_CHECK); + printf(" \n", STONITH_ATTR_HOSTCHECK); printf (" How to determine which machines are controlled by the device.\n"); printf(" Allowed values: dynamic-list " "(query the device via the 'list' command), static-list " - "(check the " PCMK_STONITH_HOST_LIST " attribute), status " + "(check the " STONITH_ATTR_HOSTLIST " attribute), status " "(query the device via the 'status' command), none (assume " "every device can fence every machine)\n"); printf(" \n"); printf(" \n"); - printf(" \n", - PCMK_STONITH_DELAY_MAX); + printf(" \n", STONITH_ATTR_DELAY_MAX); printf (" Enable a random delay for stonith actions and specify the maximum of random delay.\n"); printf @@ -1384,8 +1378,7 @@ main(int argc, char **argv) printf(" \n"); printf(" \n"); - printf(" \n", - PCMK_STONITH_DELAY_BASE); + printf(" \n", STONITH_ATTR_DELAY_BASE); printf (" Enable a base delay for stonith actions and specify base delay value.\n"); printf @@ -1395,8 +1388,7 @@ main(int argc, char **argv) printf(" \n"); printf(" \n"); - printf(" \n", - PCMK_STONITH_ACTION_LIMIT); + printf(" \n", STONITH_ATTR_ACTION_LIMIT); printf (" The maximum number of actions can be performed in parallel on this device\n"); printf @@ -1515,8 +1507,7 @@ main(int argc, char **argv) xmlNode *xml; stonith_key_value_t *params = NULL; - params = stonith_key_value_add(params, PCMK_STONITH_HOST_LIST, - stonith_our_uname); + params = stonith_key_value_add(params, STONITH_ATTR_HOSTLIST, stonith_our_uname); xml = create_device_registration_xml("watchdog", st_namespace_internal, STONITH_WATCHDOG_AGENT, params, diff --git a/include/crm/common/Makefile.am b/include/crm/common/Makefile.am index 2686dc0..f30e75f 100644 --- a/include/crm/common/Makefile.am +++ b/include/crm/common/Makefile.am @@ -12,7 +12,7 @@ MAINTAINERCLEANFILES = Makefile.in headerdir=$(pkgincludedir)/crm/common header_HEADERS = xml.h ipc.h util.h iso8601.h mainloop.h logging.h results.h \ - nvpair.h acl.h agents.h ipc_controld.h ipc_pacemakerd.h + nvpair.h acl.h ipc_controld.h ipc_pacemakerd.h noinst_HEADERS = internal.h alerts_internal.h \ iso8601_internal.h remote_internal.h xml_internal.h \ ipc_internal.h output_internal.h cmdline_internal.h \ diff --git a/include/crm/common/agents.h b/include/crm/common/agents.h deleted file mode 100644 index b185977..0000000 --- a/include/crm/common/agents.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2017-2020 the Pacemaker project contributors - * - * The version control history for this file may have further details. - * - * This source code is licensed under the GNU Lesser General Public License - * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. - */ - -#ifndef PCMK__AGENTS__H -# define PCMK__AGENTS__H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \file - * \brief API related to resource agents - * \ingroup core - */ - -#include // uint32_t -#include - -/* Special stonith-class agent parameters interpreted directly by Pacemaker - * (not including the pcmk_ACTION_{action,retries,timeout} parameters) - */ -#define PCMK_STONITH_ACTION_LIMIT "pcmk_action_limit" -#define PCMK_STONITH_DELAY_BASE "pcmk_delay_base" -#define PCMK_STONITH_DELAY_MAX "pcmk_delay_max" -#define PCMK_STONITH_HOST_ARGUMENT "pcmk_host_argument" -#define PCMK_STONITH_HOST_CHECK "pcmk_host_check" -#define PCMK_STONITH_HOST_LIST "pcmk_host_list" -#define PCMK_STONITH_HOST_MAP "pcmk_host_map" -#define PCMK_STONITH_PROVIDES "provides" -#define PCMK_STONITH_STONITH_TIMEOUT "stonith-timeout" - -// Capabilities supported by a resource agent standard -enum pcmk_ra_caps { - pcmk_ra_cap_none = 0, - pcmk_ra_cap_provider = (1 << 0), // Requires provider - pcmk_ra_cap_status = (1 << 1), // Supports status instead of monitor - pcmk_ra_cap_params = (1 << 2), // Supports parameters - pcmk_ra_cap_unique = (1 << 3), // Supports unique clones - pcmk_ra_cap_promotable = (1 << 4), // Supports promotable clones - pcmk_ra_cap_stdin = (1 << 5), // Reads from standard input - pcmk_ra_cap_fence_params = (1 << 6), // Supports pcmk_monitor_timeout, etc. -}; - -uint32_t pcmk_get_ra_caps(const char *standard); -char *crm_generate_ra_key(const char *standard, const char *provider, - const char *type); -int crm_parse_agent_spec(const char *spec, char **standard, char **provider, - char **type); -bool pcmk_stonith_param(const char *param); - -#ifndef PCMK__NO_COMPAT -/* Everything here is deprecated and kept only for public API backward - * compatibility. It will be moved to compatibility.h in a future release. - */ - -//! \deprecated Use pcmk_get_ra_caps() instead -bool crm_provider_required(const char *standard); - -#endif // PCMK__NO_COMPAT - -#ifdef __cplusplus -} -#endif - -#endif // PCMK__AGENTS__H diff --git a/include/crm/common/output_internal.h b/include/crm/common/output_internal.h index 4bf6b3d..2874259 100644 --- a/include/crm/common/output_internal.h +++ b/include/crm/common/output_internal.h @@ -460,14 +460,6 @@ struct pcmk__output_s { * \return true if output should be supressed, false otherwise. */ bool (*is_quiet) (pcmk__output_t *out); - - /*! - * \internal - * \brief Output a spacer. Not all formatter will do this. - * - * \param[in] out The output functions structure. - */ - void (*spacer) (pcmk__output_t *out); }; /*! @@ -626,11 +618,9 @@ pcmk__indented_vprintf(pcmk__output_t *out, const char *format, va_list args) G_ * * \param[in,out] out The output functions structure. * \param[in] name The name of the node to be created. - * \param[in] ... Name/value pairs to set as XML properties. */ xmlNodePtr -pcmk__output_xml_create_parent(pcmk__output_t *out, const char *name, ...) -G_GNUC_NULL_TERMINATED; +pcmk__output_xml_create_parent(pcmk__output_t *out, const char *name); /*! * \internal @@ -650,11 +640,9 @@ pcmk__output_xml_add_node(pcmk__output_t *out, xmlNodePtr node); * * \param[in,out] out The output functions structure. * \param[in] name The name of the node to be created. - * \param[in] ... Name/value pairs to set as XML properties. */ xmlNodePtr -pcmk__output_create_xml_node(pcmk__output_t *out, const char *name, ...) -G_GNUC_NULL_TERMINATED; +pcmk__output_create_xml_node(pcmk__output_t *out, const char *name); /*! * \internal @@ -757,7 +745,7 @@ G_GNUC_NULL_TERMINATED; #define PCMK__OUTPUT_SPACER_IF(out_obj, cond) \ if (cond) { \ - out->spacer(out); \ + out_obj->info(out_obj, "%s", ""); \ } #define PCMK__OUTPUT_LIST_HEADER(out_obj, cond, retcode, title...) \ diff --git a/include/crm/common/util.h b/include/crm/common/util.h index 0a2ee6c..74fd6bd 100644 --- a/include/crm/common/util.h +++ b/include/crm/common/util.h @@ -32,7 +32,6 @@ extern "C" { # include # include -# include # include # define ONLINESTATUS "online" // Status of an online client @@ -134,6 +133,27 @@ xmlNode *crm_create_op_xml(xmlNode *parent, const char *prefix, const char *timeout); #define CRM_DEFAULT_OP_TIMEOUT_S "20s" +// Public resource agent functions (from agents.c) + +// Capabilities supported by a resource agent standard +enum pcmk_ra_caps { + pcmk_ra_cap_none = 0, + pcmk_ra_cap_provider = (1 << 0), // Requires provider + pcmk_ra_cap_status = (1 << 1), // Supports status instead of monitor + pcmk_ra_cap_params = (1 << 2), // Supports parameters + pcmk_ra_cap_unique = (1 << 3), // Supports unique clones + pcmk_ra_cap_promotable = (1 << 4), // Supports promotable clones + pcmk_ra_cap_stdin = (1 << 5), // Reads from standard input + pcmk_ra_cap_fence_params = (1 << 6), // Supports pcmk_monitor_timeout, etc. +}; + +uint32_t pcmk_get_ra_caps(const char *standard); +char *crm_generate_ra_key(const char *standard, const char *provider, + const char *type); +int crm_parse_agent_spec(const char *spec, char **standard, char **provider, + char **type); + + int compare_version(const char *version1, const char *version2); /* coverity[+kill] */ @@ -235,6 +255,9 @@ is_set_any(long long word, long long bit) return ((word & bit) != 0); } +//! \deprecated Use pcmk_get_ra_caps() instead +bool crm_provider_required(const char *standard); + //! \deprecated Use strcmp or strcasecmp instead gboolean crm_str_eq(const char *a, const char *b, gboolean use_case); diff --git a/include/crm/common/xml_internal.h b/include/crm/common/xml_internal.h index 1e80bc6..5643be6 100644 --- a/include/crm/common/xml_internal.h +++ b/include/crm/common/xml_internal.h @@ -136,10 +136,6 @@ const char *pcmk__xe_add_last_written(xmlNode *xe); xmlNode *pcmk__xe_match(xmlNode *parent, const char *node_name, const char *attr_n, const char *attr_v); -void pcmk__xe_remove_matching_attrs(xmlNode *element, - bool (*match)(xmlAttrPtr, void *), - void *user_data); - /*! * \internal * \brief Get the root directory to scan XML artefacts of given kind for @@ -239,38 +235,4 @@ pcmk__xe_next(const xmlNode *child) return next; } -/*! - * \internal - * \brief Like pcmk__xe_set_props, but takes a va_list instead of - * arguments directly. - */ -void -pcmk__xe_set_propv(xmlNodePtr node, va_list pairs); - -/*! - * \internal - * \brief Add a NULL-terminated list of name/value pairs to the given - * XML node as properties. - * - * \param[in,out] node XML node to add properties to - * \param[in] ... NULL-terminated list of name/value pairs - */ -void -pcmk__xe_set_props(xmlNodePtr node, ...) -G_GNUC_NULL_TERMINATED; - -/*! - * \internal - * \brief Get first attribute of an XML element - * - * \param[in] xe XML element to check - * - * \return First attribute of \p xe (or NULL if \p xe is NULL or has none) - */ -static inline xmlAttr * -pcmk__xe_first_attr(const xmlNode *xe) -{ - return (xe == NULL)? NULL : xe->properties; -} - #endif // PCMK__XML_INTERNAL__H diff --git a/include/crm/crm.h b/include/crm/crm.h index 3f22c4b..389b6aa 100644 --- a/include/crm/crm.h +++ b/include/crm/crm.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2021 the Pacemaker project contributors + * Copyright 2004-2020 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -51,7 +51,7 @@ extern "C" { * >=3.0.13: Fail counts include operation name and interval * >=3.2.0: DC supports PCMK_LRM_OP_INVALID and PCMK_LRM_OP_NOT_CONNECTED */ -# define CRM_FEATURE_SET "3.7.0" +# define CRM_FEATURE_SET "3.6.1" # define EOS '\0' # define DIMOF(a) ((int) (sizeof(a)/sizeof(a[0])) ) diff --git a/include/crm/fencing/internal.h b/include/crm/fencing/internal.h index dfb1d64..f33957f 100644 --- a/include/crm/fencing/internal.h +++ b/include/crm/fencing/internal.h @@ -152,6 +152,14 @@ void stonith__device_parameter_flags(uint32_t *device_flags, # define T_STONITH_TIMEOUT_VALUE "st-async-timeout-value" # define T_STONITH_NOTIFY "st_notify" +# define STONITH_ATTR_HOSTARG "pcmk_host_argument" +# define STONITH_ATTR_HOSTMAP "pcmk_host_map" +# define STONITH_ATTR_HOSTLIST "pcmk_host_list" +# define STONITH_ATTR_HOSTCHECK "pcmk_host_check" +# define STONITH_ATTR_DELAY_MAX "pcmk_delay_max" +# define STONITH_ATTR_DELAY_BASE "pcmk_delay_base" +# define STONITH_ATTR_ACTION_LIMIT "pcmk_action_limit" + # define STONITH_ATTR_ACTION_OP "action" # define STONITH_OP_EXEC "st_execute" @@ -185,11 +193,20 @@ int stonith__rhcs_validate(stonith_t *st, int call_options, const char *target, const char *agent, GHashTable *params, const char *host_arg, int timeout, char **output, char **error_output); -/* Exported for crm_mon to reference */ int stonith__failed_history(pcmk__output_t *out, va_list args); int stonith__history(pcmk__output_t *out, va_list args); int stonith__full_history(pcmk__output_t *out, va_list args); +int stonith__full_history_xml(pcmk__output_t *out, va_list args); +int stonith__last_fenced_html(pcmk__output_t *out, va_list args); +int stonith__last_fenced_text(pcmk__output_t *out, va_list args); +int stonith__last_fenced_xml(pcmk__output_t *out, va_list args); int stonith__pending_actions(pcmk__output_t *out, va_list args); +int stonith__event_html(pcmk__output_t *out, va_list args); +int stonith__event_text(pcmk__output_t *out, va_list args); +int stonith__event_xml(pcmk__output_t *out, va_list args); +int stonith__validate_agent_html(pcmk__output_t *out, va_list args); +int stonith__validate_agent_text(pcmk__output_t *out, va_list args); +int stonith__validate_agent_xml(pcmk__output_t *out, va_list args); stonith_history_t *stonith__first_matching_event(stonith_history_t *history, bool (*matching_fn)(stonith_history_t *, void *), diff --git a/include/crm/lrmd_internal.h b/include/crm/lrmd_internal.h index 720e1a3..498a9ba 100644 --- a/include/crm/lrmd_internal.h +++ b/include/crm/lrmd_internal.h @@ -15,7 +15,6 @@ #include // xmlNode #include // crm_ipc_t #include // mainloop_io_t, ipc_client_callbacks -#include // pcmk__output_t #include // pcmk__remote_t #include // lrmd_t, lrmd_event_data_t @@ -67,6 +66,4 @@ void remote_proxy_relay_event(remote_proxy_t *proxy, xmlNode *msg); void remote_proxy_relay_response(remote_proxy_t *proxy, xmlNode *msg, int msg_id); -void lrmd__register_messages(pcmk__output_t *out); - #endif diff --git a/include/crm/msg_xml.h b/include/crm/msg_xml.h index b66ab90..1fcb72d 100644 --- a/include/crm/msg_xml.h +++ b/include/crm/msg_xml.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2021 the Pacemaker project contributors + * Copyright 2004-2020 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -208,6 +208,7 @@ extern "C" { # define XML_RSC_ATTR_FAIL_TIMEOUT "failure-timeout" # define XML_RSC_ATTR_MULTIPLE "multiple-active" # define XML_RSC_ATTR_REQUIRES "requires" +# define XML_RSC_ATTR_PROVIDES "provides" # define XML_RSC_ATTR_CONTAINER "container" # define XML_RSC_ATTR_INTERNAL_RSC "internal_rsc" # define XML_RSC_ATTR_MAINTENANCE "maintenance" @@ -217,7 +218,6 @@ extern "C" { # define XML_RSC_ATTR_REMOTE_RA_ADDR "addr" # define XML_RSC_ATTR_REMOTE_RA_SERVER "server" # define XML_RSC_ATTR_REMOTE_RA_PORT "port" -# define XML_RSC_ATTR_CRITICAL "critical" # define XML_REMOTE_ATTR_RECONNECT_INTERVAL "reconnect_interval" @@ -328,7 +328,6 @@ extern "C" { # define XML_COLOC_ATTR_NODE_ATTR "node-attribute" # define XML_COLOC_ATTR_SOURCE_INSTANCE "rsc-instance" # define XML_COLOC_ATTR_TARGET_INSTANCE "with-rsc-instance" -# define XML_COLOC_ATTR_INFLUENCE "influence" # define XML_LOC_ATTR_SOURCE "rsc" # define XML_LOC_ATTR_SOURCE_PATTERN "rsc-pattern" @@ -426,17 +425,6 @@ extern "C" { # define ID(x) crm_element_value(x, XML_ATTR_ID) # define TYPE(x) crm_element_name(x) - -#ifndef PCMK__NO_COMPAT -/* Everything here is deprecated and kept only for public API backward - * compatibility. It will be moved to compatibility.h in a future release. - */ - -//! \deprecated Use PCMK_STONITH_PROVIDES instead -# define XML_RSC_ATTR_PROVIDES "provides" - -#endif - #ifdef __cplusplus } #endif diff --git a/include/crm/pengine/complex.h b/include/crm/pengine/complex.h index 1d010f4..effa44f 100644 --- a/include/crm/pengine/complex.h +++ b/include/crm/pengine/complex.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2020 the Pacemaker project contributors + * Copyright 2004-2019 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -19,9 +19,6 @@ extern "C" { #include // pe_node_t, pe_resource_t, etc. extern resource_object_functions_t resource_class_functions[]; - -GHashTable *pe_rsc_params(pe_resource_t *rsc, pe_node_t *node, - pe_working_set_t *data_set); void get_meta_attributes(GHashTable * meta_hash, pe_resource_t *rsc, pe_node_t *node, pe_working_set_t *data_set); void get_rsc_attributes(GHashTable *meta_hash, pe_resource_t *rsc, diff --git a/include/crm/pengine/internal.h b/include/crm/pengine/internal.h index 9f4e28a..abe7a76 100644 --- a/include/crm/pengine/internal.h +++ b/include/crm/pengine/internal.h @@ -243,9 +243,6 @@ void clone_print(pe_resource_t * rsc, const char *pre_text, long options, void * void pe__print_bundle(pe_resource_t *rsc, const char *pre_text, long options, void *print_data); -gchar * pcmk__native_output_string(pe_resource_t *rsc, const char *name, pe_node_t *node, - long options, const char *target_role, bool show_nodes); - int pe__name_and_nvpairs_xml(pcmk__output_t *out, bool is_list, const char *tag_name , size_t pairs_count, ...); char *pe__node_display_name(pe_node_t *node, bool print_detail); @@ -256,9 +253,34 @@ pe__rsc_bool_str(pe_resource_t *rsc, uint64_t rsc_flag) return pcmk__btoa(pcmk_is_set(rsc->flags, rsc_flag)); } +int pe__ban_html(pcmk__output_t *out, va_list args); +int pe__ban_text(pcmk__output_t *out, va_list args); +int pe__ban_xml(pcmk__output_t *out, va_list args); int pe__clone_xml(pcmk__output_t *out, va_list args); int pe__clone_html(pcmk__output_t *out, va_list args); int pe__clone_text(pcmk__output_t *out, va_list args); +int pe__cluster_counts_html(pcmk__output_t *out, va_list args); +int pe__cluster_counts_text(pcmk__output_t *out, va_list args); +int pe__cluster_counts_xml(pcmk__output_t *out, va_list args); +int pe__cluster_dc_html(pcmk__output_t *out, va_list args); +int pe__cluster_dc_text(pcmk__output_t *out, va_list args); +int pe__cluster_dc_xml(pcmk__output_t *out, va_list args); +int pe__cluster_maint_mode_html(pcmk__output_t *out, va_list args); +int pe__cluster_maint_mode_text(pcmk__output_t *out, va_list args); +int pe__cluster_options_html(pcmk__output_t *out, va_list args); +int pe__cluster_options_log(pcmk__output_t *out, va_list args); +int pe__cluster_options_text(pcmk__output_t *out, va_list args); +int pe__cluster_options_xml(pcmk__output_t *out, va_list args); +int pe__cluster_stack_html(pcmk__output_t *out, va_list args); +int pe__cluster_stack_text(pcmk__output_t *out, va_list args); +int pe__cluster_stack_xml(pcmk__output_t *out, va_list args); +int pe__cluster_summary(pcmk__output_t *out, va_list args); +int pe__cluster_summary_html(pcmk__output_t *out, va_list args); +int pe__cluster_times_html(pcmk__output_t *out, va_list args); +int pe__cluster_times_xml(pcmk__output_t *out, va_list args); +int pe__cluster_times_text(pcmk__output_t *out, va_list args); +int pe__failed_action_text(pcmk__output_t *out, va_list args); +int pe__failed_action_xml(pcmk__output_t *out, va_list args); int pe__group_xml(pcmk__output_t *out, va_list args); int pe__group_html(pcmk__output_t *out, va_list args); int pe__group_text(pcmk__output_t *out, va_list args); @@ -268,25 +290,23 @@ int pe__bundle_text(pcmk__output_t *out, va_list args); int pe__node_html(pcmk__output_t *out, va_list args); int pe__node_text(pcmk__output_t *out, va_list args); int pe__node_xml(pcmk__output_t *out, va_list args); -int pe__resource_xml(pcmk__output_t *out, va_list args); -int pe__resource_html(pcmk__output_t *out, va_list args); -int pe__resource_text(pcmk__output_t *out, va_list args); - -/* Exported for crm_mon to reference */ -int pe__ban_text(pcmk__output_t *out, va_list args); -int pe__cluster_counts_text(pcmk__output_t *out, va_list args); -int pe__cluster_dc_text(pcmk__output_t *out, va_list args); -int pe__cluster_maint_mode_text(pcmk__output_t *out, va_list args); -int pe__cluster_options_text(pcmk__output_t *out, va_list args); -int pe__cluster_stack_text(pcmk__output_t *out, va_list args); -int pe__cluster_summary(pcmk__output_t *out, va_list args); -int pe__cluster_times_text(pcmk__output_t *out, va_list args); -int pe__failed_action_text(pcmk__output_t *out, va_list args); +int pe__node_attribute_html(pcmk__output_t *out, va_list args); int pe__node_attribute_text(pcmk__output_t *out, va_list args); +int pe__node_attribute_xml(pcmk__output_t *out, va_list args); +int pe__node_list_html(pcmk__output_t *out, va_list args); int pe__node_list_text(pcmk__output_t *out, va_list args); +int pe__node_list_xml(pcmk__output_t *out, va_list args); int pe__op_history_text(pcmk__output_t *out, va_list args); +int pe__op_history_xml(pcmk__output_t *out, va_list args); int pe__resource_history_text(pcmk__output_t *out, va_list args); +int pe__resource_history_xml(pcmk__output_t *out, va_list args); +int pe__resource_xml(pcmk__output_t *out, va_list args); +int pe__resource_html(pcmk__output_t *out, va_list args); +int pe__resource_text(pcmk__output_t *out, va_list args); +int pe__resource_list(pcmk__output_t *out, va_list args); +int pe__ticket_html(pcmk__output_t *out, va_list args); int pe__ticket_text(pcmk__output_t *out, va_list args); +int pe__ticket_xml(pcmk__output_t *out, va_list args); void native_free(pe_resource_t * rsc); void group_free(pe_resource_t * rsc); @@ -502,14 +522,6 @@ typedef struct op_digest_cache_s { char *digest_restart_calc; } op_digest_cache_t; -op_digest_cache_t *pe__calculate_digests(pe_resource_t *rsc, const char *task, - guint *interval_ms, pe_node_t *node, - xmlNode *xml_op, GHashTable *overrides, - bool calc_secure, - pe_working_set_t *data_set); - -void pe__free_digests(gpointer ptr); - op_digest_cache_t *rsc_action_digest_cmp(pe_resource_t * rsc, xmlNode * xml_op, pe_node_t * node, pe_working_set_t * data_set); @@ -529,7 +541,6 @@ void pe_action_set_flag_reason(const char *function, long line, pe_action_t *act void pe__set_resource_flags_recursive(pe_resource_t *rsc, uint64_t flags); void pe__clear_resource_flags_recursive(pe_resource_t *rsc, uint64_t flags); -void pe__clear_resource_flags_on_all(pe_working_set_t *data_set, uint64_t flag); gboolean add_tag_ref(GHashTable * tags, const char * tag_name, const char * obj_ref); @@ -545,11 +556,9 @@ int pe__common_output_text(pcmk__output_t *out, pe_resource_t * rsc, const char int pe__common_output_html(pcmk__output_t *out, pe_resource_t * rsc, const char *name, pe_node_t *node, long options); pe_resource_t *pe__find_bundle_replica(const pe_resource_t *bundle, const pe_node_t *node); -bool pe__bundle_needs_remote_name(pe_resource_t *rsc, - pe_working_set_t *data_set); -const char *pe__add_bundle_remote_name(pe_resource_t *rsc, - pe_working_set_t *data_set, - xmlNode *xml, const char *field); +bool pe__bundle_needs_remote_name(pe_resource_t *rsc); +const char *pe__add_bundle_remote_name(pe_resource_t *rsc, xmlNode *xml, + const char *field); const char *pe_node_attribute_calculated(const pe_node_t *node, const char *name, const pe_resource_t *rsc); diff --git a/include/crm/pengine/pe_types.h b/include/crm/pengine/pe_types.h index 7d90c42..9fea637 100644 --- a/include/crm/pengine/pe_types.h +++ b/include/crm/pengine/pe_types.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2021 the Pacemaker project contributors + * Copyright 2004-2020 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -251,7 +251,6 @@ struct pe_node_s { # define pe_rsc_stop 0x00001000ULL # define pe_rsc_reload 0x00002000ULL # define pe_rsc_allow_remote_remotes 0x00004000ULL -# define pe_rsc_critical 0x00008000ULL # define pe_rsc_failed 0x00010000ULL # define pe_rsc_runnable 0x00040000ULL @@ -341,8 +340,8 @@ struct pe_resource_s { //!@{ //! This field should be treated as internal to Pacemaker - GListPtr rsc_cons_lhs; // List of pcmk__colocation_t* - GListPtr rsc_cons; // List of pcmk__colocation_t* + GListPtr rsc_cons_lhs; // List of rsc_colocation_t* + GListPtr rsc_cons; // List of rsc_colocation_t* GListPtr rsc_location; // List of pe__location_t* GListPtr actions; // List of pe_action_t* GListPtr rsc_tickets; // List of rsc_ticket* @@ -359,7 +358,7 @@ struct pe_resource_s { enum rsc_role_e next_role; GHashTable *meta; - GHashTable *parameters; //! \deprecated Use pe_rsc_params() instead + GHashTable *parameters; GHashTable *utilization; GListPtr children; /* pe_resource_t* */ @@ -372,12 +371,6 @@ struct pe_resource_s { pe_node_t *lock_node; // Resource is shutdown-locked to this node time_t lock_time; // When shutdown lock started - /* Resource parameters may have node-attribute-based rules, which means the - * values can vary by node. This table is a cache of parameter name/value - * tables for each node (as needed). Use pe_rsc_params() to get the table - * for a given node. - */ - GHashTable *parameter_cache; // Key = node name, value = parameters table #if ENABLE_VERSIONED_ATTRS xmlNode *versioned_parameters; #endif diff --git a/include/crm/pengine/rules_internal.h b/include/crm/pengine/rules_internal.h index 7380826..f60263a 100644 --- a/include/crm/pengine/rules_internal.h +++ b/include/crm/pengine/rules_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 the Pacemaker project contributors + * Copyright 2015-2019 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -28,6 +28,14 @@ gboolean pe__eval_op_expr(xmlNodePtr expr, pe_rule_eval_data_t *rule_data); gboolean pe__eval_role_expr(xmlNode *expr, pe_rule_eval_data_t *rule_data); gboolean pe__eval_rsc_expr(xmlNodePtr expr, pe_rule_eval_data_t *rule_data); +int pe_eval_date_expression(xmlNode *time_expr, + crm_time_t *now, + crm_time_t *next_change); +gboolean pe_test_date_expression(xmlNode *time_expr, crm_time_t *now, + crm_time_t *next_change); int pe_cron_range_satisfied(crm_time_t * now, xmlNode * cron_spec); +gboolean pe_test_attr_expression(xmlNode *expr, GHashTable *hash, crm_time_t *now, + pe_match_data_t *match_data); +gboolean pe_test_role_expression(xmlNode * expr, enum rsc_role_e role, crm_time_t * now); #endif diff --git a/include/pacemaker-internal.h b/include/pacemaker-internal.h index bf33f3e..37399e7 100644 --- a/include/pacemaker-internal.h +++ b/include/pacemaker-internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 the Pacemaker project contributors + * Copyright 2019 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -11,10 +11,8 @@ # define PACEMAKER_INTERNAL__H # include -# include # include # include -# include # include # include # include diff --git a/include/pacemaker.h b/include/pacemaker.h index 51bf585..a1e76d0 100644 --- a/include/pacemaker.h +++ b/include/pacemaker.h @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 the Pacemaker project contributors + * Copyright 2019 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -14,75 +14,16 @@ extern "C" { #endif +#ifdef BUILD_PUBLIC_LIBPACEMAKER + /** * \file * \brief High Level API * \ingroup pacemaker */ -# include -# include -# include - # include - -/*! - * \brief Get controller status - * - * \param[in,out] xml The destination for the result, as an XML tree. - * \param[in] dest_node Destination node for request - * \param[in] message_timeout_ms Message timeout - * - * \return Standard Pacemaker return code - */ -int pcmk_controller_status(xmlNodePtr *xml, char *dest_node, unsigned int message_timeout_ms); - -/*! - * \brief Get designated controller - * - * \param[in,out] xml The destination for the result, as an XML tree. - * \param[in] message_timeout_ms Message timeout - * - * \return Standard Pacemaker return code - */ -int pcmk_designated_controller(xmlNodePtr *xml, unsigned int message_timeout_ms); - -/*! - * \brief Get pacemakerd status - * - * \param[in,out] xml The destination for the result, as an XML tree. - * \param[in] ipc_name IPC name for request - * \param[in] message_timeout_ms Message timeout - * - * \return Standard Pacemaker return code - */ -int pcmk_pacemakerd_status(xmlNodePtr *xml, char *ipc_name, unsigned int message_timeout_ms); - -/*! - * \brief Calculate and output resource operation digests - * - * \param[out] xml Where to store XML with result - * \param[in] rsc Resource to calculate digests for - * \param[in] node Node whose operation history should be used - * \param[in] overrides Hash table of configuration parameters to override - * \param[in] data_set Cluster working set (with status) - * - * \return Standard Pacemaker return code - */ -int pcmk_resource_digests(xmlNodePtr *xml, pe_resource_t *rsc, - pe_node_t *node, GHashTable *overrides, - pe_working_set_t *data_set); - -#ifdef BUILD_PUBLIC_LIBPACEMAKER - -/*! - * \brief Get nodes list - * - * \param[in,out] xml The destination for the result, as an XML tree. - * - * \return Standard Pacemaker return code - */ -int pcmk_list_nodes(xmlNodePtr *xml); +# include /*! * \brief Perform a STONITH action. diff --git a/include/pcmki/Makefile.am b/include/pcmki/Makefile.am index 446c801..647f2dc 100644 --- a/include/pcmki/Makefile.am +++ b/include/pcmki/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2019-2021 the Pacemaker project contributors +# Copyright 2019 the Pacemaker project contributors # # The version control history for this file may have further details. # @@ -10,10 +10,8 @@ MAINTAINERCLEANFILES = Makefile.in noinst_HEADERS = pcmki_error.h \ - pcmki_cluster_queries.h \ pcmki_fence.h \ pcmki_output.h \ - pcmki_resource.h \ pcmki_sched_allocate.h \ pcmki_sched_notif.h \ pcmki_sched_utils.h \ diff --git a/include/pcmki/pcmki_cluster_queries.h b/include/pcmki/pcmki_cluster_queries.h deleted file mode 100644 index eb3b51c..0000000 --- a/include/pcmki/pcmki_cluster_queries.h +++ /dev/null @@ -1,15 +0,0 @@ -#include // gboolean, GMainLoop, etc. - -#include -#include -#include -#include - -int pcmk__controller_status(pcmk__output_t *out, char *dest_node, guint message_timeout_ms); -int pcmk__designated_controller(pcmk__output_t *out, guint message_timeout_ms); -int pcmk__pacemakerd_status(pcmk__output_t *out, char *ipc_name, guint message_timeout_ms); -int pcmk__list_nodes(pcmk__output_t *out, gboolean BASH_EXPORT); - -// remove when parameters removed from tools/crmadmin.c -int pcmk__shutdown_controller(pcmk__output_t *out, char *dest_node); -int pcmk__start_election(pcmk__output_t *out); diff --git a/include/pcmki/pcmki_output.h b/include/pcmki/pcmki_output.h index 0faef35..2b750fb 100644 --- a/include/pcmki/pcmki_output.h +++ b/include/pcmki/pcmki_output.h @@ -21,13 +21,6 @@ extern pcmk__supported_format_t pcmk__out_formats[]; int pcmk__out_prologue(pcmk__output_t **out, xmlNodePtr *xml); void pcmk__out_epilogue(pcmk__output_t *out, xmlNodePtr *xml, int retval); -/* This function registers only the formatted output messages that are a part - * of libpacemaker. It is not to be confused with pcmk__register_messages, - * which is a part of formatted output support and registers a whole table of - * messages at a time. - */ -void pcmk__register_lib_messages(pcmk__output_t *out); - #ifdef __cplusplus } #endif diff --git a/include/pcmki/pcmki_resource.h b/include/pcmki/pcmki_resource.h deleted file mode 100644 index 9d2afb5..0000000 --- a/include/pcmki/pcmki_resource.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2021 the Pacemaker project contributors - * - * The version control history for this file may have further details. - * - * This source code is licensed under the GNU Lesser General Public License - * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. - */ -#ifndef PCMKI_RESOURCE__H -#define PCMKI_RESOURCE__H - -#include - -#include -#include - -int pcmk__resource_digests(pcmk__output_t *out, pe_resource_t *rsc, - pe_node_t *node, GHashTable *overrides, - pe_working_set_t *data_set); - -#endif /* PCMK_RESOURCE__H */ diff --git a/include/pcmki/pcmki_sched_allocate.h b/include/pcmki/pcmki_sched_allocate.h index d226c8c..efc0da6 100644 --- a/include/pcmki/pcmki_sched_allocate.h +++ b/include/pcmki/pcmki_sched_allocate.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2020 the Pacemaker project contributors + * Copyright 2004-2019 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -26,9 +26,9 @@ struct resource_alloc_functions_s { void (*internal_constraints) (pe_resource_t *, pe_working_set_t *); void (*rsc_colocation_lh) (pe_resource_t *, pe_resource_t *, - pcmk__colocation_t *, pe_working_set_t *); + rsc_colocation_t *, pe_working_set_t *); void (*rsc_colocation_rh) (pe_resource_t *, pe_resource_t *, - pcmk__colocation_t *, pe_working_set_t *); + rsc_colocation_t *, pe_working_set_t *); void (*rsc_location) (pe_resource_t *, pe__location_t *); @@ -56,10 +56,10 @@ pe_node_t *pcmk__native_allocate(pe_resource_t *rsc, pe_node_t *preferred, extern void native_create_actions(pe_resource_t * rsc, pe_working_set_t * data_set); extern void native_internal_constraints(pe_resource_t * rsc, pe_working_set_t * data_set); void native_rsc_colocation_lh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, - pcmk__colocation_t *constraint, + rsc_colocation_t *constraint, pe_working_set_t *data_set); void native_rsc_colocation_rh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, - pcmk__colocation_t *constraint, + rsc_colocation_t *constraint, pe_working_set_t *data_set); extern void rsc_ticket_constraint(pe_resource_t * lh_rsc, rsc_ticket_t * rsc_ticket, pe_working_set_t * data_set); @@ -76,10 +76,10 @@ pe_node_t *pcmk__group_allocate(pe_resource_t *rsc, pe_node_t *preferred, extern void group_create_actions(pe_resource_t * rsc, pe_working_set_t * data_set); extern void group_internal_constraints(pe_resource_t * rsc, pe_working_set_t * data_set); void group_rsc_colocation_lh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, - pcmk__colocation_t *constraint, + rsc_colocation_t *constraint, pe_working_set_t *data_set); void group_rsc_colocation_rh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, - pcmk__colocation_t *constraint, + rsc_colocation_t *constraint, pe_working_set_t *data_set); extern enum pe_action_flags group_action_flags(pe_action_t * action, pe_node_t * node); void group_rsc_location(pe_resource_t *rsc, pe__location_t *constraint); @@ -97,11 +97,11 @@ void pcmk__bundle_internal_constraints(pe_resource_t *rsc, pe_working_set_t *data_set); void pcmk__bundle_rsc_colocation_lh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, - pcmk__colocation_t *constraint, + rsc_colocation_t *constraint, pe_working_set_t *data_set); void pcmk__bundle_rsc_colocation_rh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, - pcmk__colocation_t *constraint, + rsc_colocation_t *constraint, pe_working_set_t *data_set); void pcmk__bundle_rsc_location(pe_resource_t *rsc, pe__location_t *constraint); enum pe_action_flags pcmk__bundle_action_flags(pe_action_t *action, @@ -114,10 +114,10 @@ pe_node_t *pcmk__clone_allocate(pe_resource_t *rsc, pe_node_t *preferred, extern void clone_create_actions(pe_resource_t * rsc, pe_working_set_t * data_set); extern void clone_internal_constraints(pe_resource_t * rsc, pe_working_set_t * data_set); void clone_rsc_colocation_lh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, - pcmk__colocation_t *constraint, + rsc_colocation_t *constraint, pe_working_set_t *data_set); void clone_rsc_colocation_rh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, - pcmk__colocation_t *constraint, + rsc_colocation_t *constraint, pe_working_set_t *data_set); void clone_rsc_location(pe_resource_t *rsc, pe__location_t *constraint); extern enum pe_action_flags clone_action_flags(pe_action_t * action, pe_node_t * node); @@ -133,7 +133,7 @@ void create_promotable_actions(pe_resource_t *rsc, pe_working_set_t *data_set); void promote_demote_constraints(pe_resource_t *rsc, pe_working_set_t *data_set); void promotable_constraints(pe_resource_t *rsc, pe_working_set_t *data_set); void promotable_colocation_rh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, - pcmk__colocation_t *constraint, + rsc_colocation_t *constraint, pe_working_set_t *data_set); /* extern resource_object_functions_t resource_variants[]; */ @@ -141,6 +141,10 @@ extern resource_alloc_functions_t resource_class_alloc_functions[]; extern gboolean unpack_rsc_order(xmlNode * xml_obj, pe_working_set_t * data_set); +extern gboolean unpack_rsc_colocation(xmlNode * xml_obj, pe_working_set_t * data_set); + +extern gboolean unpack_location(xmlNode * xml_obj, pe_working_set_t * data_set); + extern gboolean unpack_rsc_ticket(xmlNode * xml_obj, pe_working_set_t * data_set); void LogNodeActions(pe_working_set_t * data_set, gboolean terminal); diff --git a/include/pcmki/pcmki_sched_utils.h b/include/pcmki/pcmki_sched_utils.h index f6ac263..f2318c5 100644 --- a/include/pcmki/pcmki_sched_utils.h +++ b/include/pcmki/pcmki_sched_utils.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2021 the Pacemaker project contributors + * Copyright 2004-2019 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -20,7 +20,7 @@ #include /* Constraint helper functions */ -pcmk__colocation_t *invert_constraint(pcmk__colocation_t *constraint); +extern rsc_colocation_t *invert_constraint(rsc_colocation_t * constraint); pe__location_t *copy_constraint(pe__location_t *constraint); @@ -28,10 +28,10 @@ pe__location_t *rsc2node_new(const char *id, pe_resource_t *rsc, int weight, const char *discovery_mode, pe_node_t *node, pe_working_set_t *data_set); -void pcmk__new_colocation(const char *id, const char *node_attr, int score, - pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, - const char *state_lh, const char *state_rh, - bool influence, pe_working_set_t *data_set); +extern gboolean rsc_colocation_new(const char *id, const char *node_attr, int score, + pe_resource_t * rsc_lh, pe_resource_t * rsc_rh, + const char *state_lh, const char *state_rh, + pe_working_set_t * data_set); extern gboolean rsc_ticket_new(const char *id, pe_resource_t * rsc_lh, pe_ticket_t * ticket, const char *state_lh, const char *loss_policy, @@ -71,7 +71,7 @@ enum filter_colocation_res { extern enum filter_colocation_res filter_colocation_constraint(pe_resource_t * rsc_lh, pe_resource_t * rsc_rh, - pcmk__colocation_t *constraint, gboolean preview); + rsc_colocation_t * constraint, gboolean preview); extern int compare_capacity(const pe_node_t * node1, const pe_node_t * node2); extern void calculate_utilization(GHashTable * current_utilization, diff --git a/include/pcmki/pcmki_scheduler.h b/include/pcmki/pcmki_scheduler.h index f2f3d5b..342d57a 100644 --- a/include/pcmki/pcmki_scheduler.h +++ b/include/pcmki/pcmki_scheduler.h @@ -1,5 +1,5 @@ /* - * Copyright 2014-2021 the Pacemaker project contributors + * Copyright 2014-2020 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -10,6 +10,7 @@ #ifndef PENGINE__H # define PENGINE__H +typedef struct rsc_colocation_s rsc_colocation_t; typedef struct rsc_ticket_s rsc_ticket_t; typedef struct lrm_agent_s lrm_agent_t; @@ -36,7 +37,7 @@ enum pe_weights { pe_weights_rollback = 0x10, }; -typedef struct { +struct rsc_colocation_s { const char *id; const char *node_attribute; pe_resource_t *rsc_lh; @@ -46,8 +47,7 @@ typedef struct { int role_rh; int score; - bool influence; // Whether rsc_lh should influence active rsc_rh placement -} pcmk__colocation_t; +}; enum loss_ticket_policy_e { loss_ticket_stop, @@ -107,30 +107,4 @@ extern gboolean show_scores; extern gboolean show_utilization; extern const char *transition_idle_timeout; -/*! - * \internal - * \brief Check whether colocation's left-hand preferences should be considered - * - * \param[in] colocation Colocation constraint - * \param[in] rsc Right-hand instance (normally this will be - * colocation->rsc_rh, which NULL will be treated as, - * but for clones or bundles with multiple instances - * this can be a particular instance) - * - * \return true if colocation influence should be effective, otherwise false - */ -static inline bool -pcmk__colocation_has_influence(const pcmk__colocation_t *colocation, - const pe_resource_t *rsc) -{ - if (rsc == NULL) { - rsc = colocation->rsc_rh; - } - - /* The left hand of a colocation influences the right hand's location - * if the influence option is true, or the right hand is not yet active. - */ - return colocation->influence || (rsc->running_on == NULL); -} - #endif diff --git a/lib/common/agents.c b/lib/common/agents.c index 0291b0b..1ee55ac 100644 --- a/lib/common/agents.c +++ b/lib/common/agents.c @@ -171,42 +171,3 @@ crm_provider_required(const char *standard) { return pcmk_is_set(pcmk_get_ra_caps(standard), pcmk_ra_cap_provider); } - -/*! - * \brief Check whether a given stonith parameter is handled by Pacemaker - * - * Return true if a given string is the name of one of the special resource - * instance attributes interpreted directly by Pacemaker for stonith-class - * resources. - * - * \param[in] param Parameter name to check - * - * \return true if \p param is a special fencing parameter - */ -bool -pcmk_stonith_param(const char *param) -{ - if (param == NULL) { - return false; - } - if (pcmk__str_any_of(param, PCMK_STONITH_PROVIDES, - PCMK_STONITH_STONITH_TIMEOUT, NULL)) { - return true; - } - if (!pcmk__starts_with(param, "pcmk_")) { // Short-circuit common case - return false; - } - if (pcmk__str_any_of(param, - PCMK_STONITH_ACTION_LIMIT, - PCMK_STONITH_DELAY_BASE, - PCMK_STONITH_DELAY_MAX, - PCMK_STONITH_HOST_ARGUMENT, - PCMK_STONITH_HOST_CHECK, - PCMK_STONITH_HOST_LIST, - PCMK_STONITH_HOST_MAP, - NULL)) { - return true; - } - param = strchr(param + 5, '_'); // Skip past "pcmk_ACTION" - return pcmk__str_any_of(param, "_action", "_timeout", "_retries", NULL); -} diff --git a/lib/common/cmdline.c b/lib/common/cmdline.c index 66f1976..d66ccc7 100644 --- a/lib/common/cmdline.c +++ b/lib/common/cmdline.c @@ -203,7 +203,7 @@ pcmk__cmdline_preproc(char **argv, const char *special) { * glib does not. Grab both the argument and its value and * separate them into a new argument. */ - if (special != NULL && strchr(special, *ch) != NULL) { + if (strchr(special, *ch) != NULL) { /* The argument does not occur at the end of this string of * arguments. Take everything through the end as its value. */ diff --git a/lib/common/crmcommon_private.h b/lib/common/crmcommon_private.h index 4c365ed..8cf4ed0 100644 --- a/lib/common/crmcommon_private.h +++ b/lib/common/crmcommon_private.h @@ -141,6 +141,12 @@ void pcmk__mark_xml_attr_dirty(xmlAttr *a); G_GNUC_INTERNAL bool pcmk__xa_filterable(const char *name); +static inline xmlAttr * +pcmk__first_xml_attr(const xmlNode *xml) +{ + return xml? xml->properties : NULL; +} + static inline const char * pcmk__xml_attr_value(const xmlAttr *attr) { diff --git a/lib/common/nvpair.c b/lib/common/nvpair.c index 9bd87af..0ed7a7d 100644 --- a/lib/common/nvpair.c +++ b/lib/common/nvpair.c @@ -163,7 +163,7 @@ pcmk_xml_attrs2nvpairs(xmlNode *xml) { GSList *result = NULL; - for (xmlAttrPtr iter = pcmk__xe_first_attr(xml); iter != NULL; + for (xmlAttrPtr iter = pcmk__first_xml_attr(xml); iter != NULL; iter = iter->next) { result = pcmk_prepend_nvpair(result, @@ -925,7 +925,7 @@ xml2list(xmlNode *parent) crm_log_xml_trace(nvpair_list, "Unpacking"); - for (pIter = pcmk__xe_first_attr(nvpair_list); pIter != NULL; + for (pIter = pcmk__first_xml_attr(nvpair_list); pIter != NULL; pIter = pIter->next) { const char *p_name = (const char *)pIter->name; diff --git a/lib/common/operations.c b/lib/common/operations.c index 420f078..7e6bf5a 100644 --- a/lib/common/operations.c +++ b/lib/common/operations.c @@ -1,5 +1,5 @@ /* - * Copyright 2004-2021 the Pacemaker project contributors + * Copyright 2004-2020 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -24,7 +24,6 @@ #include #include #include -#include #include static regex_t *notify_migrate_re = NULL; @@ -362,24 +361,6 @@ decode_transition_key(const char *key, char **uuid, int *transition_id, int *act return TRUE; } -// Return true if a is an attribute that should be filtered -static bool -should_filter_for_digest(xmlAttrPtr a, void *user_data) -{ - if (strncmp((const char *) a->name, CRM_META "_", - sizeof(CRM_META " ") - 1) == 0) { - return true; - } - return pcmk__str_any_of((const char *) a->name, - XML_ATTR_ID, - XML_ATTR_CRM_VERSION, - XML_LRM_ATTR_OP_DIGEST, - XML_LRM_ATTR_TARGET, - XML_LRM_ATTR_TARGET_UUID, - "pcmk_external_ip", - NULL); -} - /*! * \internal * \brief Remove XML attributes not needed for operation digest @@ -393,31 +374,52 @@ pcmk__filter_op_for_digest(xmlNode *param_set) char *timeout = NULL; guint interval_ms = 0; + const char *attr_filter[] = { + XML_ATTR_ID, + XML_ATTR_CRM_VERSION, + XML_LRM_ATTR_OP_DIGEST, + XML_LRM_ATTR_TARGET, + XML_LRM_ATTR_TARGET_UUID, + "pcmk_external_ip" + }; + + const int meta_len = strlen(CRM_META); + if (param_set == NULL) { return; } - /* Timeout is useful for recurring operation digests, so grab it before - * removing meta-attributes - */ + // Remove the specific attributes listed in attr_filter + for (int lpc = 0; lpc < DIMOF(attr_filter); lpc++) { + xml_remove_prop(param_set, attr_filter[lpc]); + } + key = crm_meta_name(XML_LRM_ATTR_INTERVAL_MS); if (crm_element_value_ms(param_set, key, &interval_ms) != pcmk_ok) { interval_ms = 0; } free(key); - key = NULL; - if (interval_ms != 0) { - key = crm_meta_name(XML_ATTR_TIMEOUT); - timeout = crm_element_value_copy(param_set, key); - } - // Remove all CRM_meta_* attributes and certain other attributes - pcmk__xe_remove_matching_attrs(param_set, should_filter_for_digest, NULL); + key = crm_meta_name(XML_ATTR_TIMEOUT); + timeout = crm_element_value_copy(param_set, key); + + // Remove all CRM_meta_* attributes + for (xmlAttrPtr xIter = param_set->properties; xIter != NULL; ) { + const char *prop_name = (const char *) (xIter->name); + + xIter = xIter->next; - // Add timeout back for recurring operation digests - if (timeout != NULL) { + // @TODO Why is this case-insensitive? + if (strncasecmp(prop_name, CRM_META, meta_len) == 0) { + xml_remove_prop(param_set, prop_name); + } + } + + if ((interval_ms != 0) && (timeout != NULL)) { + // Add the timeout back, it's useful for recurring operation digests crm_xml_add(param_set, key, timeout); } + free(timeout); free(key); } diff --git a/lib/common/output_html.c b/lib/common/output_html.c index 542d863..156887d 100644 --- a/lib/common/output_html.c +++ b/lib/common/output_html.c @@ -20,7 +20,6 @@ #include #include #include -#include static const char *stylesheet_default = ".bold { font-weight: bold }\n" @@ -98,11 +97,11 @@ html_init(pcmk__output_t *out) { priv->root = create_xml_node(NULL, "html"); xmlCreateIntSubset(priv->root->doc, (pcmkXmlStr) "html", NULL, NULL); - crm_xml_add(priv->root, "lang", "en"); + xmlSetProp(priv->root, (pcmkXmlStr) "lang", (pcmkXmlStr) "en"); g_queue_push_tail(priv->parent_q, priv->root); priv->errors = NULL; - pcmk__output_xml_create_parent(out, "body", NULL); + pcmk__output_xml_create_parent(out, "body"); return true; } @@ -137,7 +136,7 @@ finish_reset_common(pcmk__output_t *out, crm_exit_t exit_status, bool print) { } charset_node = create_xml_node(head_node, "meta"); - crm_xml_add(charset_node, "charset", "utf-8"); + xmlSetProp(charset_node, (pcmkXmlStr) "charset", (pcmkXmlStr) "utf-8"); /* Add any extra header nodes the caller might have created. */ for (int i = 0; i < g_slist_length(extra_headers); i++) { @@ -154,9 +153,8 @@ finish_reset_common(pcmk__output_t *out, crm_exit_t exit_status, bool print) { if (stylesheet_link != NULL) { htmlNodePtr link_node = create_xml_node(head_node, "link"); - pcmk__xe_set_props(link_node, "rel", "stylesheet", - "href", stylesheet_link, - NULL); + xmlSetProp(link_node, (pcmkXmlStr) "rel", (pcmkXmlStr) "stylesheet"); + xmlSetProp(link_node, (pcmkXmlStr) "href", (pcmkXmlStr) stylesheet_link); } xmlAddPrevSibling(priv->root->children, head_node); @@ -275,7 +273,7 @@ html_output_xml(pcmk__output_t *out, const char *name, const char *buf) { CRM_ASSERT(priv != NULL); node = pcmk__output_create_html_node(out, "pre", NULL, NULL, buf); - crm_xml_add(node, "lang", "xml"); + xmlSetProp(node, (pcmkXmlStr) "lang", (pcmkXmlStr) "xml"); } G_GNUC_PRINTF(4, 5) @@ -294,7 +292,7 @@ html_begin_list(pcmk__output_t *out, const char *singular_noun, */ q_len = g_queue_get_length(priv->parent_q); if (q_len > 2) { - pcmk__output_xml_create_parent(out, "li", NULL); + pcmk__output_xml_create_parent(out, "li"); } if (format != NULL) { @@ -316,7 +314,7 @@ html_begin_list(pcmk__output_t *out, const char *singular_noun, free(buf); } - node = pcmk__output_xml_create_parent(out, "ul", NULL); + node = pcmk__output_xml_create_parent(out, "ul"); g_queue_push_tail(priv->parent_q, node); } @@ -340,7 +338,7 @@ html_list_item(pcmk__output_t *out, const char *name, const char *format, ...) { free(buf); if (name != NULL) { - crm_xml_add(item_node, "class", name); + xmlSetProp(item_node, (pcmkXmlStr) "class", (pcmkXmlStr) name); } } @@ -370,11 +368,6 @@ html_is_quiet(pcmk__output_t *out) { return false; } -static void -html_spacer(pcmk__output_t *out) { - pcmk__output_create_xml_node(out, "br", NULL); -} - pcmk__output_t * pcmk__mk_html_output(char **argv) { pcmk__output_t *retval = calloc(1, sizeof(pcmk__output_t)); @@ -406,7 +399,6 @@ pcmk__mk_html_output(char **argv) { retval->end_list = html_end_list; retval->is_quiet = html_is_quiet; - retval->spacer = html_spacer; return retval; } @@ -417,11 +409,11 @@ pcmk__output_create_html_node(pcmk__output_t *out, const char *element_name, con htmlNodePtr node = pcmk__output_create_xml_text_node(out, element_name, text); if (class_name != NULL) { - crm_xml_add(node, "class", class_name); + xmlSetProp(node, (pcmkXmlStr) "class", (pcmkXmlStr) class_name); } if (id != NULL) { - crm_xml_add(node, "id", id); + xmlSetProp(node, (pcmkXmlStr) "id", (pcmkXmlStr) id); } return node; @@ -444,7 +436,7 @@ pcmk__html_add_header(const char *name, ...) { } value = va_arg(ap, char *); - crm_xml_add(header_node, key, value); + xmlSetProp(header_node, (pcmkXmlStr) key, (pcmkXmlStr) value); } extra_headers = g_slist_append(extra_headers, header_node); diff --git a/lib/common/output_log.c b/lib/common/output_log.c index 6336fa2..fd13c89 100644 --- a/lib/common/output_log.c +++ b/lib/common/output_log.c @@ -226,11 +226,6 @@ log_is_quiet(pcmk__output_t *out) { return false; } -static void -log_spacer(pcmk__output_t *out) { - /* This function intentionally left blank */ -} - pcmk__output_t * pcmk__mk_log_output(char **argv) { pcmk__output_t *retval = calloc(1, sizeof(pcmk__output_t)); @@ -261,7 +256,6 @@ pcmk__mk_log_output(char **argv) { retval->end_list = log_end_list; retval->is_quiet = log_is_quiet; - retval->spacer = log_spacer; return retval; } diff --git a/lib/common/output_text.c b/lib/common/output_text.c index 3432505..9b3c09a 100644 --- a/lib/common/output_text.c +++ b/lib/common/output_text.c @@ -244,11 +244,6 @@ text_is_quiet(pcmk__output_t *out) { return out->quiet; } -static void -text_spacer(pcmk__output_t *out) { - fprintf(out->dest, "\n"); -} - pcmk__output_t * pcmk__mk_text_output(char **argv) { pcmk__output_t *retval = calloc(1, sizeof(pcmk__output_t)); @@ -280,7 +275,6 @@ pcmk__mk_text_output(char **argv) { retval->end_list = text_end_list; retval->is_quiet = text_is_quiet; - retval->spacer = text_spacer; return retval; } diff --git a/lib/common/output_xml.c b/lib/common/output_xml.c index 0053979..9a08d20 100644 --- a/lib/common/output_xml.c +++ b/lib/common/output_xml.c @@ -24,7 +24,6 @@ #include #include -#include #include static gboolean legacy_xml = FALSE; @@ -51,6 +50,7 @@ typedef struct subst_s { } subst_t; static subst_t substitutions[] = { + { "Attributes", "attributes" }, { "Active Resources", "resources" }, { "Full List of Resources", "resources" }, { "Inactive Resources", "resources" }, @@ -61,8 +61,8 @@ static subst_t substitutions[] = { { "Operations", "node_history" }, { "Negative Location Constraints", "bans" }, { "Node Attributes", "node_attributes" }, - { "Resource Config", "resource_config" }, - { "Resource Operations", "operations" }, + { "Resources", "resources" }, + { "Tickets", "tickets" }, { NULL, NULL } }; @@ -107,13 +107,13 @@ xml_init(pcmk__output_t *out) { if (legacy_xml) { priv->root = create_xml_node(NULL, "crm_mon"); - crm_xml_add(priv->root, "version", VERSION); + xmlSetProp(priv->root, (pcmkXmlStr) "version", (pcmkXmlStr) VERSION); } else { priv->root = create_xml_node(NULL, "pacemaker-result"); - crm_xml_add(priv->root, "api-version", PCMK__API_VERSION); + xmlSetProp(priv->root, (pcmkXmlStr) "api-version", (pcmkXmlStr) PCMK__API_VERSION); if (out->request != NULL) { - crm_xml_add(priv->root, "request", out->request); + xmlSetProp(priv->root, (pcmkXmlStr) "request", (pcmkXmlStr) out->request); } } @@ -157,9 +157,8 @@ finish_reset_common(pcmk__output_t *out, crm_exit_t exit_status, bool print) { char *rc_as_str = crm_itoa(exit_status); node = create_xml_node(priv->root, "status"); - pcmk__xe_set_props(node, "code", rc_as_str, - "message", crm_exit_str(exit_status), - NULL); + xmlSetProp(node, (pcmkXmlStr) "code", (pcmkXmlStr) rc_as_str); + xmlSetProp(node, (pcmkXmlStr) "message", (pcmkXmlStr) crm_exit_str(exit_status)); if (g_slist_length(priv->errors) > 0) { xmlNodePtr errors_node = create_xml_node(node, "errors"); @@ -217,18 +216,17 @@ xml_subprocess_output(pcmk__output_t *out, int exit_status, rc_as_str = crm_itoa(exit_status); - node = pcmk__output_xml_create_parent(out, "command", - "code", rc_as_str, - NULL); + node = pcmk__output_xml_create_parent(out, "command"); + xmlSetProp(node, (pcmkXmlStr) "code", (pcmkXmlStr) rc_as_str); if (proc_stdout != NULL) { child_node = pcmk_create_xml_text_node(node, "output", proc_stdout); - crm_xml_add(child_node, "source", "stdout"); + xmlSetProp(child_node, (pcmkXmlStr) "source", (pcmkXmlStr) "stdout"); } if (proc_stderr != NULL) { child_node = pcmk_create_xml_text_node(node, "output", proc_stderr); - crm_xml_add(child_node, "source", "stderr"); + xmlSetProp(child_node, (pcmkXmlStr) "source", (pcmkXmlStr) "stderr"); } pcmk__output_xml_add_node(out, node); @@ -237,16 +235,16 @@ xml_subprocess_output(pcmk__output_t *out, int exit_status, static void xml_version(pcmk__output_t *out, bool extended) { + xmlNodePtr node; private_data_t *priv = out->priv; CRM_ASSERT(priv != NULL); - pcmk__output_create_xml_node(out, "version", - "program", "Pacemaker", - "version", PACEMAKER_VERSION, - "author", "Andrew Beekhof", - "build", BUILD_VERSION, - "features", CRM_FEATURES, - NULL); + node = pcmk__output_create_xml_node(out, "version"); + xmlSetProp(node, (pcmkXmlStr) "program", (pcmkXmlStr) "Pacemaker"); + xmlSetProp(node, (pcmkXmlStr) "version", (pcmkXmlStr) PACEMAKER_VERSION); + xmlSetProp(node, (pcmkXmlStr) "author", (pcmkXmlStr) "Andrew Beekhof"); + xmlSetProp(node, (pcmkXmlStr) "build", (pcmkXmlStr) BUILD_VERSION); + xmlSetProp(node, (pcmkXmlStr) "features", (pcmkXmlStr) CRM_FEATURES); } G_GNUC_PRINTF(2, 3) @@ -280,7 +278,7 @@ xml_output_xml(pcmk__output_t *out, const char *name, const char *buf) { CRM_ASSERT(priv != NULL); - parent = pcmk__output_create_xml_node(out, name, NULL); + parent = pcmk__output_create_xml_node(out, name); cdata_node = xmlNewCDataBlock(getDocPtr(parent), (pcmkXmlStr) buf, strlen(buf)); xmlAddChild(parent, cdata_node); } @@ -290,7 +288,7 @@ static void xml_begin_list(pcmk__output_t *out, const char *singular_noun, const char *plural_noun, const char *format, ...) { va_list ap; - char *name = NULL; + const char *name = NULL; char *buf = NULL; int len; @@ -302,25 +300,25 @@ xml_begin_list(pcmk__output_t *out, const char *singular_noun, const char *plura if (substitute) { for (subst_t *s = substitutions; s->from != NULL; s++) { if (!strcmp(s->from, buf)) { - name = g_strdup(s->to); + name = s->to; break; } } } if (name == NULL) { - name = g_ascii_strdown(buf, -1); + name = buf; } if (legacy_xml || simple_list) { - pcmk__output_xml_create_parent(out, name, NULL); + pcmk__output_xml_create_parent(out, name); } else { - pcmk__output_xml_create_parent(out, "list", - "name", name, - NULL); + xmlNodePtr list_node = NULL; + + list_node = pcmk__output_xml_create_parent(out, "list"); + xmlSetProp(list_node, (pcmkXmlStr) "name", (pcmkXmlStr) name); } - g_free(name); free(buf); } @@ -343,7 +341,7 @@ xml_list_item(pcmk__output_t *out, const char *name, const char *format, ...) { item_node = pcmk__output_create_xml_text_node(out, "item", buf); if (name != NULL) { - crm_xml_add(item_node, "name", name); + xmlSetProp(item_node, (pcmkXmlStr) "name", (pcmkXmlStr) name); } free(buf); @@ -368,7 +366,7 @@ xml_end_list(pcmk__output_t *out) { node = g_queue_pop_tail(priv->parent_q); buf = crm_strdup_printf("%lu", xmlChildElementCount(node)); - crm_xml_add(node, "count", buf); + xmlSetProp(node, (pcmkXmlStr) "count", (pcmkXmlStr) buf); free(buf); } } @@ -378,11 +376,6 @@ xml_is_quiet(pcmk__output_t *out) { return false; } -static void -xml_spacer(pcmk__output_t *out) { - /* This function intentionally left blank */ -} - pcmk__output_t * pcmk__mk_xml_output(char **argv) { pcmk__output_t *retval = calloc(1, sizeof(pcmk__output_t)); @@ -414,20 +407,13 @@ pcmk__mk_xml_output(char **argv) { retval->end_list = xml_end_list; retval->is_quiet = xml_is_quiet; - retval->spacer = xml_spacer; return retval; } xmlNodePtr -pcmk__output_xml_create_parent(pcmk__output_t *out, const char *name, ...) { - va_list args; - xmlNodePtr node = pcmk__output_create_xml_node(out, name, NULL); - - va_start(args, name); - pcmk__xe_set_propv(node, args); - va_end(args); - +pcmk__output_xml_create_parent(pcmk__output_t *out, const char *name) { + xmlNodePtr node = pcmk__output_create_xml_node(out, name); pcmk__output_xml_push_parent(out, node); return node; } @@ -443,24 +429,17 @@ pcmk__output_xml_add_node(pcmk__output_t *out, xmlNodePtr node) { } xmlNodePtr -pcmk__output_create_xml_node(pcmk__output_t *out, const char *name, ...) { - xmlNodePtr node = NULL; +pcmk__output_create_xml_node(pcmk__output_t *out, const char *name) { private_data_t *priv = out->priv; - va_list args; CRM_ASSERT(priv != NULL); - node = create_xml_node(g_queue_peek_tail(priv->parent_q), name); - va_start(args, name); - pcmk__xe_set_propv(node, args); - va_end(args); - - return node; + return create_xml_node(g_queue_peek_tail(priv->parent_q), name); } xmlNodePtr pcmk__output_create_xml_text_node(pcmk__output_t *out, const char *name, const char *content) { - xmlNodePtr node = pcmk__output_create_xml_node(out, name, NULL); + xmlNodePtr node = pcmk__output_create_xml_node(out, name); xmlNodeSetContent(node, (pcmkXmlStr) content); return node; } diff --git a/lib/common/patchset.c b/lib/common/patchset.c index 46d136a..f3dab03 100644 --- a/lib/common/patchset.c +++ b/lib/common/patchset.c @@ -112,7 +112,7 @@ add_xml_changes_to_patchset(xmlNode *xml, xmlNode *patchset) } // Check each of the XML node's attributes for changes - for (pIter = pcmk__xe_first_attr(xml); pIter != NULL; + for (pIter = pcmk__first_xml_attr(xml); pIter != NULL; pIter = pIter->next) { xmlNode *attr = NULL; @@ -156,7 +156,7 @@ add_xml_changes_to_patchset(xmlNode *xml, xmlNode *patchset) change = create_xml_node(change->parent, XML_DIFF_RESULT); result = create_xml_node(change, (const char *)xml->name); - for (pIter = pcmk__xe_first_attr(xml); pIter != NULL; + for (pIter = pcmk__first_xml_attr(xml); pIter != NULL; pIter = pIter->next) { p = pIter->_private; if (!pcmk_is_set(p->flags, xpf_deleted)) { @@ -279,10 +279,15 @@ xml_repair_v1_diff(xmlNode *last, xmlNode *next, xmlNode *local_diff, crm_xml_add(diff_child, vfields[lpc], value); } - for (xmlAttrPtr a = pcmk__xe_first_attr(next); a != NULL; a = a->next) { - const char *p_value = crm_element_value(next, (const char *) a->name); + if (next) { + xmlAttrPtr xIter = NULL; - xmlSetProp(cib, a->name, (pcmkXmlStr) p_value); + for (xIter = next->properties; xIter; xIter = xIter->next) { + const char *p_name = (const char *) xIter->name; + const char *p_value = crm_element_value(next, p_name); + + xmlSetProp(cib, (pcmkXmlStr) p_name, (pcmkXmlStr) p_value); + } } crm_log_xml_explicit(local_diff, "Repaired-diff"); @@ -633,19 +638,13 @@ xml_log_patchset(uint8_t log_level, const char *function, xmlNode *patchset) } } -// Return true if attribute name is not "id" -static bool -not_id(xmlAttrPtr attr, void *user_data) -{ - return strcmp((const char *) attr->name, XML_ATTR_ID) != 0; -} - // Apply the removals section of an v1 patchset to an XML node static void process_v1_removals(xmlNode *target, xmlNode *patch) { xmlNode *patch_child = NULL; xmlNode *cIter = NULL; + xmlAttrPtr xIter = NULL; char *id = NULL; const char *name = NULL; @@ -678,8 +677,15 @@ process_v1_removals(xmlNode *target, xmlNode *patch) return; } - // Removing then restoring id would change ordering of properties - pcmk__xe_remove_matching_attrs(patch, not_id, NULL); + for (xIter = pcmk__first_xml_attr(patch); xIter != NULL; + xIter = xIter->next) { + const char *p_name = (const char *)xIter->name; + + // Removing then restoring id would change ordering of properties + if (!pcmk__str_eq(p_name, XML_ATTR_ID, pcmk__str_casei)) { + xml_remove_prop(target, p_name); + } + } // Changes to child objects cIter = pcmk__xml_first_child(target); @@ -739,7 +745,7 @@ process_v1_additions(xmlNode *parent, xmlNode *target, xmlNode *patch) return); CRM_CHECK(pcmk__str_eq(ID(target), ID(patch), pcmk__str_casei), return); - for (xIter = pcmk__xe_first_attr(patch); xIter != NULL; + for (xIter = pcmk__first_xml_attr(patch); xIter != NULL; xIter = xIter->next) { const char *p_name = (const char *) xIter->name; const char *p_value = crm_element_value(patch, p_name); @@ -1198,6 +1204,7 @@ apply_v2_patchset(xmlNode *xml, xmlNode *patchset) free_xml(match); } else if (strcmp(op, "modify") == 0) { + xmlAttr *pIter = pcmk__first_xml_attr(match); xmlNode *attrs = NULL; attrs = pcmk__xml_first_child(first_named_child(change, @@ -1206,9 +1213,14 @@ apply_v2_patchset(xmlNode *xml, xmlNode *patchset) rc = ENOMSG; continue; } - pcmk__xe_remove_matching_attrs(match, NULL, NULL); // Remove all + while (pIter != NULL) { + const char *name = (const char *)pIter->name; + + pIter = pIter->next; + xml_remove_prop(match, name); + } - for (xmlAttrPtr pIter = pcmk__xe_first_attr(attrs); pIter != NULL; + for (pIter = pcmk__first_xml_attr(attrs); pIter != NULL; pIter = pIter->next) { const char *name = (const char *) pIter->name; const char *value = crm_element_value(attrs, name); @@ -1541,7 +1553,7 @@ subtract_xml_object(xmlNode *parent, xmlNode *left, xmlNode *right, } else if (full) { xmlAttrPtr pIter = NULL; - for (pIter = pcmk__xe_first_attr(left); pIter != NULL; + for (pIter = pcmk__first_xml_attr(left); pIter != NULL; pIter = pIter->next) { const char *p_name = (const char *)pIter->name; const char *p_value = pcmk__xml_attr_value(pIter); @@ -1554,7 +1566,7 @@ subtract_xml_object(xmlNode *parent, xmlNode *left, xmlNode *right, } // Changes to name/value pairs - for (xIter = pcmk__xe_first_attr(left); xIter != NULL; + for (xIter = pcmk__first_xml_attr(left); xIter != NULL; xIter = xIter->next) { const char *prop_name = (const char *) xIter->name; xmlAttrPtr right_attr = NULL; @@ -1582,7 +1594,7 @@ subtract_xml_object(xmlNode *parent, xmlNode *left, xmlNode *right, if (full) { xmlAttrPtr pIter = NULL; - for (pIter = pcmk__xe_first_attr(left); pIter != NULL; + for (pIter = pcmk__first_xml_attr(left); pIter != NULL; pIter = pIter->next) { const char *p_name = (const char *) pIter->name; const char *p_value = pcmk__xml_attr_value(pIter); @@ -1612,7 +1624,7 @@ subtract_xml_object(xmlNode *parent, xmlNode *left, xmlNode *right, crm_trace("Changes detected to %s in <%s id=%s>", prop_name, crm_element_name(left), id); - for (pIter = pcmk__xe_first_attr(left); pIter != NULL; + for (pIter = pcmk__first_xml_attr(left); pIter != NULL; pIter = pIter->next) { const char *p_name = (const char *) pIter->name; const char *p_value = pcmk__xml_attr_value(pIter); diff --git a/lib/common/tests/Makefile.am b/lib/common/tests/Makefile.am index 2c33cc5..33c45cb 100644 --- a/lib/common/tests/Makefile.am +++ b/lib/common/tests/Makefile.am @@ -1 +1 @@ -SUBDIRS = agents cmdline flags operations strings utils +SUBDIRS = flags operations strings utils diff --git a/lib/common/tests/agents/Makefile.am b/lib/common/tests/agents/Makefile.am deleted file mode 100644 index 40cb5f7..0000000 --- a/lib/common/tests/agents/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ -# -# Copyright 2020 the Pacemaker project contributors -# -# The version control history for this file may have further details. -# -# This source code is licensed under the GNU General Public License version 2 -# or later (GPLv2+) WITHOUT ANY WARRANTY. -# -AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include -LDADD = $(top_builddir)/lib/common/libcrmcommon.la - -include $(top_srcdir)/mk/glib-tap.mk - -# Add each test program here. Each test should be written as a little standalone -# program using the glib unit testing functions. See the documentation for more -# information. -# -# https://developer.gnome.org/glib/unstable/glib-Testing.html -# -# Add "_test" to the end of all test program names to simplify .gitignore. -test_programs = pcmk_stonith_param_test - -# If any extra data needs to be added to the source distribution, add it to the -# following list. -dist_test_data = - -# If any extra data needs to be used by tests but should not be added to the -# source distribution, add it to the following list. -test_data = diff --git a/lib/common/tests/agents/pcmk_stonith_param_test.c b/lib/common/tests/agents/pcmk_stonith_param_test.c deleted file mode 100644 index bf509e9..0000000 --- a/lib/common/tests/agents/pcmk_stonith_param_test.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2020 the Pacemaker project contributors - * - * The version control history for this file may have further details. - * - * This source code is licensed under the GNU Lesser General Public License - * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. - */ - -#include - -#include -#include - -static void -is_stonith_param(void) -{ - g_assert_cmpint(pcmk_stonith_param(NULL), ==, false); - g_assert_cmpint(pcmk_stonith_param(""), ==, false); - g_assert_cmpint(pcmk_stonith_param("unrecognized"), ==, false); - g_assert_cmpint(pcmk_stonith_param("pcmk_unrecognized"), ==, false); - g_assert_cmpint(pcmk_stonith_param("x" PCMK_STONITH_ACTION_LIMIT), ==, false); - g_assert_cmpint(pcmk_stonith_param(PCMK_STONITH_ACTION_LIMIT "x"), ==, false); - - g_assert_cmpint(pcmk_stonith_param(PCMK_STONITH_ACTION_LIMIT), ==, true); - g_assert_cmpint(pcmk_stonith_param(PCMK_STONITH_DELAY_BASE), ==, true); - g_assert_cmpint(pcmk_stonith_param(PCMK_STONITH_DELAY_MAX), ==, true); - g_assert_cmpint(pcmk_stonith_param(PCMK_STONITH_HOST_ARGUMENT), ==, true); - g_assert_cmpint(pcmk_stonith_param(PCMK_STONITH_HOST_CHECK), ==, true); - g_assert_cmpint(pcmk_stonith_param(PCMK_STONITH_HOST_LIST), ==, true); - g_assert_cmpint(pcmk_stonith_param(PCMK_STONITH_HOST_MAP), ==, true); - g_assert_cmpint(pcmk_stonith_param(PCMK_STONITH_PROVIDES), ==, true); - g_assert_cmpint(pcmk_stonith_param(PCMK_STONITH_STONITH_TIMEOUT), ==, true); -} - -static void -is_stonith_action_param(void) -{ - /* Currently, the function accepts any string not containing underbars as - * the action name, so we do not need to verify particular action names. - */ - g_assert_cmpint(pcmk_stonith_param("pcmk_on_unrecognized"), ==, false); - g_assert_cmpint(pcmk_stonith_param("pcmk_on_action"), ==, true); - g_assert_cmpint(pcmk_stonith_param("pcmk_on_timeout"), ==, true); - g_assert_cmpint(pcmk_stonith_param("pcmk_on_retries"), ==, true); -} - -int -main(int argc, char **argv) -{ - g_test_init(&argc, &argv, NULL); - - g_test_add_func("/common/utils/parse_op_key/is_stonith_param", - is_stonith_param); - g_test_add_func("/common/utils/parse_op_key/is_stonith_action_param", - is_stonith_action_param); - return g_test_run(); -} diff --git a/lib/common/tests/cmdline/Makefile.am b/lib/common/tests/cmdline/Makefile.am deleted file mode 100644 index e69ef21..0000000 --- a/lib/common/tests/cmdline/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ -# -# Copyright 2020 the Pacemaker project contributors -# -# The version control history for this file may have further details. -# -# This source code is licensed under the GNU General Public License version 2 -# or later (GPLv2+) WITHOUT ANY WARRANTY. -# -AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include -LDADD = $(top_builddir)/lib/common/libcrmcommon.la - -include $(top_srcdir)/mk/glib-tap.mk - -# Add each test program here. Each test should be written as a little standalone -# program using the glib unit testing functions. See the documentation for more -# information. -# -# https://developer.gnome.org/glib/unstable/glib-Testing.html -# -# Add "_test" to the end of all test program names to simplify .gitignore. -test_programs = pcmk__cmdline_preproc_test - -# If any extra data needs to be added to the source distribution, add it to the -# following list. -dist_test_data = - -# If any extra data needs to be used by tests but should not be added to the -# source distribution, add it to the following list. -test_data = diff --git a/lib/common/tests/cmdline/pcmk__cmdline_preproc_test.c b/lib/common/tests/cmdline/pcmk__cmdline_preproc_test.c deleted file mode 100644 index e13c983..0000000 --- a/lib/common/tests/cmdline/pcmk__cmdline_preproc_test.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2020 the Pacemaker project contributors - * - * The version control history for this file may have further details. - * - * This source code is licensed under the GNU Lesser General Public License - * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. - */ - -#include -#include - -#define LISTS_EQ(a, b) { \ - g_assert_cmpint(g_strv_length((gchar **) (a)), ==, g_strv_length((gchar **) (b))); \ - for (int i = 0; i < g_strv_length((a)); i++) { \ - g_assert_cmpstr((a)[i], ==, (b)[i]); \ - } \ -} - -static void -empty_input(void) { - g_assert_cmpint(pcmk__cmdline_preproc(NULL, "") == NULL, ==, TRUE); -} - -static void -no_specials(void) { - const char *argv[] = { "-a", "-b", "-c", "-d", NULL }; - const gchar *expected[] = { "-a", "-b", "-c", "-d", NULL }; - - gchar **processed = pcmk__cmdline_preproc((char **) argv, NULL); - LISTS_EQ(processed, expected); - g_strfreev(processed); - - processed = pcmk__cmdline_preproc((char **) argv, ""); - LISTS_EQ(processed, expected); - g_strfreev(processed); -} - -static void -single_dash(void) { - const char *argv[] = { "-", NULL }; - const gchar *expected[] = { "-", NULL }; - - gchar **processed = pcmk__cmdline_preproc((char **) argv, NULL); - LISTS_EQ(processed, expected); - g_strfreev(processed); -} - -static void -double_dash(void) { - const char *argv[] = { "-a", "--", "-bc", NULL }; - const gchar *expected[] = { "-a", "--", "-bc", NULL }; - - gchar **processed = pcmk__cmdline_preproc((char **) argv, NULL); - LISTS_EQ(processed, expected); - g_strfreev(processed); -} - -static void -special_args(void) { - const char *argv[] = { "-aX", "-Fval", NULL }; - const gchar *expected[] = { "-a", "X", "-F", "val", NULL }; - - gchar **processed = pcmk__cmdline_preproc((char **) argv, "aF"); - LISTS_EQ(processed, expected); - g_strfreev(processed); -} - -static void -special_arg_at_end(void) { - const char *argv[] = { "-a", NULL }; - const gchar *expected[] = { "-a", NULL }; - - gchar **processed = pcmk__cmdline_preproc((char **) argv, "a"); - LISTS_EQ(processed, expected); - g_strfreev(processed); -} - -static void -long_arg(void) { - const char *argv[] = { "--blah=foo", NULL }; - const gchar *expected[] = { "--blah=foo", NULL }; - - gchar **processed = pcmk__cmdline_preproc((char **) argv, NULL); - LISTS_EQ(processed, expected); - g_strfreev(processed); -} - -int -main(int argc, char **argv) -{ - g_test_init(&argc, &argv, NULL); - - g_test_add_func("/common/cmdline/preproc/empty_input", empty_input); - g_test_add_func("/common/cmdline/preproc/no_specials", no_specials); - g_test_add_func("/common/cmdline/preproc/single_dash", single_dash); - g_test_add_func("/common/cmdline/preproc/double_dash", double_dash); - g_test_add_func("/common/cmdline/preproc/special_args", special_args); - g_test_add_func("/common/cmdline/preproc/special_arg_at_end", special_arg_at_end); - g_test_add_func("/common/cmdline/preproc/long_arg", long_arg); - return g_test_run(); -} diff --git a/lib/common/watchdog.c b/lib/common/watchdog.c index bf5df18..03ee7f1 100644 --- a/lib/common/watchdog.c +++ b/lib/common/watchdog.c @@ -244,16 +244,12 @@ pcmk__get_sbd_timeout(void) bool pcmk__get_sbd_sync_resource_startup(void) { - static bool sync_resource_startup = true; // default overruled by env + static bool sync_resource_startup = false; static bool checked_sync_resource_startup = false; if (!checked_sync_resource_startup) { - gboolean ret = FALSE; - const char *s = getenv("SBD_SYNC_RESOURCE_STARTUP"); - - if ((s != NULL) && (crm_str_to_boolean(s, &ret) > 0)) { - sync_resource_startup = ret; - } + sync_resource_startup = + crm_is_true(getenv("SBD_SYNC_RESOURCE_STARTUP")); checked_sync_resource_startup = true; } diff --git a/lib/common/xml.c b/lib/common/xml.c index 8b71911..bed6854 100644 --- a/lib/common/xml.c +++ b/lib/common/xml.c @@ -1,5 +1,5 @@ /* - * Copyright 2004-2021 the Pacemaker project contributors + * Copyright 2004-2020 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -328,31 +328,32 @@ pcmk__xml_position(xmlNode *xml, enum xml_private_flags ignore_if_set) return position; } -// This also clears attribute's flags if not marked as deleted -static bool -marked_as_deleted(xmlAttrPtr a, void *user_data) -{ - xml_private_t *p = a->_private; - - if (pcmk_is_set(p->flags, xpf_deleted)) { - return true; - } - p->flags = xpf_none; - return false; -} - // Remove all attributes marked as deleted from an XML node static void accept_attr_deletions(xmlNode *xml) { - // Clear XML node's flags - ((xml_private_t *) xml->_private)->flags = xpf_none; + xmlNode *cIter = NULL; + xmlAttr *pIter = NULL; + xml_private_t *p = xml->_private; + + p->flags = xpf_none; + pIter = pcmk__first_xml_attr(xml); + + while (pIter != NULL) { + const xmlChar *name = pIter->name; + + p = pIter->_private; + pIter = pIter->next; + + if(p->flags & xpf_deleted) { + xml_remove_prop(xml, (const char *)name); - // Remove this XML node's attributes that were marked as deleted - pcmk__xe_remove_matching_attrs(xml, marked_as_deleted, NULL); + } else { + p->flags = xpf_none; + } + } - // Recursively do the same for this XML node's children - for (xmlNodePtr cIter = pcmk__xml_first_child(xml); cIter != NULL; + for (cIter = pcmk__xml_first_child(xml); cIter != NULL; cIter = pcmk__xml_next(cIter)) { accept_attr_deletions(cIter); } @@ -527,9 +528,11 @@ copy_in_properties(xmlNode * target, xmlNode * src) crm_err("No node to copy properties into"); } else { - for (xmlAttrPtr a = pcmk__xe_first_attr(src); a != NULL; a = a->next) { - const char *p_name = (const char *) a->name; - const char *p_value = pcmk__xml_attr_value(a); + xmlAttrPtr pIter = NULL; + + for (pIter = pcmk__first_xml_attr(src); pIter != NULL; pIter = pIter->next) { + const char *p_name = (const char *)pIter->name; + const char *p_value = pcmk__xml_attr_value(pIter); expand_plus_plus(target, p_name, p_value); } @@ -543,10 +546,11 @@ fix_plus_plus_recursive(xmlNode * target) { /* TODO: Remove recursion and use xpath searches for value++ */ xmlNode *child = NULL; + xmlAttrPtr pIter = NULL; - for (xmlAttrPtr a = pcmk__xe_first_attr(target); a != NULL; a = a->next) { - const char *p_name = (const char *) a->name; - const char *p_value = pcmk__xml_attr_value(a); + for (pIter = pcmk__first_xml_attr(target); pIter != NULL; pIter = pIter->next) { + const char *p_name = (const char *)pIter->name; + const char *p_value = pcmk__xml_attr_value(pIter); expand_plus_plus(target, p_name, p_value); } @@ -617,43 +621,6 @@ expand_plus_plus(xmlNode * target, const char *name, const char *value) return; } -/*! - * \internal - * \brief Remove an XML element's attributes that match some criteria - * - * \param[in,out] element XML element to modify - * \param[in] match If not NULL, only remove attributes for which - * this function returns true - * \param[in] user_data Data to pass to \p match - */ -void -pcmk__xe_remove_matching_attrs(xmlNode *element, - bool (*match)(xmlAttrPtr, void *), - void *user_data) -{ - xmlAttrPtr next = NULL; - - for (xmlAttrPtr a = pcmk__xe_first_attr(element); a != NULL; a = next) { - next = a->next; // Grab now because attribute might get removed - if ((match == NULL) || match(a, user_data)) { - if (!pcmk__check_acl(element, NULL, xpf_acl_write)) { - crm_trace("ACLs prevent removal of attributes (%s and " - "possibly others) from %s element", - (const char *) a->name, (const char *) element->name); - return; // ACLs apply to element, not particular attributes - } - - if (pcmk__tracking_xml_changes(element, false)) { - // Leave (marked for removal) until after diff is calculated - set_parent_flag(element, xpf_dirty); - pcmk__set_xml_flags((xml_private_t *) a->_private, xpf_deleted); - } else { - xmlRemoveProp(a); - } - } - } -} - xmlDoc * getDocPtr(xmlNode * node) { @@ -736,11 +703,11 @@ pcmk_create_html_node(xmlNode * parent, const char *element_name, const char *id xmlNode *node = pcmk_create_xml_text_node(parent, element_name, text); if (class_name != NULL) { - crm_xml_add(node, "class", class_name); + xmlSetProp(node, (pcmkXmlStr) "class", (pcmkXmlStr) class_name); } if (id != NULL) { - crm_xml_add(node, "id", id); + xmlSetProp(node, (pcmkXmlStr) "id", (pcmkXmlStr) id); } return node; @@ -1462,6 +1429,7 @@ pcmk__xe_log(int log_level, const char *file, const char *function, int line, const char *hidden = NULL; xmlNode *child = NULL; + xmlAttrPtr pIter = NULL; if ((data == NULL) || (log_level == LOG_NEVER)) { return; @@ -1481,12 +1449,10 @@ pcmk__xe_log(int log_level, const char *file, const char *function, int line, buffer_print(buffer, max, offset, "<%s", name); hidden = crm_element_value(data, "hidden"); - for (xmlAttrPtr a = pcmk__xe_first_attr(data); a != NULL; - a = a->next) { - - xml_private_t *p = a->_private; - const char *p_name = (const char *) a->name; - const char *p_value = pcmk__xml_attr_value(a); + for (pIter = pcmk__first_xml_attr(data); pIter != NULL; pIter = pIter->next) { + xml_private_t *p = pIter->_private; + const char *p_name = (const char *)pIter->name; + const char *p_value = pcmk__xml_attr_value(pIter); char *p_copy = NULL; if (pcmk_is_set(p->flags, xpf_deleted)) { @@ -1560,6 +1526,7 @@ log_xml_changes(int log_level, const char *file, const char *function, int line, xml_private_t *p; char *prefix_m = NULL; xmlNode *child = NULL; + xmlAttrPtr pIter = NULL; if ((data == NULL) || (log_level == LOG_NEVER)) { return; @@ -1599,10 +1566,10 @@ log_xml_changes(int log_level, const char *file, const char *function, int line, pcmk__xe_log(log_level, file, function, line, flags, data, depth, options|xml_log_option_open); - for (xmlAttrPtr a = pcmk__xe_first_attr(data); a != NULL; a = a->next) { - const char *aname = (const char*) a->name; + for (pIter = pcmk__first_xml_attr(data); pIter != NULL; pIter = pIter->next) { + const char *aname = (const char*)pIter->name; - p = a->_private; + p = pIter->_private; if (pcmk_is_set(p->flags, xpf_deleted)) { const char *value = crm_element_value(data, aname); flags = prefix_del; @@ -1717,9 +1684,11 @@ log_data_element(int log_level, const char *file, const char *function, int line static void dump_filtered_xml(xmlNode * data, int options, char **buffer, int *offset, int *max) { - for (xmlAttrPtr a = pcmk__xe_first_attr(data); a != NULL; a = a->next) { - if (!pcmk__xa_filterable((const char *) (a->name))) { - dump_xml_attr(a, options, buffer, offset, max); + xmlAttrPtr xIter = NULL; + + for (xIter = pcmk__first_xml_attr(data); xIter != NULL; xIter = xIter->next) { + if (!pcmk__xa_filterable((const char *) (xIter->name))) { + dump_xml_attr(xIter, options, buffer, offset, max); } } } @@ -1753,8 +1722,10 @@ dump_xml_element(xmlNode * data, int options, char **buffer, int *offset, int *m dump_filtered_xml(data, options, buffer, offset, max); } else { - for (xmlAttrPtr a = pcmk__xe_first_attr(data); a != NULL; a = a->next) { - dump_xml_attr(a, options, buffer, offset, max); + xmlAttrPtr xIter = NULL; + + for (xIter = pcmk__first_xml_attr(data); xIter != NULL; xIter = xIter->next) { + dump_xml_attr(xIter, options, buffer, offset, max); } } @@ -2091,7 +2062,7 @@ save_xml_to_file(xmlNode * xml, const char *desc, const char *filename) static void set_attrs_flag(xmlNode *xml, enum xml_private_flags flag) { - for (xmlAttr *attr = pcmk__xe_first_attr(xml); attr; attr = attr->next) { + for (xmlAttr *attr = pcmk__first_xml_attr(xml); attr; attr = attr->next) { pcmk__set_xml_flags((xml_private_t *) (attr->_private), flag); } } @@ -2181,7 +2152,7 @@ mark_attr_moved(xmlNode *new_xml, const char *element, xmlAttr *old_attr, static void xml_diff_old_attrs(xmlNode *old_xml, xmlNode *new_xml) { - xmlAttr *attr_iter = pcmk__xe_first_attr(old_xml); + xmlAttr *attr_iter = pcmk__first_xml_attr(old_xml); while (attr_iter != NULL) { xmlAttr *old_attr = attr_iter; @@ -2223,7 +2194,7 @@ xml_diff_old_attrs(xmlNode *old_xml, xmlNode *new_xml) static void mark_created_attrs(xmlNode *new_xml) { - xmlAttr *attr_iter = pcmk__xe_first_attr(new_xml); + xmlAttr *attr_iter = pcmk__first_xml_attr(new_xml); while (attr_iter != NULL) { xmlAttr *new_attr = attr_iter; @@ -2400,6 +2371,7 @@ gboolean can_prune_leaf(xmlNode * xml_node) { xmlNode *cIter = NULL; + xmlAttrPtr pIter = NULL; gboolean can_prune = TRUE; const char *name = crm_element_name(xml_node); @@ -2408,8 +2380,8 @@ can_prune_leaf(xmlNode * xml_node) return FALSE; } - for (xmlAttrPtr a = pcmk__xe_first_attr(xml_node); a != NULL; a = a->next) { - const char *p_name = (const char *) a->name; + for (pIter = pcmk__first_xml_attr(xml_node); pIter != NULL; pIter = pIter->next) { + const char *p_name = (const char *)pIter->name; if (strcmp(p_name, XML_ATTR_ID) == 0) { continue; @@ -2586,13 +2558,15 @@ pcmk__xml_update(xmlNode *parent, xmlNode *target, xmlNode *update, } else { /* No need for expand_plus_plus(), just raw speed */ - for (xmlAttrPtr a = pcmk__xe_first_attr(update); a != NULL; - a = a->next) { - const char *p_value = pcmk__xml_attr_value(a); + xmlAttrPtr pIter = NULL; + + for (pIter = pcmk__first_xml_attr(update); pIter != NULL; pIter = pIter->next) { + const char *p_name = (const char *)pIter->name; + const char *p_value = pcmk__xml_attr_value(pIter); /* Remove it first so the ordering of the update is preserved */ - xmlUnsetProp(target, a->name); - xmlSetProp(target, a->name, (pcmkXmlStr) p_value); + xmlUnsetProp(target, (pcmkXmlStr) p_name); + xmlSetProp(target, (pcmkXmlStr) p_name, (pcmkXmlStr) p_value); } } @@ -2707,10 +2681,11 @@ replace_xml_child(xmlNode * parent, xmlNode * child, xmlNode * update, gboolean can_delete = FALSE; } if (can_delete && delete_only) { - for (xmlAttrPtr a = pcmk__xe_first_attr(update); a != NULL; - a = a->next) { - const char *p_name = (const char *) a->name; - const char *p_value = pcmk__xml_attr_value(a); + xmlAttrPtr pIter = NULL; + + for (pIter = pcmk__first_xml_attr(update); pIter != NULL; pIter = pIter->next) { + const char *p_name = (const char *)pIter->name; + const char *p_value = pcmk__xml_attr_value(pIter); right_val = crm_element_value(child, p_name); if (!pcmk__str_eq(p_value, right_val, pcmk__str_casei)) { @@ -2960,35 +2935,6 @@ pcmk__xml_artefact_path(enum pcmk__xml_artefact_ns ns, const char *filespec) return ret; } -void -pcmk__xe_set_propv(xmlNodePtr node, va_list pairs) -{ - while (true) { - const char *name, *value; - - name = va_arg(pairs, const char *); - if (name == NULL) { - return; - } - - value = va_arg(pairs, const char *); - if (value == NULL) { - return; - } - - crm_xml_add(node, name, value); - } -} - -void -pcmk__xe_set_props(xmlNodePtr node, ...) -{ - va_list pairs; - va_start(pairs, node); - pcmk__xe_set_propv(node, pairs); - va_end(pairs); -} - // Deprecated functions kept only for backward API compatibility xmlNode *find_entity(xmlNode *parent, const char *node_name, const char *id); diff --git a/lib/fencing/st_client.c b/lib/fencing/st_client.c index a398d28..3bcdfb3 100644 --- a/lib/fencing/st_client.c +++ b/lib/fencing/st_client.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include @@ -458,22 +457,39 @@ stonith_api_register_level(stonith_t * st, int options, const char *node, int le } static void +append_arg(const char *key, const char *value, GHashTable **args) +{ + CRM_CHECK(key != NULL, return); + CRM_CHECK(value != NULL, return); + CRM_CHECK(args != NULL, return); + + if (strstr(key, "pcmk_")) { + return; + } else if (strstr(key, CRM_META)) { + return; + } else if (pcmk__str_eq(key, "crm_feature_set", pcmk__str_casei)) { + return; + } + + if (!*args) { + *args = crm_str_table_new(); + } + + CRM_CHECK(*args != NULL, return); + crm_trace("Appending: %s=%s", key, value); + g_hash_table_replace(*args, strdup(key), strdup(value)); +} + +static void append_config_arg(gpointer key, gpointer value, gpointer user_data) { - /* The fencer will filter "action" out when it registers the device, - * but ignore it here in case any external API users don't. - * - * Also filter out parameters handled directly by Pacemaker. + /* The fencer will filter action out when it registers the device, + * but ignore it here just in case any other library callers + * fail to do so. */ - if (!pcmk__str_eq(key, STONITH_ATTR_ACTION_OP, pcmk__str_casei) - && !pcmk_stonith_param(key) - && (strstr(key, CRM_META) == NULL) - && !pcmk__str_eq(key, "crm_feature_set", pcmk__str_casei)) { - - crm_trace("Passing %s=%s with fence action", - (const char *) key, (const char *) (value? value : "")); - g_hash_table_insert((GHashTable *) user_data, - strdup(key), strdup(value? value : "")); + if (!pcmk__str_eq(key, STONITH_ATTR_ACTION_OP, pcmk__str_casei)) { + append_arg(key, value, user_data); + return; } } @@ -482,84 +498,75 @@ make_args(const char *agent, const char *action, const char *victim, uint32_t victim_nodeid, GHashTable * device_args, GHashTable * port_map, const char *host_arg) { + char buffer[512]; GHashTable *arg_list = NULL; const char *value = NULL; CRM_CHECK(action != NULL, return NULL); - arg_list = crm_str_table_new(); - - // Add action to arguments (using an alias if requested) + snprintf(buffer, sizeof(buffer), "pcmk_%s_action", action); if (device_args) { - char buffer[512]; - - snprintf(buffer, sizeof(buffer), "pcmk_%s_action", action); value = g_hash_table_lookup(device_args, buffer); - if (value) { - crm_debug("Substituting '%s' for fence action %s targeting %s", - value, action, victim); - action = value; - } } - g_hash_table_insert(arg_list, strdup(STONITH_ATTR_ACTION_OP), - strdup(action)); + if (value) { + crm_debug("Substituting action '%s' for requested operation '%s'", value, action); + action = value; + } - /* If this is a fencing operation against another node, add more standard - * arguments. - */ + append_arg(STONITH_ATTR_ACTION_OP, action, &arg_list); if (victim && device_args) { - const char *param = NULL; + const char *alias = victim; + const char *param = g_hash_table_lookup(device_args, STONITH_ATTR_HOSTARG); - /* Always pass the target's name, per + if (port_map && g_hash_table_lookup(port_map, victim)) { + alias = g_hash_table_lookup(port_map, victim); + } + + /* Always supply the node's name, too: * https://github.com/ClusterLabs/fence-agents/blob/master/doc/FenceAgentAPI.md */ - g_hash_table_insert(arg_list, strdup("nodename"), strdup(victim)); - - // If the target's node ID was specified, pass it, too + append_arg("nodename", victim, &arg_list); if (victim_nodeid) { - char *nodeid = crm_strdup_printf("%" PRIu32, victim_nodeid); - - // cts-fencing looks for this log message - crm_info("Passing '%s' as nodeid with fence action '%s' targeting %s", - nodeid, action, victim); - g_hash_table_insert(arg_list, strdup("nodeid"), nodeid); + char nodeid_str[33] = { 0, }; + if (snprintf(nodeid_str, 33, "%u", (unsigned int)victim_nodeid)) { + crm_info("For stonith action (%s) for victim %s, adding nodeid (%s) to parameters", + action, victim, nodeid_str); + append_arg("nodeid", nodeid_str, &arg_list); + } } - // Check whether target must be specified in some other way - param = g_hash_table_lookup(device_args, PCMK_STONITH_HOST_ARGUMENT); - if (!pcmk__str_eq(agent, "fence_legacy", pcmk__str_none) - && !pcmk__str_eq(param, "none", pcmk__str_casei)) { + /* Check if we need to supply the victim in any other form */ + if(pcmk__str_eq(agent, "fence_legacy", pcmk__str_casei)) { + value = agent; - if (param == NULL) { - /* Use the caller's default for pcmk_host_argument, or "port" if - * none was given - */ - param = (host_arg == NULL)? "port" : host_arg; + } else if (param == NULL) { + // By default, `port` is added + if (host_arg == NULL) { + param = "port"; + + } else { + param = host_arg; } + value = g_hash_table_lookup(device_args, param); - if (pcmk__str_eq(value, "dynamic", - pcmk__str_casei|pcmk__str_null_matches)) { - /* If the host argument was "dynamic" or not explicitly specified, - * add it with the target - */ - const char *alias = NULL; + } else if (pcmk__str_eq(param, "none", pcmk__str_casei)) { + value = param; /* Nothing more to do */ - if (port_map) { - alias = g_hash_table_lookup(port_map, victim); - } - if (alias == NULL) { - alias = victim; - } - crm_debug("Passing %s='%s' with fence action %s targeting %s", - param, alias, action, victim); - g_hash_table_insert(arg_list, strdup(param), strdup(alias)); - } + } else { + value = g_hash_table_lookup(device_args, param); + } + + /* Don't overwrite explictly set values for $param */ + if (pcmk__str_eq(value, "dynamic", pcmk__str_null_matches | pcmk__str_casei)) { + crm_debug("Performing '%s' action targeting '%s' as '%s=%s'", action, victim, param, + alias); + append_arg(param, alias, &arg_list); } } if (device_args) { - g_hash_table_foreach(device_args, append_config_arg, arg_list); + g_hash_table_foreach(device_args, append_config_arg, &arg_list); } return arg_list; @@ -2040,11 +2047,14 @@ stonith_api_validate(stonith_t *st, int call_options, const char *rsc_id, // Convert parameter list to a hash table for (; params; params = params->next) { - if (pcmk__str_eq(params->key, PCMK_STONITH_HOST_ARGUMENT, - pcmk__str_casei)) { + if (pcmk__str_eq(params->key, STONITH_ATTR_HOSTARG, pcmk__str_casei)) { host_arg = params->value; } - if (!pcmk_stonith_param(params->key)) { + + // Strip out Pacemaker-implemented parameters + if (!pcmk__starts_with(params->key, "pcmk_") + && strcmp(params->key, "provides") + && strcmp(params->key, "stonith-timeout")) { g_hash_table_insert(params_table, strdup(params->key), strdup(params->value)); } diff --git a/lib/fencing/st_output.c b/lib/fencing/st_output.c index f48fd55..c3b6b41 100644 --- a/lib/fencing/st_output.c +++ b/lib/fencing/st_output.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include @@ -30,11 +29,11 @@ time_t_string(time_t when) { return buf; } -PCMK__OUTPUT_ARGS("failed-fencing-list", "stonith_history_t *", "GList *", "gboolean", "gboolean") +PCMK__OUTPUT_ARGS("failed-fencing-history", "stonith_history_t *", "GListPtr", "gboolean", "gboolean") int stonith__failed_history(pcmk__output_t *out, va_list args) { stonith_history_t *history = va_arg(args, stonith_history_t *); - GList *only_node = va_arg(args, GList *); + GListPtr only_node = va_arg(args, GListPtr); gboolean full_history = va_arg(args, gboolean); gboolean print_spacer = va_arg(args, gboolean); @@ -58,11 +57,11 @@ stonith__failed_history(pcmk__output_t *out, va_list args) { return rc; } -PCMK__OUTPUT_ARGS("fencing-list", "stonith_history_t *", "GList *", "gboolean", "gboolean") +PCMK__OUTPUT_ARGS("fencing-history", "stonith_history_t *", "GListPtr", "gboolean", "gboolean") int stonith__history(pcmk__output_t *out, va_list args) { stonith_history_t *history = va_arg(args, stonith_history_t *); - GList *only_node = va_arg(args, GList *); + GListPtr only_node = va_arg(args, GListPtr); gboolean full_history = va_arg(args, gboolean); gboolean print_spacer = va_arg(args, gboolean); @@ -84,12 +83,12 @@ stonith__history(pcmk__output_t *out, va_list args) { return rc; } -PCMK__OUTPUT_ARGS("full-fencing-list", "crm_exit_t", "stonith_history_t *", "GList *", "gboolean", "gboolean") +PCMK__OUTPUT_ARGS("full-fencing-history", "crm_exit_t", "stonith_history_t *", "GListPtr", "gboolean", "gboolean") int stonith__full_history(pcmk__output_t *out, va_list args) { crm_exit_t history_rc G_GNUC_UNUSED = va_arg(args, crm_exit_t); stonith_history_t *history = va_arg(args, stonith_history_t *); - GList *only_node = va_arg(args, GList *); + GListPtr only_node = va_arg(args, GListPtr); gboolean full_history = va_arg(args, gboolean); gboolean print_spacer = va_arg(args, gboolean); @@ -109,12 +108,12 @@ stonith__full_history(pcmk__output_t *out, va_list args) { return rc; } -PCMK__OUTPUT_ARGS("full-fencing-list", "crm_exit_t", "stonith_history_t *", "GList *", "gboolean", "gboolean") -static int -full_history_xml(pcmk__output_t *out, va_list args) { +PCMK__OUTPUT_ARGS("full-fencing-history", "crm_exit_t", "stonith_history_t *", "GListPtr", "gboolean", "gboolean") +int +stonith__full_history_xml(pcmk__output_t *out, va_list args) { crm_exit_t history_rc = va_arg(args, crm_exit_t); stonith_history_t *history = va_arg(args, stonith_history_t *); - GList *only_node = va_arg(args, GList *); + GListPtr only_node = va_arg(args, GListPtr); gboolean full_history = va_arg(args, gboolean); gboolean print_spacer G_GNUC_UNUSED = va_arg(args, gboolean); @@ -133,11 +132,10 @@ full_history_xml(pcmk__output_t *out, va_list args) { PCMK__OUTPUT_LIST_FOOTER(out, rc); } else { + xmlNodePtr node = pcmk__output_create_xml_node(out, "fence_history"); char *rc_s = crm_itoa(history_rc); - pcmk__output_create_xml_node(out, "fence_history", - "status", rc_s, - NULL); + xmlSetProp(node, (pcmkXmlStr) "status", (pcmkXmlStr) rc_s); free(rc_s); rc = pcmk_rc_ok; @@ -147,8 +145,8 @@ full_history_xml(pcmk__output_t *out, va_list args) { } PCMK__OUTPUT_ARGS("last-fenced", "const char *", "time_t") -static int -last_fenced_html(pcmk__output_t *out, va_list args) { +int +stonith__last_fenced_html(pcmk__output_t *out, va_list args) { const char *target = va_arg(args, const char *); time_t when = va_arg(args, time_t); @@ -163,8 +161,8 @@ last_fenced_html(pcmk__output_t *out, va_list args) { } PCMK__OUTPUT_ARGS("last-fenced", "const char *", "time_t") -static int -last_fenced_text(pcmk__output_t *out, va_list args) { +int +stonith__last_fenced_text(pcmk__output_t *out, va_list args) { const char *target = va_arg(args, const char *); time_t when = va_arg(args, time_t); @@ -178,18 +176,17 @@ last_fenced_text(pcmk__output_t *out, va_list args) { } PCMK__OUTPUT_ARGS("last-fenced", "const char *", "time_t") -static int -last_fenced_xml(pcmk__output_t *out, va_list args) { +int +stonith__last_fenced_xml(pcmk__output_t *out, va_list args) { const char *target = va_arg(args, const char *); time_t when = va_arg(args, time_t); if (when) { + xmlNodePtr node = pcmk__output_create_xml_node(out, "last-fenced"); char *buf = time_t_string(when); - pcmk__output_create_xml_node(out, "last-fenced", - "target", target, - "when", buf, - NULL); + xmlSetProp(node, (pcmkXmlStr) "target", (pcmkXmlStr) target); + xmlSetProp(node, (pcmkXmlStr) "when", (pcmkXmlStr) buf); free(buf); return pcmk_rc_ok; @@ -198,11 +195,11 @@ last_fenced_xml(pcmk__output_t *out, va_list args) { } } -PCMK__OUTPUT_ARGS("pending-fencing-list", "stonith_history_t *", "GList *", "gboolean", "gboolean") +PCMK__OUTPUT_ARGS("pending-fencing-actions", "stonith_history_t *", "GListPtr", "gboolean", "gboolean") int stonith__pending_actions(pcmk__output_t *out, va_list args) { stonith_history_t *history = va_arg(args, stonith_history_t *); - GList *only_node = va_arg(args, GList *); + GListPtr only_node = va_arg(args, GListPtr); gboolean full_history = va_arg(args, gboolean); gboolean print_spacer = va_arg(args, gboolean); @@ -228,8 +225,8 @@ stonith__pending_actions(pcmk__output_t *out, va_list args) { } PCMK__OUTPUT_ARGS("stonith-event", "stonith_history_t *", "gboolean", "gboolean") -static int -stonith_event_html(pcmk__output_t *out, va_list args) { +int +stonith__event_html(pcmk__output_t *out, va_list args) { stonith_history_t *event = va_arg(args, stonith_history_t *); gboolean full_history = va_arg(args, gboolean); gboolean later_succeeded = va_arg(args, gboolean); @@ -276,8 +273,8 @@ stonith_event_html(pcmk__output_t *out, va_list args) { } PCMK__OUTPUT_ARGS("stonith-event", "stonith_history_t *", "gboolean", "gboolean") -static int -stonith_event_text(pcmk__output_t *out, va_list args) { +int +stonith__event_text(pcmk__output_t *out, va_list args) { stonith_history_t *event = va_arg(args, stonith_history_t *); gboolean full_history = va_arg(args, gboolean); gboolean later_succeeded = va_arg(args, gboolean); @@ -314,47 +311,45 @@ stonith_event_text(pcmk__output_t *out, va_list args) { } PCMK__OUTPUT_ARGS("stonith-event", "stonith_history_t *", "gboolean", "gboolean") -static int -stonith_event_xml(pcmk__output_t *out, va_list args) { +int +stonith__event_xml(pcmk__output_t *out, va_list args) { + xmlNodePtr node = pcmk__output_create_xml_node(out, "fence_event"); stonith_history_t *event = va_arg(args, stonith_history_t *); gboolean full_history G_GNUC_UNUSED = va_arg(args, gboolean); gboolean later_succeeded G_GNUC_UNUSED = va_arg(args, gboolean); char *buf = NULL; - xmlNodePtr node = pcmk__output_create_xml_node(out, "fence_event", - "action", event->action, - "target", event->target, - "client", event->client, - "origin", event->origin, - NULL); - switch (event->state) { case st_failed: - crm_xml_add(node, "status", "failed"); + xmlSetProp(node, (pcmkXmlStr) "status", (pcmkXmlStr) "failed"); break; case st_done: - crm_xml_add(node, "status", "success"); + xmlSetProp(node, (pcmkXmlStr) "status", (pcmkXmlStr) "success"); break; default: { char *state = crm_itoa(event->state); - pcmk__xe_set_props(node, "status", "pending", - "extended-status", state, - NULL); + xmlSetProp(node, (pcmkXmlStr) "status", (pcmkXmlStr) "pending"); + xmlSetProp(node, (pcmkXmlStr) "extended-status", (pcmkXmlStr) state); free(state); break; } } if (event->delegate != NULL) { - crm_xml_add(node, "delegate", event->delegate); + xmlSetProp(node, (pcmkXmlStr) "delegate", (pcmkXmlStr) event->delegate); } + xmlSetProp(node, (pcmkXmlStr) "action", (pcmkXmlStr) event->action); + xmlSetProp(node, (pcmkXmlStr) "target", (pcmkXmlStr) event->target); + xmlSetProp(node, (pcmkXmlStr) "client", (pcmkXmlStr) event->client); + xmlSetProp(node, (pcmkXmlStr) "origin", (pcmkXmlStr) event->origin); + if (event->state == st_failed || event->state == st_done) { buf = time_t_string(event->completed); - crm_xml_add(node, "completed", buf); + xmlSetProp(node, (pcmkXmlStr) "completed", (pcmkXmlStr) buf); free(buf); } @@ -362,8 +357,8 @@ stonith_event_xml(pcmk__output_t *out, va_list args) { } PCMK__OUTPUT_ARGS("validate", "const char *", "const char *", "char *", "char *", "int") -static int -validate_agent_html(pcmk__output_t *out, va_list args) { +int +stonith__validate_agent_html(pcmk__output_t *out, va_list args) { const char *agent = va_arg(args, const char *); const char *device = va_arg(args, const char *); char *output = va_arg(args, char *); @@ -387,8 +382,8 @@ validate_agent_html(pcmk__output_t *out, va_list args) { } PCMK__OUTPUT_ARGS("validate", "const char *", "const char *", "char *", "char *", "int") -static int -validate_agent_text(pcmk__output_t *out, va_list args) { +int +stonith__validate_agent_text(pcmk__output_t *out, va_list args) { const char *agent = va_arg(args, const char *); const char *device = va_arg(args, const char *); char *output = va_arg(args, char *); @@ -403,27 +398,33 @@ validate_agent_text(pcmk__output_t *out, va_list args) { rc ? "failed" : "succeeded"); } - out->subprocess_output(out, rc, output, error_output); + if (output) { + puts(output); + } + + if (error_output) { + puts(error_output); + } + return rc; } PCMK__OUTPUT_ARGS("validate", "const char *", "const char *", "char *", "char *", "int") -static int -validate_agent_xml(pcmk__output_t *out, va_list args) { +int +stonith__validate_agent_xml(pcmk__output_t *out, va_list args) { + xmlNodePtr node = pcmk__output_create_xml_node(out, "validate"); + const char *agent = va_arg(args, const char *); const char *device = va_arg(args, const char *); char *output = va_arg(args, char *); char *error_output = va_arg(args, char *); int rc = va_arg(args, int); - xmlNodePtr node = pcmk__output_create_xml_node(out, "validate", - "agent", agent, - "valid", pcmk__btoa(rc), - NULL); - + xmlSetProp(node, (pcmkXmlStr) "agent", (pcmkXmlStr) agent); if (device != NULL) { - crm_xml_add(node, "device", device); + xmlSetProp(node, (pcmkXmlStr) "device", (pcmkXmlStr) device); } + xmlSetProp(node, (pcmkXmlStr) "valid", (pcmkXmlStr) pcmk__btoa(rc)); pcmk__output_xml_push_parent(out, node); out->subprocess_output(out, rc, output, error_output); @@ -433,23 +434,23 @@ validate_agent_xml(pcmk__output_t *out, va_list args) { } static pcmk__message_entry_t fmt_functions[] = { - { "failed-fencing-list", "default", stonith__failed_history }, - { "fencing-list", "default", stonith__history }, - { "full-fencing-list", "default", stonith__full_history }, - { "full-fencing-list", "xml", full_history_xml }, - { "last-fenced", "html", last_fenced_html }, - { "last-fenced", "log", last_fenced_text }, - { "last-fenced", "text", last_fenced_text }, - { "last-fenced", "xml", last_fenced_xml }, - { "pending-fencing-list", "default", stonith__pending_actions }, - { "stonith-event", "html", stonith_event_html }, - { "stonith-event", "log", stonith_event_text }, - { "stonith-event", "text", stonith_event_text }, - { "stonith-event", "xml", stonith_event_xml }, - { "validate", "html", validate_agent_html }, - { "validate", "log", validate_agent_text }, - { "validate", "text", validate_agent_text }, - { "validate", "xml", validate_agent_xml }, + { "failed-fencing-history", "default", stonith__failed_history }, + { "fencing-history", "default", stonith__history }, + { "full-fencing-history", "default", stonith__full_history }, + { "full-fencing-history", "xml", stonith__full_history_xml }, + { "last-fenced", "html", stonith__last_fenced_html }, + { "last-fenced", "log", stonith__last_fenced_text }, + { "last-fenced", "text", stonith__last_fenced_text }, + { "last-fenced", "xml", stonith__last_fenced_xml }, + { "pending-fencing-actions", "default", stonith__pending_actions }, + { "stonith-event", "html", stonith__event_html }, + { "stonith-event", "log", stonith__event_text }, + { "stonith-event", "text", stonith__event_text }, + { "stonith-event", "xml", stonith__event_xml }, + { "validate", "html", stonith__validate_agent_html }, + { "validate", "log", stonith__validate_agent_text }, + { "validate", "text", stonith__validate_agent_text }, + { "validate", "xml", stonith__validate_agent_xml }, { NULL, NULL, NULL } }; diff --git a/lib/lrmd/Makefile.am b/lib/lrmd/Makefile.am index 09e40b1..41ba7fd 100644 --- a/lib/lrmd/Makefile.am +++ b/lib/lrmd/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2012-2020 the Pacemaker project contributors +# Copyright 2012-2018 the Pacemaker project contributors # # The version control history for this file may have further details. # @@ -18,4 +18,4 @@ liblrmd_la_LDFLAGS += $(LDFLAGS_HARDENED_LIB) liblrmd_la_LIBADD = $(top_builddir)/lib/common/libcrmcommon.la \ $(top_builddir)/lib/services/libcrmservice.la \ $(top_builddir)/lib/fencing/libstonithd.la -liblrmd_la_SOURCES = lrmd_client.c proxy_common.c lrmd_alerts.c lrmd_output.c +liblrmd_la_SOURCES = lrmd_client.c proxy_common.c lrmd_alerts.c diff --git a/lib/lrmd/lrmd_output.c b/lib/lrmd/lrmd_output.c deleted file mode 100644 index dfcf3fa..0000000 --- a/lib/lrmd/lrmd_output.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright 2020 the Pacemaker project contributors - * - * The version control history for this file may have further details. - * - * This source code is licensed under the GNU Lesser General Public License - * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. - */ - -#include -#include - -#include -#include - -static int -default_list(pcmk__output_t *out, lrmd_list_t *list, const char *title) { - lrmd_list_t *iter = NULL; - - out->begin_list(out, NULL, NULL, "%s", title); - - for (iter = list; iter != NULL; iter = iter->next) { - out->list_item(out, NULL, "%s", iter->val); - } - - out->end_list(out); - lrmd_list_freeall(list); - return pcmk_rc_ok; -} - -static int -xml_list(pcmk__output_t *out, lrmd_list_t *list, const char *ele) { - lrmd_list_t *iter = NULL; - - for (iter = list; iter != NULL; iter = iter->next) { - pcmk__output_create_xml_text_node(out, ele, iter->val); - } - - lrmd_list_freeall(list); - return pcmk_rc_ok; -} - -PCMK__OUTPUT_ARGS("alternatives-list", "lrmd_list_t *", "const char *") -static int -lrmd__alternatives_list_xml(pcmk__output_t *out, va_list args) { - lrmd_list_t *list = va_arg(args, lrmd_list_t *); - const char *agent_spec = va_arg(args, const char *); - - pcmk__output_xml_create_parent(out, "providers", - "for", agent_spec, - NULL); - return xml_list(out, list, "provider"); -} - -PCMK__OUTPUT_ARGS("alternatives-list", "lrmd_list_t *", "const char *") -static int -lrmd__alternatives_list(pcmk__output_t *out, va_list args) { - lrmd_list_t *list = va_arg(args, lrmd_list_t *); - const char *agent_spec G_GNUC_UNUSED = va_arg(args, const char *); - - return default_list(out, list, "Providers"); -} - -PCMK__OUTPUT_ARGS("agents-list", "lrmd_list_t *", "const char *", "char *") -static int -lrmd__agents_list_xml(pcmk__output_t *out, va_list args) { - lrmd_list_t *list = va_arg(args, lrmd_list_t *); - const char *agent_spec = va_arg(args, const char *); - char *provider = va_arg(args, char *); - - xmlNodePtr node = pcmk__output_xml_create_parent(out, "agents", - "standard", agent_spec, - NULL); - - if (!pcmk__str_empty(provider)) { - crm_xml_add(node, "provider", provider); - } - - return xml_list(out, list, "agent"); -} - -PCMK__OUTPUT_ARGS("agents-list", "lrmd_list_t *", "const char *", "char *") -static int -lrmd__agents_list(pcmk__output_t *out, va_list args) { - lrmd_list_t *list = va_arg(args, lrmd_list_t *); - const char *agent_spec = va_arg(args, const char *); - char *provider = va_arg(args, char *); - - int rc; - char *title = crm_strdup_printf("%s agents", pcmk__str_empty(provider) ? agent_spec : provider); - - rc = default_list(out, list, title); - free(title); - return rc; -} - -PCMK__OUTPUT_ARGS("providers-list", "lrmd_list_t *", "const char *") -static int -lrmd__providers_list_xml(pcmk__output_t *out, va_list args) { - lrmd_list_t *list = va_arg(args, lrmd_list_t *); - const char *agent_spec = va_arg(args, const char *); - - xmlNodePtr node = pcmk__output_xml_create_parent(out, "providers", - "standard", "ocf", - NULL); - - if (agent_spec != NULL) { - crm_xml_add(node, "agent", agent_spec); - } - - return xml_list(out, list, "provider"); -} - -PCMK__OUTPUT_ARGS("providers-list", "lrmd_list_t *", "const char *") -static int -lrmd__providers_list(pcmk__output_t *out, va_list args) { - lrmd_list_t *list = va_arg(args, lrmd_list_t *); - const char *agent_spec G_GNUC_UNUSED = va_arg(args, const char *); - - return default_list(out, list, "Providers"); -} - -PCMK__OUTPUT_ARGS("standards-list", "lrmd_list_t *") -static int -lrmd__standards_list(pcmk__output_t *out, va_list args) { - lrmd_list_t *list = va_arg(args, lrmd_list_t *); - - return default_list(out, list, "Standards"); -} - -static pcmk__message_entry_t fmt_functions[] = { - { "alternatives-list", "default", lrmd__alternatives_list }, - { "alternatives-list", "xml", lrmd__alternatives_list_xml }, - { "agents-list", "default", lrmd__agents_list }, - { "agents-list", "xml", lrmd__agents_list_xml }, - { "providers-list", "default", lrmd__providers_list }, - { "providers-list", "xml", lrmd__providers_list_xml }, - { "standards-list", "default", lrmd__standards_list }, - - { NULL, NULL, NULL } -}; - -void -lrmd__register_messages(pcmk__output_t *out) { - pcmk__register_messages(out, fmt_functions); -} diff --git a/lib/lrmd/proxy_common.c b/lib/lrmd/proxy_common.c index 0f1e76a..b8d889e 100644 --- a/lib/lrmd/proxy_common.c +++ b/lib/lrmd/proxy_common.c @@ -259,11 +259,7 @@ remote_proxy_cb(lrmd_t *lrmd, const char *node_name, xmlNode *msg) if (pcmk__str_eq(type, T_ATTRD, pcmk__str_casei) && crm_element_value(request, - PCMK__XA_ATTR_NODE_NAME) == NULL - && pcmk__str_any_of(crm_element_value(request, PCMK__XA_TASK), - PCMK__ATTRD_CMD_UPDATE, - PCMK__ATTRD_CMD_UPDATE_BOTH, - PCMK__ATTRD_CMD_UPDATE_DELAY, NULL)) { + PCMK__XA_ATTR_NODE_NAME) == NULL) { crm_xml_add(request, PCMK__XA_ATTR_NODE_NAME, proxy->node_name); } diff --git a/lib/pacemaker/Makefile.am b/lib/pacemaker/Makefile.am index 760c04a..51a811a 100644 --- a/lib/pacemaker/Makefile.am +++ b/lib/pacemaker/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2004-2021 the Pacemaker project contributors +# Copyright 2004-2019 the Pacemaker project contributors # # The version control history for this file may have further details. # @@ -28,10 +28,8 @@ libpacemaker_la_LIBADD = $(top_builddir)/lib/pengine/libpe_status.la \ # -L$(top_builddir)/lib/pils -lpils -export-dynamic -module -avoid-version # Use += rather than backlashed continuation lines for parsing by bumplibs.sh libpacemaker_la_SOURCES = -libpacemaker_la_SOURCES += pcmk_cluster_queries.c libpacemaker_la_SOURCES += pcmk_fence.c libpacemaker_la_SOURCES += pcmk_output.c -libpacemaker_la_SOURCES += pcmk_resource.c libpacemaker_la_SOURCES += pcmk_sched_allocate.c libpacemaker_la_SOURCES += pcmk_sched_bundle.c libpacemaker_la_SOURCES += pcmk_sched_clone.c diff --git a/lib/pacemaker/pcmk_cluster_queries.c b/lib/pacemaker/pcmk_cluster_queries.c deleted file mode 100644 index c705b7f..0000000 --- a/lib/pacemaker/pcmk_cluster_queries.c +++ /dev/null @@ -1,483 +0,0 @@ -#include // gboolean, GMainLoop, etc. -#include // xmlNode - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define DEFAULT_MESSAGE_TIMEOUT_MS 30000 - - -typedef struct { - pcmk__output_t *out; - GMainLoop *mainloop; - int rc; - guint message_timer_id; - guint message_timeout_ms; -} data_t; - -static void -quit_main_loop(data_t *data) -{ - if (data->mainloop != NULL) { - GMainLoop *mloop = data->mainloop; - - data->mainloop = NULL; // Don't re-enter this block - pcmk_quit_main_loop(mloop, 10); - g_main_loop_unref(mloop); - } -} - -static gboolean -admin_message_timeout(gpointer user_data) -{ - data_t *data = user_data; - pcmk__output_t *out = data->out; - - out->err(out, "error: No reply received from controller before timeout (%dms)", - data->message_timeout_ms); - data->message_timer_id = 0; - data->rc = ETIMEDOUT; - quit_main_loop(data); - return FALSE; // Tells glib to remove source -} - -static void -start_main_loop(data_t *data) -{ - if (data->message_timeout_ms < 1) { - data->message_timeout_ms = DEFAULT_MESSAGE_TIMEOUT_MS; - } - - data->rc = ECONNRESET; // For unexpected disconnects - data->mainloop = g_main_loop_new(NULL, FALSE); - data->message_timer_id = g_timeout_add(data->message_timeout_ms, - admin_message_timeout, - data); - g_main_loop_run(data->mainloop); -} - -static void -event_done(data_t *data, pcmk_ipc_api_t *api) -{ - pcmk_disconnect_ipc(api); - quit_main_loop(data); -} - -static pcmk_controld_api_reply_t * -controld_event_reply(data_t *data, pcmk_ipc_api_t *controld_api, enum pcmk_ipc_event event_type, crm_exit_t status, void *event_data) -{ - pcmk__output_t *out = data->out; - pcmk_controld_api_reply_t *reply = event_data; - - switch (event_type) { - case pcmk_ipc_event_disconnect: - if (data->rc == ECONNRESET) { // Unexpected - out->err(out, "error: Lost connection to controller"); - } - event_done(data, controld_api); - return NULL; - - case pcmk_ipc_event_reply: - break; - - default: - return NULL; - } - - if (data->message_timer_id != 0) { - g_source_remove(data->message_timer_id); - data->message_timer_id = 0; - } - - if (status != CRM_EX_OK) { - out->err(out, "error: Bad reply from controller: %s", - crm_exit_str(status)); - data->rc = EBADMSG; - event_done(data, controld_api); - return NULL; - } - - if (reply->reply_type != pcmk_controld_reply_ping) { - out->err(out, "error: Unknown reply type %d from controller", - reply->reply_type); - data->rc = EBADMSG; - event_done(data, controld_api); - return NULL; - } - - return reply; -} - -static void -controller_status_event_cb(pcmk_ipc_api_t *controld_api, - enum pcmk_ipc_event event_type, crm_exit_t status, - void *event_data, void *user_data) -{ - data_t *data = user_data; - pcmk__output_t *out = data->out; - pcmk_controld_api_reply_t *reply = controld_event_reply(data, controld_api, - event_type, status, event_data); - - if (reply != NULL) { - out->message(out, "health", - reply->data.ping.sys_from, - reply->host_from, - reply->data.ping.fsa_state, - reply->data.ping.result); - data->rc = pcmk_rc_ok; - } - - event_done(data, controld_api); -} - -static void -designated_controller_event_cb(pcmk_ipc_api_t *controld_api, - enum pcmk_ipc_event event_type, crm_exit_t status, - void *event_data, void *user_data) -{ - data_t *data = user_data; - pcmk__output_t *out = data->out; - pcmk_controld_api_reply_t *reply = controld_event_reply(data, controld_api, - event_type, status, event_data); - - if (reply != NULL) { - out->message(out, "dc", reply->host_from); - data->rc = pcmk_rc_ok; - } - - event_done(data, controld_api); -} - -static void -pacemakerd_event_cb(pcmk_ipc_api_t *pacemakerd_api, - enum pcmk_ipc_event event_type, crm_exit_t status, - void *event_data, void *user_data) -{ - data_t *data = user_data; - pcmk__output_t *out = data->out; - pcmk_pacemakerd_api_reply_t *reply = event_data; - - crm_time_t *crm_when; - char *pinged_buf = NULL; - - switch (event_type) { - case pcmk_ipc_event_disconnect: - if (data->rc == ECONNRESET) { // Unexpected - out->err(out, "error: Lost connection to pacemakerd"); - } - event_done(data, pacemakerd_api); - return; - - case pcmk_ipc_event_reply: - break; - - default: - return; - } - - if (data->message_timer_id != 0) { - g_source_remove(data->message_timer_id); - data->message_timer_id = 0; - } - - if (status != CRM_EX_OK) { - out->err(out, "error: Bad reply from pacemakerd: %s", - crm_exit_str(status)); - event_done(data, pacemakerd_api); - return; - } - - if (reply->reply_type != pcmk_pacemakerd_reply_ping) { - out->err(out, "error: Unknown reply type %d from pacemakerd", - reply->reply_type); - event_done(data, pacemakerd_api); - return; - } - - // Parse desired information from reply - crm_when = crm_time_new(NULL); - crm_time_set_timet(crm_when, &reply->data.ping.last_good); - pinged_buf = crm_time_as_string(crm_when, - crm_time_log_date | crm_time_log_timeofday | - crm_time_log_with_timezone); - - out->message(out, "pacemakerd-health", - reply->data.ping.sys_from, - (reply->data.ping.status == pcmk_rc_ok)? - pcmk_pacemakerd_api_daemon_state_enum2text( - reply->data.ping.state):"query failed", - (reply->data.ping.status == pcmk_rc_ok)?pinged_buf:""); - data->rc = pcmk_rc_ok; - crm_time_free(crm_when); - free(pinged_buf); - - event_done(data, pacemakerd_api); -} - -static pcmk_ipc_api_t * -ipc_connect(data_t *data, enum pcmk_ipc_server server, pcmk_ipc_callback_t cb) -{ - int rc; - pcmk__output_t *out = data->out; - pcmk_ipc_api_t *api = NULL; - - - rc = pcmk_new_ipc_api(&api, server); - if (api == NULL) { - out->err(out, "error: Could not connect to %s: %s", - pcmk_ipc_name(api, true), - pcmk_rc_str(rc)); - data->rc = rc; - return NULL; - } - if (cb != NULL) { - pcmk_register_ipc_callback(api, cb, data); - } - rc = pcmk_connect_ipc(api, pcmk_ipc_dispatch_main); - if (rc != pcmk_rc_ok) { - out->err(out, "error: Could not connect to %s: %s", - pcmk_ipc_name(api, true), - pcmk_rc_str(rc)); - data->rc = rc; - return NULL; - } - - return api; -} - -int -pcmk__controller_status(pcmk__output_t *out, char *dest_node, guint message_timeout_ms) -{ - data_t data = { - .out = out, - .mainloop = NULL, - .rc = pcmk_rc_ok, - .message_timer_id = 0, - .message_timeout_ms = message_timeout_ms - }; - pcmk_ipc_api_t *controld_api = ipc_connect(&data, pcmk_ipc_controld, controller_status_event_cb); - - if (controld_api != NULL) { - int rc = pcmk_controld_api_ping(controld_api, dest_node); - if (rc != pcmk_rc_ok) { - out->err(out, "error: Command failed: %s", pcmk_rc_str(rc)); - data.rc = rc; - } - - start_main_loop(&data); - - pcmk_free_ipc_api(controld_api); - } - - return data.rc; -} - -int -pcmk_controller_status(xmlNodePtr *xml, char *dest_node, unsigned int message_timeout_ms) -{ - pcmk__output_t *out = NULL; - int rc = pcmk_rc_ok; - - rc = pcmk__out_prologue(&out, xml); - if (rc != pcmk_rc_ok) { - return rc; - } - - pcmk__register_lib_messages(out); - - rc = pcmk__controller_status(out, dest_node, (guint) message_timeout_ms); - pcmk__out_epilogue(out, xml, rc); - return rc; -} - -int -pcmk__designated_controller(pcmk__output_t *out, guint message_timeout_ms) -{ - data_t data = { - .out = out, - .mainloop = NULL, - .rc = pcmk_rc_ok, - .message_timer_id = 0, - .message_timeout_ms = message_timeout_ms - }; - pcmk_ipc_api_t *controld_api = ipc_connect(&data, pcmk_ipc_controld, designated_controller_event_cb); - - if (controld_api != NULL) { - int rc = pcmk_controld_api_ping(controld_api, NULL); - if (rc != pcmk_rc_ok) { - out->err(out, "error: Command failed: %s", pcmk_rc_str(rc)); - data.rc = rc; - } - - start_main_loop(&data); - - pcmk_free_ipc_api(controld_api); - } - - return data.rc; -} - -int -pcmk_designated_controller(xmlNodePtr *xml, unsigned int message_timeout_ms) -{ - pcmk__output_t *out = NULL; - int rc = pcmk_rc_ok; - - rc = pcmk__out_prologue(&out, xml); - if (rc != pcmk_rc_ok) { - return rc; - } - - pcmk__register_lib_messages(out); - - rc = pcmk__designated_controller(out, (guint) message_timeout_ms); - pcmk__out_epilogue(out, xml, rc); - return rc; -} - -int -pcmk__pacemakerd_status(pcmk__output_t *out, char *ipc_name, guint message_timeout_ms) -{ - data_t data = { - .out = out, - .mainloop = NULL, - .rc = pcmk_rc_ok, - .message_timer_id = 0, - .message_timeout_ms = message_timeout_ms - }; - pcmk_ipc_api_t *pacemakerd_api = ipc_connect(&data, pcmk_ipc_pacemakerd, pacemakerd_event_cb); - - if (pacemakerd_api != NULL) { - int rc = pcmk_pacemakerd_api_ping(pacemakerd_api, ipc_name); - if (rc != pcmk_rc_ok) { - out->err(out, "error: Command failed: %s", pcmk_rc_str(rc)); - data.rc = rc; - } - - start_main_loop(&data); - - pcmk_free_ipc_api(pacemakerd_api); - } - - return data.rc; -} - -int -pcmk_pacemakerd_status(xmlNodePtr *xml, char *ipc_name, unsigned int message_timeout_ms) -{ - pcmk__output_t *out = NULL; - int rc = pcmk_rc_ok; - - rc = pcmk__out_prologue(&out, xml); - if (rc != pcmk_rc_ok) { - return rc; - } - - pcmk__register_lib_messages(out); - - rc = pcmk__pacemakerd_status(out, ipc_name, (guint) message_timeout_ms); - pcmk__out_epilogue(out, xml, rc); - return rc; -} - -// \return Standard Pacemaker return code -int -pcmk__list_nodes(pcmk__output_t *out, gboolean BASH_EXPORT) -{ - cib_t *the_cib = cib_new(); - xmlNode *output = NULL; - int rc; - - if (the_cib == NULL) { - return ENOMEM; - } - rc = the_cib->cmds->signon(the_cib, crm_system_name, cib_command); - if (rc != pcmk_ok) { - return pcmk_legacy2rc(rc); - } - - rc = the_cib->cmds->query(the_cib, NULL, &output, - cib_scope_local | cib_sync_call); - if (rc == pcmk_ok) { - out->message(out, "crmadmin-node-list", output, BASH_EXPORT); - free_xml(output); - } - the_cib->cmds->signoff(the_cib); - return pcmk_legacy2rc(rc); -} - -#ifdef BUILD_PUBLIC_LIBPACEMAKER -int -pcmk_list_nodes(xmlNodePtr *xml) -{ - pcmk__output_t *out = NULL; - int rc = pcmk_rc_ok; - - rc = pcmk__out_prologue(&out, xml); - if (rc != pcmk_rc_ok) { - return rc; - } - - pcmk__register_lib_messages(out); - - rc = pcmk__list_nodes(out, FALSE); - pcmk__out_epilogue(out, xml, rc); - return rc; -} -#endif - -// remove when parameters removed from tools/crmadmin.c -int -pcmk__shutdown_controller(pcmk__output_t *out, char *dest_node) -{ - data_t data = { - .out = out, - .mainloop = NULL, - .rc = pcmk_rc_ok, - }; - pcmk_ipc_api_t *controld_api = ipc_connect(&data, pcmk_ipc_controld, NULL); - - if (controld_api != NULL) { - int rc = pcmk_controld_api_shutdown(controld_api, dest_node); - if (rc != pcmk_rc_ok) { - out->err(out, "error: Command failed: %s", pcmk_rc_str(rc)); - data.rc = rc; - } - pcmk_free_ipc_api(controld_api); - } - - return data.rc; -} - -int -pcmk__start_election(pcmk__output_t *out) -{ - data_t data = { - .out = out, - .mainloop = NULL, - .rc = pcmk_rc_ok, - }; - pcmk_ipc_api_t *controld_api = ipc_connect(&data, pcmk_ipc_controld, NULL); - - if (controld_api != NULL) { - int rc = pcmk_controld_api_start_election(controld_api); - if (rc != pcmk_rc_ok) { - out->err(out, "error: Command failed: %s", pcmk_rc_str(rc)); - data.rc = rc; - } - - pcmk_free_ipc_api(controld_api); - } - - return data.rc; -} diff --git a/lib/pacemaker/pcmk_fence.c b/lib/pacemaker/pcmk_fence.c index d591379..7beedff 100644 --- a/lib/pacemaker/pcmk_fence.c +++ b/lib/pacemaker/pcmk_fence.c @@ -247,8 +247,6 @@ pcmk_fence_history(xmlNodePtr *xml, stonith_t *st, char *target, unsigned int ti return rc; } - stonith__register_messages(out); - out->quiet = quiet; rc = pcmk__fence_history(out, st, target, timeout, verbose, broadcast, cleanup); @@ -289,8 +287,6 @@ pcmk_fence_installed(xmlNodePtr *xml, stonith_t *st, unsigned int timeout) { return rc; } - stonith__register_messages(out); - rc = pcmk__fence_installed(out, st, timeout); pcmk__out_epilogue(out, xml, rc); return rc; @@ -325,8 +321,6 @@ pcmk_fence_last(xmlNodePtr *xml, const char *target, bool as_nodeid) { return rc; } - stonith__register_messages(out); - rc = pcmk__fence_last(out, target, as_nodeid); pcmk__out_epilogue(out, xml, rc); return rc; @@ -370,8 +364,6 @@ pcmk_fence_list_targets(xmlNodePtr *xml, stonith_t *st, const char *device_id, return rc; } - stonith__register_messages(out); - rc = pcmk__fence_list_targets(out, st, device_id, timeout); pcmk__out_epilogue(out, xml, rc); return rc; @@ -406,8 +398,6 @@ pcmk_fence_metadata(xmlNodePtr *xml, stonith_t *st, char *agent, return rc; } - stonith__register_messages(out); - rc = pcmk__fence_metadata(out, st, agent, timeout); pcmk__out_epilogue(out, xml, rc); return rc; @@ -452,8 +442,6 @@ pcmk_fence_registered(xmlNodePtr *xml, stonith_t *st, char *target, return rc; } - stonith__register_messages(out); - rc = pcmk__fence_registered(out, st, target, timeout); pcmk__out_epilogue(out, xml, rc); return rc; @@ -513,8 +501,6 @@ pcmk_fence_validate(xmlNodePtr *xml, stonith_t *st, const char *agent, return rc; } - stonith__register_messages(out); - rc = pcmk__fence_validate(out, st, agent, id, params, timeout); pcmk__out_epilogue(out, xml, rc); return rc; diff --git a/lib/pacemaker/pcmk_output.c b/lib/pacemaker/pcmk_output.c index bc4b91a..adf4c34 100644 --- a/lib/pacemaker/pcmk_output.c +++ b/lib/pacemaker/pcmk_output.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 the Pacemaker project contributors + * Copyright 2019-2020 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -12,9 +12,8 @@ #include #include #include -#include #include -#include +#include pcmk__supported_format_t pcmk__out_formats[] = { PCMK__SUPPORTED_FORMAT_XML, @@ -35,6 +34,7 @@ pcmk__out_prologue(pcmk__output_t **out, xmlNodePtr *xml) { return rc; } + stonith__register_messages(*out); return rc; } @@ -46,627 +46,3 @@ pcmk__out_epilogue(pcmk__output_t *out, xmlNodePtr *xml, int retval) { pcmk__output_free(out); } - -static char * -colocations_header(pe_resource_t *rsc, pcmk__colocation_t *cons, - gboolean dependents) { - char *score = NULL; - char *retval = NULL; - - score = score2char(cons->score); - if (cons->role_rh > RSC_ROLE_STARTED) { - retval = crm_strdup_printf("%s (score=%s, %s role=%s, id=%s)", - rsc->id, score, dependents ? "needs" : "with", - role2text(cons->role_rh), cons->id); - } else { - retval = crm_strdup_printf("%s (score=%s, id=%s)", - rsc->id, score, cons->id); - } - - free(score); - return retval; -} - -static void -colocations_xml_node(pcmk__output_t *out, pe_resource_t *rsc, - pcmk__colocation_t *cons) { - char *score = NULL; - xmlNodePtr node = NULL; - - score = score2char(cons->score); - node = pcmk__output_create_xml_node(out, XML_CONS_TAG_RSC_DEPEND, - "id", cons->id, - "rsc", cons->rsc_lh->id, - "with-rsc", cons->rsc_rh->id, - "score", score, - NULL); - - if (cons->node_attribute) { - xmlSetProp(node, (pcmkXmlStr) "node-attribute", (pcmkXmlStr) cons->node_attribute); - } - - if (cons->role_lh != RSC_ROLE_UNKNOWN) { - xmlSetProp(node, (pcmkXmlStr) "rsc-role", (pcmkXmlStr) role2text(cons->role_lh)); - } - - if (cons->role_rh != RSC_ROLE_UNKNOWN) { - xmlSetProp(node, (pcmkXmlStr) "with-rsc-role", (pcmkXmlStr) role2text(cons->role_rh)); - } - - free(score); -} - -static int -do_locations_list_xml(pcmk__output_t *out, pe_resource_t *rsc, bool add_header) -{ - GList *lpc = NULL; - GList *list = rsc->rsc_location; - int rc = pcmk_rc_no_output; - - for (lpc = list; lpc != NULL; lpc = lpc->next) { - pe__location_t *cons = lpc->data; - - GList *lpc2 = NULL; - - for (lpc2 = cons->node_list_rh; lpc2 != NULL; lpc2 = lpc2->next) { - pe_node_t *node = (pe_node_t *) lpc2->data; - char *score = score2char(node->weight); - - if (add_header) { - PCMK__OUTPUT_LIST_HEADER(out, FALSE, rc, "locations"); - } - - pcmk__output_create_xml_node(out, XML_CONS_TAG_RSC_LOCATION, - "node", node->details->uname, - "rsc", rsc->id, - "id", cons->id, - "score", score, - NULL); - free(score); - } - } - - if (add_header) { - PCMK__OUTPUT_LIST_FOOTER(out, rc); - } - - return rc; -} - -PCMK__OUTPUT_ARGS("rsc-is-colocated-with-list", "pe_resource_t *", "gboolean") -static int -rsc_is_colocated_with_list(pcmk__output_t *out, va_list args) { - pe_resource_t *rsc = va_arg(args, pe_resource_t *); - gboolean recursive = va_arg(args, gboolean); - - int rc = pcmk_rc_no_output; - - if (pcmk_is_set(rsc->flags, pe_rsc_allocating)) { - return rc; - } - - pe__set_resource_flags(rsc, pe_rsc_allocating); - for (GList *lpc = rsc->rsc_cons; lpc != NULL; lpc = lpc->next) { - pcmk__colocation_t *cons = (pcmk__colocation_t *) lpc->data; - char *hdr = NULL; - - PCMK__OUTPUT_LIST_HEADER(out, FALSE, rc, "Resources %s is colocated with", rsc->id); - - if (pcmk_is_set(cons->rsc_rh->flags, pe_rsc_allocating)) { - out->list_item(out, NULL, "%s (id=%s - loop)", cons->rsc_rh->id, cons->id); - continue; - } - - hdr = colocations_header(cons->rsc_rh, cons, FALSE); - out->list_item(out, NULL, "%s", hdr); - free(hdr); - - /* Empty list header just for indentation of information about this resource. */ - out->begin_list(out, NULL, NULL, NULL); - - out->message(out, "locations-list", cons->rsc_rh); - if (recursive) { - out->message(out, "rsc-is-colocated-with-list", cons->rsc_rh, recursive); - } - - out->end_list(out); - } - - PCMK__OUTPUT_LIST_FOOTER(out, rc); - return rc; -} - -PCMK__OUTPUT_ARGS("rsc-is-colocated-with-list", "pe_resource_t *", "gboolean") -static int -rsc_is_colocated_with_list_xml(pcmk__output_t *out, va_list args) { - pe_resource_t *rsc = va_arg(args, pe_resource_t *); - gboolean recursive = va_arg(args, gboolean); - - int rc = pcmk_rc_no_output; - - if (pcmk_is_set(rsc->flags, pe_rsc_allocating)) { - return rc; - } - - pe__set_resource_flags(rsc, pe_rsc_allocating); - for (GList *lpc = rsc->rsc_cons; lpc != NULL; lpc = lpc->next) { - pcmk__colocation_t *cons = (pcmk__colocation_t *) lpc->data; - - if (pcmk_is_set(cons->rsc_rh->flags, pe_rsc_allocating)) { - colocations_xml_node(out, cons->rsc_rh, cons); - continue; - } - - colocations_xml_node(out, cons->rsc_rh, cons); - do_locations_list_xml(out, cons->rsc_rh, false); - - if (recursive) { - out->message(out, "rsc-is-colocated-with-list", cons->rsc_rh, recursive); - } - } - - return rc; -} - -PCMK__OUTPUT_ARGS("rscs-colocated-with-list", "pe_resource_t *", "gboolean") -static int -rscs_colocated_with_list(pcmk__output_t *out, va_list args) { - pe_resource_t *rsc = va_arg(args, pe_resource_t *); - gboolean recursive = va_arg(args, gboolean); - - int rc = pcmk_rc_no_output; - - if (pcmk_is_set(rsc->flags, pe_rsc_allocating)) { - return rc; - } - - pe__set_resource_flags(rsc, pe_rsc_allocating); - for (GList *lpc = rsc->rsc_cons_lhs; lpc != NULL; lpc = lpc->next) { - pcmk__colocation_t *cons = (pcmk__colocation_t *) lpc->data; - char *hdr = NULL; - - PCMK__OUTPUT_LIST_HEADER(out, FALSE, rc, "Resources colocated with %s", rsc->id); - - if (pcmk_is_set(cons->rsc_lh->flags, pe_rsc_allocating)) { - out->list_item(out, NULL, "%s (id=%s - loop)", cons->rsc_lh->id, cons->id); - continue; - } - - hdr = colocations_header(cons->rsc_lh, cons, TRUE); - out->list_item(out, NULL, "%s", hdr); - free(hdr); - - /* Empty list header just for indentation of information about this resource. */ - out->begin_list(out, NULL, NULL, NULL); - - out->message(out, "locations-list", cons->rsc_lh); - if (recursive) { - out->message(out, "rscs-colocated-with-list", cons->rsc_lh, recursive); - } - - out->end_list(out); - } - - PCMK__OUTPUT_LIST_FOOTER(out, rc); - return rc; -} - -PCMK__OUTPUT_ARGS("rscs-colocated-with-list", "pe_resource_t *", "gboolean") -static int -rscs_colocated_with_list_xml(pcmk__output_t *out, va_list args) { - pe_resource_t *rsc = va_arg(args, pe_resource_t *); - gboolean recursive = va_arg(args, gboolean); - - int rc = pcmk_rc_no_output; - - if (pcmk_is_set(rsc->flags, pe_rsc_allocating)) { - return rc; - } - - pe__set_resource_flags(rsc, pe_rsc_allocating); - for (GList *lpc = rsc->rsc_cons_lhs; lpc != NULL; lpc = lpc->next) { - pcmk__colocation_t *cons = (pcmk__colocation_t *) lpc->data; - - if (pcmk_is_set(cons->rsc_lh->flags, pe_rsc_allocating)) { - colocations_xml_node(out, cons->rsc_lh, cons); - continue; - } - - colocations_xml_node(out, cons->rsc_lh, cons); - do_locations_list_xml(out, cons->rsc_lh, false); - - if (recursive) { - out->message(out, "rscs-colocated-with-list", cons->rsc_lh, recursive); - } - } - - return rc; -} - -PCMK__OUTPUT_ARGS("locations-list", "pe_resource_t *") -static int -locations_list(pcmk__output_t *out, va_list args) { - pe_resource_t *rsc = va_arg(args, pe_resource_t *); - - GList *lpc = NULL; - GList *list = rsc->rsc_location; - int rc = pcmk_rc_no_output; - - for (lpc = list; lpc != NULL; lpc = lpc->next) { - pe__location_t *cons = lpc->data; - - GList *lpc2 = NULL; - - for (lpc2 = cons->node_list_rh; lpc2 != NULL; lpc2 = lpc2->next) { - pe_node_t *node = (pe_node_t *) lpc2->data; - char *score = score2char(node->weight); - - PCMK__OUTPUT_LIST_HEADER(out, FALSE, rc, "Locations"); - out->list_item(out, NULL, "Node %s (score=%s, id=%s, rsc=%s)", - node->details->uname, score, cons->id, rsc->id); - free(score); - } - } - - PCMK__OUTPUT_LIST_FOOTER(out, rc); - return rc; -} - -PCMK__OUTPUT_ARGS("locations-list", "pe_resource_t *") -static int -locations_list_xml(pcmk__output_t *out, va_list args) { - pe_resource_t *rsc = va_arg(args, pe_resource_t *); - return do_locations_list_xml(out, rsc, true); -} - -PCMK__OUTPUT_ARGS("stacks-constraints", "pe_resource_t *", "pe_working_set_t *", "gboolean") -static int -stacks_and_constraints(pcmk__output_t *out, va_list args) { - pe_resource_t *rsc = va_arg(args, pe_resource_t *); - pe_working_set_t *data_set = va_arg(args, pe_working_set_t *); - gboolean recursive = va_arg(args, gboolean); - - xmlNodePtr cib_constraints = get_object_root(XML_CIB_TAG_CONSTRAINTS, - data_set->input); - - unpack_constraints(cib_constraints, data_set); - - // Constraints apply to group/clone, not member/instance - rsc = uber_parent(rsc); - - out->message(out, "locations-list", rsc); - - pe__clear_resource_flags_on_all(data_set, pe_rsc_allocating); - out->message(out, "rscs-colocated-with-list", rsc, recursive); - - pe__clear_resource_flags_on_all(data_set, pe_rsc_allocating); - out->message(out, "rsc-is-colocated-with-list", rsc, recursive); - return pcmk_rc_ok; -} - -PCMK__OUTPUT_ARGS("stacks-constraints", "pe_resource_t *", "pe_working_set_t *", "gboolean") -static int -stacks_and_constraints_xml(pcmk__output_t *out, va_list args) { - pe_resource_t *rsc = va_arg(args, pe_resource_t *); - pe_working_set_t *data_set = va_arg(args, pe_working_set_t *); - gboolean recursive = va_arg(args, gboolean); - - xmlNodePtr cib_constraints = get_object_root(XML_CIB_TAG_CONSTRAINTS, - data_set->input); - - unpack_constraints(cib_constraints, data_set); - - // Constraints apply to group/clone, not member/instance - rsc = uber_parent(rsc); - - pcmk__output_xml_create_parent(out, "constraints", NULL); - do_locations_list_xml(out, rsc, false); - - pe__clear_resource_flags_on_all(data_set, pe_rsc_allocating); - out->message(out, "rscs-colocated-with-list", rsc, recursive); - - pe__clear_resource_flags_on_all(data_set, pe_rsc_allocating); - out->message(out, "rsc-is-colocated-with-list", rsc, recursive); - - pcmk__output_xml_pop_parent(out); - return pcmk_rc_ok; -} - -PCMK__OUTPUT_ARGS("health", "const char *", "const char *", "const char *", "const char *") -static int -health_text(pcmk__output_t *out, va_list args) -{ - const char *sys_from = va_arg(args, const char *); - const char *host_from = va_arg(args, const char *); - const char *fsa_state = va_arg(args, const char *); - const char *result = va_arg(args, const char *); - - if (!out->is_quiet(out)) { - out->info(out, "Status of %s@%s: %s (%s)", crm_str(sys_from), - crm_str(host_from), crm_str(fsa_state), crm_str(result)); - } else if (fsa_state != NULL) { - out->info(out, "%s", fsa_state); - } - - return pcmk_rc_ok; -} - -PCMK__OUTPUT_ARGS("health", "const char *", "const char *", "const char *", "const char *") -static int -health_xml(pcmk__output_t *out, va_list args) -{ - const char *sys_from = va_arg(args, const char *); - const char *host_from = va_arg(args, const char *); - const char *fsa_state = va_arg(args, const char *); - const char *result = va_arg(args, const char *); - - pcmk__output_create_xml_node(out, crm_str(sys_from), - "node_name", crm_str(host_from), - "state", crm_str(fsa_state), - "result", crm_str(result), - NULL); - return pcmk_rc_ok; -} - -PCMK__OUTPUT_ARGS("pacemakerd-health", "const char *", "const char *", "const char *") -static int -pacemakerd_health_text(pcmk__output_t *out, va_list args) -{ - const char *sys_from = va_arg(args, const char *); - const char *state = va_arg(args, const char *); - const char *last_updated = va_arg(args, const char *); - - if (!out->is_quiet(out)) { - out->info(out, "Status of %s: '%s' %s %s", crm_str(sys_from), - crm_str(state), (!pcmk__str_empty(last_updated))? - "last updated":"", crm_str(last_updated)); - } else { - out->info(out, "%s", crm_str(state)); - } - - return pcmk_rc_ok; -} - -PCMK__OUTPUT_ARGS("pacemakerd-health", "const char *", "const char *", "const char *") -static int -pacemakerd_health_xml(pcmk__output_t *out, va_list args) -{ - const char *sys_from = va_arg(args, const char *); - const char *state = va_arg(args, const char *); - const char *last_updated = va_arg(args, const char *); - - pcmk__output_create_xml_node(out, crm_str(sys_from), - "state", crm_str(state), - "last_updated", crm_str(last_updated), - NULL); - return pcmk_rc_ok; -} - -PCMK__OUTPUT_ARGS("dc", "const char *") -static int -dc_text(pcmk__output_t *out, va_list args) -{ - const char *dc = va_arg(args, const char *); - - if (!out->is_quiet(out)) { - out->info(out, "Designated Controller is: %s", crm_str(dc)); - } else if (dc != NULL) { - out->info(out, "%s", dc); - } - - return pcmk_rc_ok; -} - -PCMK__OUTPUT_ARGS("dc", "const char *") -static int -dc_xml(pcmk__output_t *out, va_list args) -{ - const char *dc = va_arg(args, const char *); - - pcmk__output_create_xml_node(out, "dc", - "node_name", crm_str(dc), - NULL); - return pcmk_rc_ok; -} - - -PCMK__OUTPUT_ARGS("crmadmin-node-list", "xmlNodePtr", "gboolean") -static int -crmadmin_node_list(pcmk__output_t *out, va_list args) -{ - xmlNodePtr xml_node = va_arg(args, xmlNodePtr); - gboolean BASH_EXPORT = va_arg(args, gboolean); - - int found = 0; - xmlNode *node = NULL; - xmlNode *nodes = get_object_root(XML_CIB_TAG_NODES, xml_node); - - out->begin_list(out, NULL, NULL, "nodes"); - - for (node = first_named_child(nodes, XML_CIB_TAG_NODE); node != NULL; - node = crm_next_same_xml(node)) { - const char *node_type = BASH_EXPORT ? NULL : - crm_element_value(node, XML_ATTR_TYPE); - out->message(out, "crmadmin-node", node_type, - crm_str(crm_element_value(node, XML_ATTR_UNAME)), - crm_str(crm_element_value(node, XML_ATTR_ID)), - BASH_EXPORT); - - found++; - } - // @TODO List Pacemaker Remote nodes that don't have a entry - - out->end_list(out); - - if (found == 0) { - out->info(out, "No nodes configured"); - } - - return pcmk_rc_ok; -} - -PCMK__OUTPUT_ARGS("crmadmin-node", "const char *", "const char *", "const char *", "gboolean") -static int -crmadmin_node_text(pcmk__output_t *out, va_list args) -{ - const char *type = va_arg(args, const char *); - const char *name = va_arg(args, const char *); - const char *id = va_arg(args, const char *); - gboolean BASH_EXPORT = va_arg(args, gboolean); - - if (BASH_EXPORT) { - out->info(out, "export %s=%s", crm_str(name), crm_str(id)); - } else { - out->info(out, "%s node: %s (%s)", type ? type : "member", - crm_str(name), crm_str(id)); - } - - return pcmk_rc_ok; -} - -PCMK__OUTPUT_ARGS("crmadmin-node", "const char *", "const char *", "const char *", "gboolean") -static int -crmadmin_node_xml(pcmk__output_t *out, va_list args) -{ - const char *type = va_arg(args, const char *); - const char *name = va_arg(args, const char *); - const char *id = va_arg(args, const char *); - - pcmk__output_create_xml_node(out, "node", - "type", type ? type : "member", - "name", crm_str(name), - "id", crm_str(id), - NULL); - return pcmk_rc_ok; -} - -PCMK__OUTPUT_ARGS("digests", "pe_resource_t *", "pe_node_t *", "const char *", - "guint", "op_digest_cache_t *") -static int -digests_text(pcmk__output_t *out, va_list args) -{ - pe_resource_t *rsc = va_arg(args, pe_resource_t *); - pe_node_t *node = va_arg(args, pe_node_t *); - const char *task = va_arg(args, const char *); - guint interval_ms = va_arg(args, guint); - op_digest_cache_t *digests = va_arg(args, op_digest_cache_t *); - - char *action_desc = NULL; - const char *rsc_desc = "unknown resource"; - const char *node_desc = "unknown node"; - - if (interval_ms != 0) { - action_desc = crm_strdup_printf("%ums-interval %s action", interval_ms, - ((task == NULL)? "unknown" : task)); - } else if (pcmk__str_eq(task, "monitor", pcmk__str_none)) { - action_desc = strdup("probe action"); - } else { - action_desc = crm_strdup_printf("%s action", - ((task == NULL)? "unknown" : task)); - } - if ((rsc != NULL) && (rsc->id != NULL)) { - rsc_desc = rsc->id; - } - if ((node != NULL) && (node->details->uname != NULL)) { - node_desc = node->details->uname; - } - out->begin_list(out, NULL, NULL, "Digests for %s %s on %s", - rsc_desc, action_desc, node_desc); - free(action_desc); - - if (digests == NULL) { - out->list_item(out, NULL, "none"); - out->end_list(out); - return pcmk_rc_ok; - } - if (digests->digest_all_calc != NULL) { - out->list_item(out, NULL, "%s (all parameters)", - digests->digest_all_calc); - } - if (digests->digest_secure_calc != NULL) { - out->list_item(out, NULL, "%s (non-private parameters)", - digests->digest_secure_calc); - } - if (digests->digest_restart_calc != NULL) { - out->list_item(out, NULL, "%s (non-reloadable parameters)", - digests->digest_restart_calc); - } - out->end_list(out); - return pcmk_rc_ok; -} - -static void -add_digest_xml(xmlNode *parent, const char *type, const char *digest, - xmlNode *digest_source) -{ - if (digest != NULL) { - xmlNodePtr digest_xml = create_xml_node(parent, "digest"); - - crm_xml_add(digest_xml, "type", ((type == NULL)? "unspecified" : type)); - crm_xml_add(digest_xml, "hash", digest); - if (digest_source != NULL) { - add_node_copy(digest_xml, digest_source); - } - } -} - -PCMK__OUTPUT_ARGS("digests", "pe_resource_t *", "pe_node_t *", "const char *", - "guint", "op_digest_cache_t *") -static int -digests_xml(pcmk__output_t *out, va_list args) -{ - pe_resource_t *rsc = va_arg(args, pe_resource_t *); - pe_node_t *node = va_arg(args, pe_node_t *); - const char *task = va_arg(args, const char *); - guint interval_ms = va_arg(args, guint); - op_digest_cache_t *digests = va_arg(args, op_digest_cache_t *); - - char *interval_s = crm_strdup_printf("%ums", interval_ms); - xmlNode *xml = NULL; - - xml = pcmk__output_create_xml_node(out, "digests", - "resource", crm_str(rsc->id), - "node", crm_str(node->details->uname), - "task", crm_str(task), - "interval", interval_s, - NULL); - free(interval_s); - if (digests != NULL) { - add_digest_xml(xml, "all", digests->digest_all_calc, - digests->params_all); - add_digest_xml(xml, "nonprivate", digests->digest_secure_calc, - digests->params_secure); - add_digest_xml(xml, "nonreloadable", digests->digest_restart_calc, - digests->params_restart); - } - return pcmk_rc_ok; -} - -static pcmk__message_entry_t fmt_functions[] = { - { "rsc-is-colocated-with-list", "default", rsc_is_colocated_with_list }, - { "rsc-is-colocated-with-list", "xml", rsc_is_colocated_with_list_xml }, - { "rscs-colocated-with-list", "default", rscs_colocated_with_list }, - { "rscs-colocated-with-list", "xml", rscs_colocated_with_list_xml }, - { "locations-list", "default", locations_list }, - { "locations-list", "xml", locations_list_xml }, - { "stacks-constraints", "default", stacks_and_constraints }, - { "stacks-constraints", "xml", stacks_and_constraints_xml }, - { "health", "default", health_text }, - { "health", "xml", health_xml }, - { "pacemakerd-health", "default", pacemakerd_health_text }, - { "pacemakerd-health", "xml", pacemakerd_health_xml }, - { "dc", "default", dc_text }, - { "dc", "xml", dc_xml }, - { "crmadmin-node-list", "default", crmadmin_node_list }, - { "crmadmin-node", "default", crmadmin_node_text }, - { "crmadmin-node", "xml", crmadmin_node_xml }, - { "digests", "default", digests_text }, - { "digests", "xml", digests_xml }, - - { NULL, NULL, NULL } -}; - -void -pcmk__register_lib_messages(pcmk__output_t *out) { - pcmk__register_messages(out, fmt_functions); -} diff --git a/lib/pacemaker/pcmk_resource.c b/lib/pacemaker/pcmk_resource.c deleted file mode 100644 index 197edf8..0000000 --- a/lib/pacemaker/pcmk_resource.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright 2021 the Pacemaker project contributors - * - * The version control history for this file may have further details. - * - * This source code is licensed under the GNU General Public License version 2 - * or later (GPLv2+) WITHOUT ANY WARRANTY. - */ - -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -// Search path for resource operation history (takes node name and resource ID) -#define XPATH_OP_HISTORY "//" XML_CIB_TAG_STATUS \ - "/" XML_CIB_TAG_STATE "[@" XML_ATTR_UNAME "='%s']" \ - "/" XML_CIB_TAG_LRM "/" XML_LRM_TAG_RESOURCES \ - "/" XML_LRM_TAG_RESOURCE "[@" XML_ATTR_ID "='%s']" - -static xmlNode * -best_op(pe_resource_t *rsc, pe_node_t *node, pe_working_set_t *data_set) -{ - char *xpath = NULL; - xmlNode *history = NULL; - xmlNode *best = NULL; - - // Find node's resource history - xpath = crm_strdup_printf(XPATH_OP_HISTORY, node->details->uname, rsc->id); - history = get_xpath_object(xpath, data_set->input, LOG_NEVER); - free(xpath); - - // Examine each history entry - for (xmlNode *lrm_rsc_op = first_named_child(history, XML_LRM_TAG_RSC_OP); - lrm_rsc_op != NULL; lrm_rsc_op = crm_next_same_xml(lrm_rsc_op)) { - - const char *digest = crm_element_value(lrm_rsc_op, - XML_LRM_ATTR_RESTART_DIGEST); - guint interval_ms = 0; - - crm_element_value_ms(lrm_rsc_op, XML_LRM_ATTR_INTERVAL, &interval_ms); - - if (pcmk__ends_with(ID(lrm_rsc_op), "_last_failure_0") - || (interval_ms != 0)) { - - // Only use last failure or recurring op if nothing else available - if (best == NULL) { - best = lrm_rsc_op; - } - continue; - } - - best = lrm_rsc_op; - if (digest != NULL) { - // Any non-recurring action with a restart digest is sufficient - break; - } - } - return best; -} - -/*! - * \internal - * \brief Calculate and output resource operation digests - * - * \param[in] out Output object - * \param[in] rsc Resource to calculate digests for - * \param[in] node Node whose operation history should be used - * \param[in] overrides Hash table of configuration parameters to override - * \param[in] data_set Cluster working set (with status) - * - * \return Standard Pacemaker return code - */ -int -pcmk__resource_digests(pcmk__output_t *out, pe_resource_t *rsc, - pe_node_t *node, GHashTable *overrides, - pe_working_set_t *data_set) -{ - const char *task = NULL; - xmlNode *xml_op = NULL; - op_digest_cache_t *digests = NULL; - guint interval_ms = 0; - int rc = pcmk_rc_ok; - - if ((out == NULL) || (rsc == NULL) || (node == NULL) || (data_set == NULL)) { - return EINVAL; - } - if (rsc->variant != pe_native) { - // Only primitives get operation digests - return EOPNOTSUPP; - } - - // Find XML of operation history to use - xml_op = best_op(rsc, node, data_set); - - // Generate an operation key - if (xml_op != NULL) { - task = crm_element_value(xml_op, XML_LRM_ATTR_TASK); - crm_element_value_ms(xml_op, XML_LRM_ATTR_INTERVAL_MS, &interval_ms); - } - if (task == NULL) { // Assume start if no history is available - task = RSC_START; - interval_ms = 0; - } - - // Calculate and show digests - digests = pe__calculate_digests(rsc, task, &interval_ms, node, xml_op, - overrides, true, data_set); - rc = out->message(out, "digests", rsc, node, task, interval_ms, digests); - - pe__free_digests(digests); - return rc; -} - -int -pcmk_resource_digests(xmlNodePtr *xml, pe_resource_t *rsc, - pe_node_t *node, GHashTable *overrides, - pe_working_set_t *data_set) -{ - pcmk__output_t *out = NULL; - int rc = pcmk_rc_ok; - - rc = pcmk__out_prologue(&out, xml); - if (rc != pcmk_rc_ok) { - return rc; - } - pcmk__register_lib_messages(out); - rc = pcmk__resource_digests(out, rsc, node, overrides, data_set); - pcmk__out_epilogue(out, xml, rc); - return rc; -} diff --git a/lib/pacemaker/pcmk_sched_allocate.c b/lib/pacemaker/pcmk_sched_allocate.c index 22f284a..a0fb5ab 100644 --- a/lib/pacemaker/pcmk_sched_allocate.c +++ b/lib/pacemaker/pcmk_sched_allocate.c @@ -470,7 +470,7 @@ check_actions_for(xmlNode * rsc_entry, pe_resource_t * rsc, pe_node_t * node, pe * has changed, clear any fail count so they can be retried fresh. */ - if (pe__bundle_needs_remote_name(rsc, data_set)) { + if (pe__bundle_needs_remote_name(rsc)) { /* We haven't allocated resources to nodes yet, so if the * REMOTE_CONTAINER_HACK is used, we may calculate the digest * based on the literal "#uname" value rather than the properly diff --git a/lib/pacemaker/pcmk_sched_bundle.c b/lib/pacemaker/pcmk_sched_bundle.c index 955a7d3..e9b8a74 100644 --- a/lib/pacemaker/pcmk_sched_bundle.c +++ b/lib/pacemaker/pcmk_sched_bundle.c @@ -1,5 +1,5 @@ /* - * Copyright 2004-2021 the Pacemaker project contributors + * Copyright 2004-2020 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -9,8 +9,6 @@ #include -#include - #include #include @@ -142,10 +140,10 @@ pcmk__bundle_allocate(pe_resource_t *rsc, pe_node_t *prefer, * host because pacemaker-remoted only supports a single * active connection */ - pcmk__new_colocation("child-remote-with-docker-remote", NULL, - INFINITY, replica->remote, - container_host->details->remote_rsc, NULL, - NULL, true, data_set); + rsc_colocation_new("child-remote-with-docker-remote", NULL, + INFINITY, replica->remote, + container_host->details->remote_rsc, NULL, NULL, + data_set); } if (replica->remote) { @@ -312,9 +310,8 @@ pcmk__bundle_internal_constraints(pe_resource_t *rsc, new_rsc_order(replica->container, RSC_STOP, replica->ip, RSC_STOP, pe_order_implies_first|pe_order_preserve, data_set); - pcmk__new_colocation("ip-with-docker", NULL, INFINITY, replica->ip, - replica->container, NULL, NULL, true, - data_set); + rsc_colocation_new("ip-with-docker", NULL, INFINITY, replica->ip, + replica->container, NULL, NULL, data_set); } if (replica->remote) { @@ -428,7 +425,7 @@ compatible_replica(pe_resource_t *rsc_lh, pe_resource_t *rsc, void pcmk__bundle_rsc_colocation_lh(pe_resource_t *rsc, pe_resource_t *rsc_rh, - pcmk__colocation_t *constraint, + rsc_colocation_t *constraint, pe_working_set_t *data_set) { /* -- Never called -- @@ -472,7 +469,7 @@ int copies_per_node(pe_resource_t * rsc) void pcmk__bundle_rsc_colocation_rh(pe_resource_t *rsc_lh, pe_resource_t *rsc, - pcmk__colocation_t *constraint, + rsc_colocation_t *constraint, pe_working_set_t *data_set) { GListPtr allocated_rhs = NULL; @@ -483,6 +480,9 @@ pcmk__bundle_rsc_colocation_rh(pe_resource_t *rsc_lh, pe_resource_t *rsc, CRM_CHECK(rsc != NULL, pe_err("rsc was NULL for %s", constraint->id); return); CRM_ASSERT(rsc_lh->variant == pe_native); + if (constraint->score == 0) { + return; + } if (pcmk_is_set(rsc->flags, pe_rsc_provisional)) { pe_rsc_trace(rsc, "%s is still provisional", rsc->id); return; @@ -911,7 +911,7 @@ pcmk__bundle_expand(pe_resource_t *rsc, pe_working_set_t * data_set) CRM_ASSERT(replica); if (replica->remote && replica->container - && pe__bundle_needs_remote_name(replica->remote, data_set)) { + && pe__bundle_needs_remote_name(replica->remote)) { /* REMOTE_CONTAINER_HACK: Allow remote nodes to run containers that * run pacemaker-remoted inside, without needing a separate IP for @@ -923,22 +923,12 @@ pcmk__bundle_expand(pe_resource_t *rsc, pe_working_set_t * data_set) replica->remote->xml, LOG_ERR); const char *calculated_addr = NULL; - // Replace the value in replica->remote->xml (if appropriate) calculated_addr = pe__add_bundle_remote_name(replica->remote, - data_set, nvpair, "value"); if (calculated_addr) { - /* Since this is for the bundle as a resource, and not any - * particular action, replace the value in the default - * parameters (not evaluated for node). action2xml() will grab - * it from there to replace it in node-evaluated parameters. - */ - GHashTable *params = pe_rsc_params(replica->remote, - NULL, data_set); - crm_trace("Set address for bundle connection %s to bundle host %s", replica->remote->id, calculated_addr); - g_hash_table_replace(params, + g_hash_table_replace(replica->remote->parameters, strdup(XML_RSC_ATTR_REMOTE_RA_ADDR), strdup(calculated_addr)); } else { diff --git a/lib/pacemaker/pcmk_sched_clone.c b/lib/pacemaker/pcmk_sched_clone.c index dd6ff48..e419a24 100644 --- a/lib/pacemaker/pcmk_sched_clone.c +++ b/lib/pacemaker/pcmk_sched_clone.c @@ -1,5 +1,5 @@ /* - * Copyright 2004-2021 the Pacemaker project contributors + * Copyright 2004-2020 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -237,8 +237,11 @@ sort_clone_instance(gconstpointer a, gconstpointer b, gpointer data_set) if(resource1->parent) { for (gIter = resource1->parent->rsc_cons; gIter; gIter = gIter->next) { - pcmk__colocation_t *constraint = (pcmk__colocation_t *) gIter->data; + rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data; + if (constraint->score == 0) { + continue; + } crm_trace("Applying %s to %s", constraint->id, resource1->id); hash1 = pcmk__native_merge_weights(constraint->rsc_rh, @@ -249,9 +252,9 @@ sort_clone_instance(gconstpointer a, gconstpointer b, gpointer data_set) } for (gIter = resource1->parent->rsc_cons_lhs; gIter; gIter = gIter->next) { - pcmk__colocation_t *constraint = (pcmk__colocation_t *) gIter->data; + rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data; - if (!pcmk__colocation_has_influence(constraint, resource1)) { + if (constraint->score == 0) { continue; } crm_trace("Applying %s to %s", constraint->id, resource1->id); @@ -266,7 +269,7 @@ sort_clone_instance(gconstpointer a, gconstpointer b, gpointer data_set) if(resource2->parent) { for (gIter = resource2->parent->rsc_cons; gIter; gIter = gIter->next) { - pcmk__colocation_t *constraint = (pcmk__colocation_t *) gIter->data; + rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data; crm_trace("Applying %s to %s", constraint->id, resource2->id); @@ -278,11 +281,8 @@ sort_clone_instance(gconstpointer a, gconstpointer b, gpointer data_set) } for (gIter = resource2->parent->rsc_cons_lhs; gIter; gIter = gIter->next) { - pcmk__colocation_t *constraint = (pcmk__colocation_t *) gIter->data; + rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data; - if (!pcmk__colocation_has_influence(constraint, resource2)) { - continue; - } crm_trace("Applying %s to %s", constraint->id, resource2->id); hash2 = pcmk__native_merge_weights(constraint->rsc_lh, @@ -499,8 +499,11 @@ append_parent_colocation(pe_resource_t * rsc, pe_resource_t * child, gboolean al gIter = rsc->rsc_cons; for (; gIter != NULL; gIter = gIter->next) { - pcmk__colocation_t *cons = (pcmk__colocation_t *) gIter->data; + rsc_colocation_t *cons = (rsc_colocation_t *) gIter->data; + if (cons->score == 0) { + continue; + } if (all || cons->score < 0 || cons->score == INFINITY) { child->rsc_cons = g_list_prepend(child->rsc_cons, cons); } @@ -508,10 +511,10 @@ append_parent_colocation(pe_resource_t * rsc, pe_resource_t * child, gboolean al gIter = rsc->rsc_cons_lhs; for (; gIter != NULL; gIter = gIter->next) { - pcmk__colocation_t *cons = (pcmk__colocation_t *) gIter->data; + rsc_colocation_t *cons = (rsc_colocation_t *) gIter->data; - if (!pcmk__colocation_has_influence(cons, child)) { - continue; + if (cons->score == 0) { + continue; } if (all || cons->score < 0) { child->rsc_cons_lhs = g_list_prepend(child->rsc_cons_lhs, cons); @@ -642,17 +645,20 @@ pcmk__clone_allocate(pe_resource_t *rsc, pe_node_t *prefer, * order to allocate clone instances */ for (GListPtr gIter = rsc->rsc_cons; gIter != NULL; gIter = gIter->next) { - pcmk__colocation_t *constraint = (pcmk__colocation_t *) gIter->data; + rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data; + if (constraint->score == 0) { + continue; + } pe_rsc_trace(rsc, "%s: Allocating %s first", rsc->id, constraint->rsc_rh->id); constraint->rsc_rh->cmds->allocate(constraint->rsc_rh, prefer, data_set); } for (GListPtr gIter = rsc->rsc_cons_lhs; gIter != NULL; gIter = gIter->next) { - pcmk__colocation_t *constraint = (pcmk__colocation_t *) gIter->data; + rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data; - if (!pcmk__colocation_has_influence(constraint, NULL)) { + if (constraint->score == 0) { continue; } rsc->allowed_nodes = @@ -1049,7 +1055,7 @@ find_compatible_child(pe_resource_t *local_child, pe_resource_t *rsc, void clone_rsc_colocation_lh(pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, - pcmk__colocation_t *constraint, + rsc_colocation_t *constraint, pe_working_set_t *data_set) { /* -- Never called -- @@ -1061,7 +1067,7 @@ clone_rsc_colocation_lh(pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, void clone_rsc_colocation_rh(pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, - pcmk__colocation_t *constraint, + rsc_colocation_t *constraint, pe_working_set_t *data_set) { GListPtr gIter = NULL; @@ -1073,6 +1079,9 @@ clone_rsc_colocation_rh(pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, CRM_CHECK(rsc_rh != NULL, pe_err("rsc_rh was NULL for %s", constraint->id); return); CRM_CHECK(rsc_lh->variant == pe_native, return); + if (constraint->score == 0) { + return; + } pe_rsc_trace(rsc_rh, "Processing constraint %s: %s -> %s %d", constraint->id, rsc_lh->id, rsc_rh->id, constraint->score); diff --git a/lib/pacemaker/pcmk_sched_constraints.c b/lib/pacemaker/pcmk_sched_constraints.c index ab6f74e..6ed2d8c 100644 --- a/lib/pacemaker/pcmk_sched_constraints.c +++ b/lib/pacemaker/pcmk_sched_constraints.c @@ -1,5 +1,5 @@ /* - * Copyright 2004-2021 the Pacemaker project contributors + * Copyright 2004-2020 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -11,7 +11,6 @@ #include #include -#include #include #include @@ -48,9 +47,7 @@ static pe__location_t *generate_location_rule(pe_resource_t *rsc, const char *discovery, crm_time_t *next_change, pe_working_set_t *data_set, - pe_re_match_data_t *match_data); -static void unpack_location(xmlNode *xml_obj, pe_working_set_t *data_set); -static void unpack_rsc_colocation(xmlNode *xml_obj, pe_working_set_t *data_set); + pe_match_data_t *match_data); static bool evaluate_lifetime(xmlNode *lifetime, pe_working_set_t *data_set) @@ -712,13 +709,11 @@ tag_to_set(xmlNode * xml_obj, xmlNode ** rsc_set, const char * attr, return TRUE; } -static void unpack_rsc_location(xmlNode *xml_obj, pe_resource_t *rsc_lh, - const char *role, const char *score, - pe_working_set_t *data_set, - pe_re_match_data_t *match_data); +static gboolean unpack_rsc_location(xmlNode * xml_obj, pe_resource_t * rsc_lh, const char * role, + const char * score, pe_working_set_t * data_set, pe_match_data_t * match_data); -static void -unpack_simple_location(xmlNode *xml_obj, pe_working_set_t *data_set) +static gboolean +unpack_simple_location(xmlNode * xml_obj, pe_working_set_t * data_set) { const char *id = crm_element_value(xml_obj, XML_ATTR_ID); const char *value = crm_element_value(xml_obj, XML_LOC_ATTR_SOURCE); @@ -726,7 +721,7 @@ unpack_simple_location(xmlNode *xml_obj, pe_working_set_t *data_set) if(value) { pe_resource_t *rsc_lh = pe_find_constraint_resource(data_set->resources, value); - unpack_rsc_location(xml_obj, rsc_lh, NULL, NULL, data_set, NULL); + return unpack_rsc_location(xml_obj, rsc_lh, NULL, NULL, data_set, NULL); } value = crm_element_value(xml_obj, XML_LOC_ATTR_SOURCE_PATTERN); @@ -746,7 +741,7 @@ unpack_simple_location(xmlNode *xml_obj, pe_working_set_t *data_set) " has invalid value '%s'", id, value); regfree(r_patt); free(r_patt); - return; + return FALSE; } for (rIter = data_set->resources; rIter; rIter = rIter->next) { @@ -770,9 +765,13 @@ unpack_simple_location(xmlNode *xml_obj, pe_working_set_t *data_set) .nregs = nregs, .pmatch = pmatch }; - + pe_match_data_t match_data = { + .re = &re_match_data, + .params = r->parameters, + .meta = r->meta, + }; crm_debug("'%s' matched '%s' for %s", r->id, value, id); - unpack_rsc_location(xml_obj, r, NULL, NULL, data_set, &re_match_data); + unpack_rsc_location(xml_obj, r, NULL, NULL, data_set, &match_data); } else if (invert && (status != 0)) { crm_debug("'%s' is an inverted match of '%s' for %s", r->id, value, id); @@ -788,12 +787,13 @@ unpack_simple_location(xmlNode *xml_obj, pe_working_set_t *data_set) regfree(r_patt); free(r_patt); } + + return FALSE; } -static void -unpack_rsc_location(xmlNode *xml_obj, pe_resource_t *rsc_lh, const char *role, - const char *score, pe_working_set_t *data_set, - pe_re_match_data_t *re_match_data) +static gboolean +unpack_rsc_location(xmlNode * xml_obj, pe_resource_t * rsc_lh, const char * role, + const char * score, pe_working_set_t * data_set, pe_match_data_t * match_data) { pe__location_t *location = NULL; const char *id_lh = crm_element_value(xml_obj, XML_LOC_ATTR_SOURCE); @@ -804,7 +804,7 @@ unpack_rsc_location(xmlNode *xml_obj, pe_resource_t *rsc_lh, const char *role, if (rsc_lh == NULL) { pcmk__config_warn("Ignoring constraint '%s' because resource '%s' " "does not exist", id, id_lh); - return; + return FALSE; } if (score == NULL) { @@ -816,7 +816,7 @@ unpack_rsc_location(xmlNode *xml_obj, pe_resource_t *rsc_lh, const char *role, pe_node_t *match = pe_find_node(data_set->nodes, node); if (!match) { - return; + return FALSE; } location = rsc2node_new(id, rsc_lh, score_i, discovery, match, data_set); @@ -833,7 +833,7 @@ unpack_rsc_location(xmlNode *xml_obj, pe_resource_t *rsc_lh, const char *role, empty = FALSE; crm_trace("Unpacking %s/%s", id, ID(rule_xml)); generate_location_rule(rsc_lh, rule_xml, discovery, next_change, - data_set, re_match_data); + data_set, match_data); } if (empty) { @@ -850,7 +850,7 @@ unpack_rsc_location(xmlNode *xml_obj, pe_resource_t *rsc_lh, const char *role, pe__update_recheck_time(t, data_set); } crm_time_free(next_change); - return; + return TRUE; } if (role == NULL) { @@ -860,7 +860,7 @@ unpack_rsc_location(xmlNode *xml_obj, pe_resource_t *rsc_lh, const char *role, if (location && role) { if (text2role(role) == RSC_ROLE_UNKNOWN) { pe_err("Invalid constraint %s: Bad role %s", id, role); - return; + return FALSE; } else { enum rsc_role_e r = text2role(role); @@ -877,6 +877,8 @@ unpack_rsc_location(xmlNode *xml_obj, pe_resource_t *rsc_lh, const char *role, } } } + + return TRUE; } static gboolean @@ -990,8 +992,8 @@ unpack_location_set(xmlNode * location, xmlNode * set, pe_working_set_t * data_s return TRUE; } -static void -unpack_location(xmlNode *xml_obj, pe_working_set_t *data_set) +gboolean +unpack_location(xmlNode * xml_obj, pe_working_set_t * data_set) { xmlNode *set = NULL; gboolean any_sets = FALSE; @@ -1000,7 +1002,7 @@ unpack_location(xmlNode *xml_obj, pe_working_set_t *data_set) xmlNode *expanded_xml = NULL; if (unpack_location_tags(xml_obj, &expanded_xml, data_set) == FALSE) { - return; + return FALSE; } if (expanded_xml) { @@ -1018,7 +1020,7 @@ unpack_location(xmlNode *xml_obj, pe_working_set_t *data_set) if (expanded_xml) { free_xml(expanded_xml); } - return; + return FALSE; } } } @@ -1029,8 +1031,10 @@ unpack_location(xmlNode *xml_obj, pe_working_set_t *data_set) } if (any_sets == FALSE) { - unpack_simple_location(xml_obj, data_set); + return unpack_simple_location(xml_obj, data_set); } + + return TRUE; } static int @@ -1064,8 +1068,7 @@ get_node_score(const char *rule, const char *score, gboolean raw, pe_node_t * no static pe__location_t * generate_location_rule(pe_resource_t *rsc, xmlNode *rule_xml, const char *discovery, crm_time_t *next_change, - pe_working_set_t *data_set, - pe_re_match_data_t *re_match_data) + pe_working_set_t *data_set, pe_match_data_t *match_data) { const char *rule_id = NULL; const char *score = NULL; @@ -1111,14 +1114,14 @@ generate_location_rule(pe_resource_t *rsc, xmlNode *rule_xml, return NULL; } - if ((re_match_data != NULL) && (re_match_data->nregs > 0) - && (re_match_data->pmatch[0].rm_so != -1) && !raw_score) { - - char *result = pe_expand_re_matches(score, re_match_data); + if (match_data && match_data->re && match_data->re->nregs > 0 && match_data->re->pmatch[0].rm_so != -1) { + if (raw_score == FALSE) { + char *result = pe_expand_re_matches(score, match_data->re); - if (result != NULL) { - score = result; - score_allocated = TRUE; + if (result) { + score = (const char *) result; + score_allocated = TRUE; + } } } @@ -1146,14 +1149,9 @@ generate_location_rule(pe_resource_t *rsc, xmlNode *rule_xml, for (gIter = data_set->nodes; gIter != NULL; gIter = gIter->next) { int score_f = 0; pe_node_t *node = (pe_node_t *) gIter->data; - pe_match_data_t match_data = { - .re = re_match_data, - .params = pe_rsc_params(rsc, node, data_set), - .meta = rsc->meta, - }; accept = pe_test_rule(rule_xml, node->details->attrs, RSC_ROLE_UNKNOWN, - data_set->now, next_change, &match_data); + data_set->now, next_change, match_data); crm_trace("Rule %s %s on %s", ID(rule_xml), accept ? "passed" : "failed", node->details->uname); @@ -1208,8 +1206,8 @@ generate_location_rule(pe_resource_t *rsc, xmlNode *rule_xml, static gint sort_cons_priority_lh(gconstpointer a, gconstpointer b) { - const pcmk__colocation_t *rsc_constraint1 = (const pcmk__colocation_t *) a; - const pcmk__colocation_t *rsc_constraint2 = (const pcmk__colocation_t *) b; + const rsc_colocation_t *rsc_constraint1 = (const rsc_colocation_t *)a; + const rsc_colocation_t *rsc_constraint2 = (const rsc_colocation_t *)b; if (a == NULL) { return 1; @@ -1256,8 +1254,8 @@ sort_cons_priority_lh(gconstpointer a, gconstpointer b) static gint sort_cons_priority_rh(gconstpointer a, gconstpointer b) { - const pcmk__colocation_t *rsc_constraint1 = (const pcmk__colocation_t *) a; - const pcmk__colocation_t *rsc_constraint2 = (const pcmk__colocation_t *) b; + const rsc_colocation_t *rsc_constraint1 = (const rsc_colocation_t *)a; + const rsc_colocation_t *rsc_constraint2 = (const rsc_colocation_t *)b; if (a == NULL) { return 1; @@ -1343,27 +1341,22 @@ anti_colocation_order(pe_resource_t * first_rsc, int first_role, } } -void -pcmk__new_colocation(const char *id, const char *node_attr, int score, - pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, - const char *state_lh, const char *state_rh, - bool influence, pe_working_set_t *data_set) +gboolean +rsc_colocation_new(const char *id, const char *node_attr, int score, + pe_resource_t * rsc_lh, pe_resource_t * rsc_rh, + const char *state_lh, const char *state_rh, pe_working_set_t * data_set) { - pcmk__colocation_t *new_con = NULL; + rsc_colocation_t *new_con = NULL; - if (score == 0) { - crm_trace("Ignoring colocation '%s' because score is 0", id); - return; - } if ((rsc_lh == NULL) || (rsc_rh == NULL)) { pcmk__config_err("Ignoring colocation '%s' because resource " "does not exist", id); - return; + return FALSE; } - new_con = calloc(1, sizeof(pcmk__colocation_t)); + new_con = calloc(1, sizeof(rsc_colocation_t)); if (new_con == NULL) { - return; + return FALSE; } if (pcmk__str_eq(state_lh, RSC_ROLE_STARTED_S, pcmk__str_null_matches | pcmk__str_casei)) { @@ -1381,7 +1374,6 @@ pcmk__new_colocation(const char *id, const char *node_attr, int score, new_con->role_lh = text2role(state_lh); new_con->role_rh = text2role(state_rh); new_con->node_attribute = node_attr; - new_con->influence = influence; if (node_attr == NULL) { node_attr = CRM_ATTR_UNAME; @@ -1400,6 +1392,8 @@ pcmk__new_colocation(const char *id, const char *node_attr, int score, anti_colocation_order(rsc_lh, new_con->role_lh, rsc_rh, new_con->role_rh, data_set); anti_colocation_order(rsc_rh, new_con->role_rh, rsc_lh, new_con->role_lh, data_set); } + + return TRUE; } /* LHS before RHS */ @@ -2285,38 +2279,8 @@ unpack_rsc_order(xmlNode * xml_obj, pe_working_set_t * data_set) return TRUE; } -/*! - * \internal - * \brief Return the boolean influence corresponding to configuration - * - * \param[in] coloc_id Colocation XML ID (for error logging) - * \param[in] rsc Resource involved in constraint (for default) - * \param[in] influence_s String value of influence option - * - * \return true if string evaluates true, false if string evaluates false, - * or value of resource's critical option if string is NULL or invalid - */ -static bool -unpack_influence(const char *coloc_id, const pe_resource_t *rsc, - const char *influence_s) -{ - if (influence_s != NULL) { - int influence_i = 0; - - if (crm_str_to_boolean(influence_s, &influence_i) < 0) { - pcmk__config_err("Constraint '%s' has invalid value for " - XML_COLOC_ATTR_INFLUENCE " (using default)", - coloc_id); - } else { - return (influence_i == TRUE); - } - } - return pcmk_is_set(rsc->flags, pe_rsc_critical); -} - static gboolean -unpack_colocation_set(xmlNode *set, int score, const char *coloc_id, - const char *influence_s, pe_working_set_t *data_set) +unpack_colocation_set(xmlNode * set, int score, pe_working_set_t * data_set) { xmlNode *xml_rsc = NULL; pe_resource_t *with = NULL; @@ -2332,11 +2296,6 @@ unpack_colocation_set(xmlNode *set, int score, const char *coloc_id, if (score_s) { local_score = char2score(score_s); } - if (local_score == 0) { - crm_trace("Ignoring colocation '%s' for set '%s' because score is 0", - coloc_id, set_id); - return TRUE; - } if(ordering == NULL) { ordering = "group"; @@ -2345,7 +2304,7 @@ unpack_colocation_set(xmlNode *set, int score, const char *coloc_id, if (sequential != NULL && crm_is_true(sequential) == FALSE) { return TRUE; - } else if ((local_score > 0) + } else if ((local_score >= 0) && pcmk__str_eq(ordering, "group", pcmk__str_casei)) { for (xml_rsc = pcmk__xe_first_child(set); xml_rsc != NULL; xml_rsc = pcmk__xe_next(xml_rsc)) { @@ -2354,17 +2313,14 @@ unpack_colocation_set(xmlNode *set, int score, const char *coloc_id, EXPAND_CONSTRAINT_IDREF(set_id, resource, ID(xml_rsc)); if (with != NULL) { pe_rsc_trace(resource, "Colocating %s with %s", resource->id, with->id); - pcmk__new_colocation(set_id, NULL, local_score, resource, - with, role, role, - unpack_influence(coloc_id, resource, - influence_s), - data_set); + rsc_colocation_new(set_id, NULL, local_score, resource, with, role, role, + data_set); } with = resource; } } - } else if (local_score > 0) { + } else if (local_score >= 0) { pe_resource_t *last = NULL; for (xml_rsc = pcmk__xe_first_child(set); xml_rsc != NULL; xml_rsc = pcmk__xe_next(xml_rsc)) { @@ -2373,11 +2329,8 @@ unpack_colocation_set(xmlNode *set, int score, const char *coloc_id, EXPAND_CONSTRAINT_IDREF(set_id, resource, ID(xml_rsc)); if (last != NULL) { pe_rsc_trace(resource, "Colocating %s with %s", last->id, resource->id); - pcmk__new_colocation(set_id, NULL, local_score, last, - resource, role, role, - unpack_influence(coloc_id, last, - influence_s), - data_set); + rsc_colocation_new(set_id, NULL, local_score, last, resource, role, role, + data_set); } last = resource; @@ -2395,10 +2348,8 @@ unpack_colocation_set(xmlNode *set, int score, const char *coloc_id, if (pcmk__str_eq((const char *)xml_rsc->name, XML_TAG_RESOURCE_REF, pcmk__str_none)) { xmlNode *xml_rsc_with = NULL; - bool influence = true; EXPAND_CONSTRAINT_IDREF(set_id, resource, ID(xml_rsc)); - influence = unpack_influence(coloc_id, resource, influence_s); for (xml_rsc_with = pcmk__xe_first_child(set); xml_rsc_with != NULL; @@ -2411,9 +2362,8 @@ unpack_colocation_set(xmlNode *set, int score, const char *coloc_id, EXPAND_CONSTRAINT_IDREF(set_id, with, ID(xml_rsc_with)); pe_rsc_trace(resource, "Anti-Colocating %s with %s", resource->id, with->id); - pcmk__new_colocation(set_id, NULL, local_score, - resource, with, role, role, - influence, data_set); + rsc_colocation_new(set_id, NULL, local_score, resource, with, role, role, + data_set); } } } @@ -2425,7 +2375,7 @@ unpack_colocation_set(xmlNode *set, int score, const char *coloc_id, static gboolean colocate_rsc_sets(const char *id, xmlNode * set1, xmlNode * set2, int score, - const char *influence_s, pe_working_set_t *data_set) + pe_working_set_t * data_set) { xmlNode *xml_rsc = NULL; pe_resource_t *rsc_1 = NULL; @@ -2437,11 +2387,6 @@ colocate_rsc_sets(const char *id, xmlNode * set1, xmlNode * set2, int score, const char *sequential_1 = crm_element_value(set1, "sequential"); const char *sequential_2 = crm_element_value(set2, "sequential"); - if (score == 0) { - crm_trace("Ignoring colocation '%s' between sets because score is 0", - id); - return TRUE; - } if (sequential_1 == NULL || crm_is_true(sequential_1)) { /* get the first one */ for (xml_rsc = pcmk__xe_first_child(set1); xml_rsc != NULL; @@ -2469,20 +2414,15 @@ colocate_rsc_sets(const char *id, xmlNode * set1, xmlNode * set2, int score, } if (rsc_1 != NULL && rsc_2 != NULL) { - pcmk__new_colocation(id, NULL, score, rsc_1, rsc_2, role_1, role_2, - unpack_influence(id, rsc_1, influence_s), - data_set); + rsc_colocation_new(id, NULL, score, rsc_1, rsc_2, role_1, role_2, data_set); } else if (rsc_1 != NULL) { - bool influence = unpack_influence(id, rsc_1, influence_s); - for (xml_rsc = pcmk__xe_first_child(set2); xml_rsc != NULL; xml_rsc = pcmk__xe_next(xml_rsc)) { if (pcmk__str_eq((const char *)xml_rsc->name, XML_TAG_RESOURCE_REF, pcmk__str_none)) { EXPAND_CONSTRAINT_IDREF(id, rsc_2, ID(xml_rsc)); - pcmk__new_colocation(id, NULL, score, rsc_1, rsc_2, role_1, - role_2, influence, data_set); + rsc_colocation_new(id, NULL, score, rsc_1, rsc_2, role_1, role_2, data_set); } } @@ -2492,10 +2432,7 @@ colocate_rsc_sets(const char *id, xmlNode * set1, xmlNode * set2, int score, if (pcmk__str_eq((const char *)xml_rsc->name, XML_TAG_RESOURCE_REF, pcmk__str_none)) { EXPAND_CONSTRAINT_IDREF(id, rsc_1, ID(xml_rsc)); - pcmk__new_colocation(id, NULL, score, rsc_1, rsc_2, role_1, - role_2, - unpack_influence(id, rsc_1, influence_s), - data_set); + rsc_colocation_new(id, NULL, score, rsc_1, rsc_2, role_1, role_2, data_set); } } @@ -2505,10 +2442,8 @@ colocate_rsc_sets(const char *id, xmlNode * set1, xmlNode * set2, int score, if (pcmk__str_eq((const char *)xml_rsc->name, XML_TAG_RESOURCE_REF, pcmk__str_none)) { xmlNode *xml_rsc_2 = NULL; - bool influence = true; EXPAND_CONSTRAINT_IDREF(id, rsc_1, ID(xml_rsc)); - influence = unpack_influence(id, rsc_1, influence_s); for (xml_rsc_2 = pcmk__xe_first_child(set2); xml_rsc_2 != NULL; @@ -2516,9 +2451,7 @@ colocate_rsc_sets(const char *id, xmlNode * set1, xmlNode * set2, int score, if (pcmk__str_eq((const char *)xml_rsc_2->name, XML_TAG_RESOURCE_REF, pcmk__str_none)) { EXPAND_CONSTRAINT_IDREF(id, rsc_2, ID(xml_rsc_2)); - pcmk__new_colocation(id, NULL, score, rsc_1, rsc_2, - role_1, role_2, influence, - data_set); + rsc_colocation_new(id, NULL, score, rsc_1, rsc_2, role_1, role_2, data_set); } } } @@ -2528,13 +2461,14 @@ colocate_rsc_sets(const char *id, xmlNode * set1, xmlNode * set2, int score, return TRUE; } -static void -unpack_simple_colocation(xmlNode *xml_obj, const char *id, - const char *influence_s, pe_working_set_t *data_set) +static gboolean +unpack_simple_colocation(xmlNode * xml_obj, pe_working_set_t * data_set) { int score_i = 0; + const char *id = crm_element_value(xml_obj, XML_ATTR_ID); const char *score = crm_element_value(xml_obj, XML_RULE_ATTR_SCORE); + const char *id_lh = crm_element_value(xml_obj, XML_COLOC_ATTR_SOURCE); const char *id_rh = crm_element_value(xml_obj, XML_COLOC_ATTR_TARGET); const char *state_lh = crm_element_value(xml_obj, XML_COLOC_ATTR_SOURCE_ROLE); @@ -2552,24 +2486,24 @@ unpack_simple_colocation(xmlNode *xml_obj, const char *id, if (rsc_lh == NULL) { pcmk__config_err("Ignoring constraint '%s' because resource '%s' " "does not exist", id, id_lh); - return; + return FALSE; } else if (rsc_rh == NULL) { pcmk__config_err("Ignoring constraint '%s' because resource '%s' " "does not exist", id, id_rh); - return; + return FALSE; } else if (instance_lh && pe_rsc_is_clone(rsc_lh) == FALSE) { pcmk__config_err("Ignoring constraint '%s' because resource '%s' " "is not a clone but instance '%s' was requested", id, id_lh, instance_lh); - return; + return FALSE; } else if (instance_rh && pe_rsc_is_clone(rsc_rh) == FALSE) { pcmk__config_err("Ignoring constraint '%s' because resource '%s' " "is not a clone but instance '%s' was requested", id, id_rh, instance_rh); - return; + return FALSE; } if (instance_lh) { @@ -2578,7 +2512,7 @@ unpack_simple_colocation(xmlNode *xml_obj, const char *id, pcmk__config_warn("Ignoring constraint '%s' because resource '%s' " "does not have an instance '%s'", id, id_lh, instance_lh); - return; + return FALSE; } } @@ -2588,7 +2522,7 @@ unpack_simple_colocation(xmlNode *xml_obj, const char *id, pcmk__config_warn("Ignoring constraint '%s' because resource '%s' " "does not have an instance '%s'", "'%s'", id, id_rh, instance_rh); - return; + return FALSE; } } @@ -2602,8 +2536,8 @@ unpack_simple_colocation(xmlNode *xml_obj, const char *id, score_i = char2score(score); } - pcmk__new_colocation(id, attr, score_i, rsc_lh, rsc_rh, state_lh, state_rh, - unpack_influence(id, rsc_lh, influence_s), data_set); + rsc_colocation_new(id, attr, score_i, rsc_lh, rsc_rh, state_lh, state_rh, data_set); + return TRUE; } static gboolean @@ -2723,8 +2657,8 @@ unpack_colocation_tags(xmlNode * xml_obj, xmlNode ** expanded_xml, pe_working_se return TRUE; } -static void -unpack_rsc_colocation(xmlNode *xml_obj, pe_working_set_t *data_set) +gboolean +unpack_rsc_colocation(xmlNode * xml_obj, pe_working_set_t * data_set) { int score_i = 0; xmlNode *set = NULL; @@ -2736,19 +2670,20 @@ unpack_rsc_colocation(xmlNode *xml_obj, pe_working_set_t *data_set) const char *id = crm_element_value(xml_obj, XML_ATTR_ID); const char *score = crm_element_value(xml_obj, XML_RULE_ATTR_SCORE); - const char *influence_s = crm_element_value(xml_obj, - XML_COLOC_ATTR_INFLUENCE); + + gboolean rc = TRUE; if (score) { score_i = char2score(score); } - if (!unpack_colocation_tags(xml_obj, &expanded_xml, data_set)) { - return; - } + rc = unpack_colocation_tags(xml_obj, &expanded_xml, data_set); if (expanded_xml) { orig_xml = xml_obj; xml_obj = expanded_xml; + + } else if (rc == FALSE) { + return FALSE; } for (set = pcmk__xe_first_child(xml_obj); set != NULL; @@ -2757,13 +2692,11 @@ unpack_rsc_colocation(xmlNode *xml_obj, pe_working_set_t *data_set) if (pcmk__str_eq((const char *)set->name, XML_CONS_TAG_RSC_SET, pcmk__str_none)) { any_sets = TRUE; set = expand_idref(set, data_set->input); - if (!unpack_colocation_set(set, score_i, id, influence_s, - data_set)) { - return; - } - if ((last != NULL) && !colocate_rsc_sets(id, last, set, score_i, - influence_s, data_set)) { - return; + if (unpack_colocation_set(set, score_i, data_set) == FALSE) { + return FALSE; + + } else if (last && colocate_rsc_sets(id, last, set, score_i, data_set) == FALSE) { + return FALSE; } last = set; } @@ -2774,9 +2707,11 @@ unpack_rsc_colocation(xmlNode *xml_obj, pe_working_set_t *data_set) xml_obj = orig_xml; } - if (!any_sets) { - unpack_simple_colocation(xml_obj, id, influence_s, data_set); + if (any_sets == FALSE) { + return unpack_simple_colocation(xml_obj, data_set); } + + return TRUE; } gboolean diff --git a/lib/pacemaker/pcmk_sched_graph.c b/lib/pacemaker/pcmk_sched_graph.c index f0d1f47..51f7063 100644 --- a/lib/pacemaker/pcmk_sched_graph.c +++ b/lib/pacemaker/pcmk_sched_graph.c @@ -510,8 +510,7 @@ update_colo_start_chain(pe_action_t *action, pe_working_set_t *data_set) } for (gIter = rsc->rsc_cons_lhs; gIter != NULL; gIter = gIter->next) { - pcmk__colocation_t *colocate_with = (pcmk__colocation_t *) gIter->data; - + rsc_colocation_t *colocate_with = (rsc_colocation_t *)gIter->data; if (colocate_with->score == INFINITY) { mark_start_blocked(colocate_with->rsc_lh, action->rsc, data_set); } @@ -1210,29 +1209,11 @@ action2xml(pe_action_t * action, gboolean as_input, pe_working_set_t *data_set) g_hash_table_foreach(action->extra, hash2field, args_xml); if (action->rsc != NULL && action->node) { - // Get the resource instance attributes, evaluated properly for node - GHashTable *params = pe_rsc_params(action->rsc, action->node, data_set); - - /* REMOTE_CONTAINER_HACK: If this is a remote connection resource with - * addr="#uname", pull the actual value from the parameters evaluated - * without a node (which was put there earlier in stage8() when the - * bundle's expand() method was called). - */ - const char *remote_addr = g_hash_table_lookup(params, - XML_RSC_ATTR_REMOTE_RA_ADDR); - - if (pcmk__str_eq(remote_addr, "#uname", pcmk__str_none)) { - GHashTable *base = pe_rsc_params(action->rsc, NULL, data_set); + GHashTable *p = crm_str_table_new(); - remote_addr = g_hash_table_lookup(base, - XML_RSC_ATTR_REMOTE_RA_ADDR); - if (remote_addr != NULL) { - g_hash_table_insert(params, strdup(XML_RSC_ATTR_REMOTE_RA_ADDR), - strdup(remote_addr)); - } - } - - g_hash_table_foreach(params, hash2smartfield, args_xml); + get_rsc_attributes(p, action->rsc, action->node, data_set); + g_hash_table_foreach(p, hash2smartfield, args_xml); + g_hash_table_destroy(p); #if ENABLE_VERSIONED_ATTRS { @@ -1248,9 +1229,7 @@ action2xml(pe_action_t * action, gboolean as_input, pe_working_set_t *data_set) #endif } else if(action->rsc && action->rsc->variant <= pe_native) { - GHashTable *params = pe_rsc_params(action->rsc, NULL, data_set); - - g_hash_table_foreach(params, hash2smartfield, args_xml); + g_hash_table_foreach(action->rsc->parameters, hash2smartfield, args_xml); #if ENABLE_VERSIONED_ATTRS if (xml_has_children(action->rsc->versioned_parameters)) { diff --git a/lib/pacemaker/pcmk_sched_group.c b/lib/pacemaker/pcmk_sched_group.c index 439ed91..35f25af 100644 --- a/lib/pacemaker/pcmk_sched_group.c +++ b/lib/pacemaker/pcmk_sched_group.c @@ -1,5 +1,5 @@ /* - * Copyright 2004-2021 the Pacemaker project contributors + * Copyright 2004-2020 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -9,8 +9,6 @@ #include -#include - #include #include @@ -194,10 +192,8 @@ group_internal_constraints(pe_resource_t * rsc, pe_working_set_t * data_set) } } else if (group_data->colocated) { - pcmk__new_colocation("group:internal_colocation", NULL, INFINITY, - child_rsc, last_rsc, NULL, NULL, - pcmk_is_set(child_rsc->flags, pe_rsc_critical), - data_set); + rsc_colocation_new("group:internal_colocation", NULL, INFINITY, + child_rsc, last_rsc, NULL, NULL, data_set); } if (pcmk_is_set(top->flags, pe_rsc_promotable)) { @@ -286,7 +282,7 @@ group_internal_constraints(pe_resource_t * rsc, pe_working_set_t * data_set) void group_rsc_colocation_lh(pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, - pcmk__colocation_t *constraint, + rsc_colocation_t *constraint, pe_working_set_t *data_set) { GListPtr gIter = NULL; @@ -300,6 +296,9 @@ group_rsc_colocation_lh(pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, pe_err("rsc_rh was NULL for %s", constraint->id); return; } + if (constraint->score == 0) { + return; + } gIter = rsc_lh->children; pe_rsc_trace(rsc_lh, "Processing constraints from %s", rsc_lh->id); @@ -329,7 +328,7 @@ group_rsc_colocation_lh(pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, void group_rsc_colocation_rh(pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, - pcmk__colocation_t *constraint, + rsc_colocation_t *constraint, pe_working_set_t *data_set) { GListPtr gIter = rsc_rh->children; @@ -338,6 +337,9 @@ group_rsc_colocation_rh(pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, get_group_variant_data(group_data, rsc_rh); CRM_CHECK(rsc_lh->variant == pe_native, return); + if (constraint->score == 0) { + return; + } pe_rsc_trace(rsc_rh, "Processing RH %s of constraint %s (LH is %s)", rsc_rh->id, constraint->id, rsc_lh->id); @@ -512,8 +514,11 @@ pcmk__group_merge_weights(pe_resource_t *rsc, const char *rhs, factor, flags); for (; gIter != NULL; gIter = gIter->next) { - pcmk__colocation_t *constraint = (pcmk__colocation_t *) gIter->data; + rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data; + if (constraint->score == 0) { + continue; + } nodes = pcmk__native_merge_weights(constraint->rsc_lh, rsc->id, nodes, constraint->node_attribute, constraint->score / (float) INFINITY, diff --git a/lib/pacemaker/pcmk_sched_native.c b/lib/pacemaker/pcmk_sched_native.c index 6abada2..612df26 100644 --- a/lib/pacemaker/pcmk_sched_native.c +++ b/lib/pacemaker/pcmk_sched_native.c @@ -1,5 +1,5 @@ /* - * Copyright 2004-2021 the Pacemaker project contributors + * Copyright 2004-2020 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -9,8 +9,6 @@ #include -#include - #include #include #include @@ -436,12 +434,14 @@ pcmk__native_merge_weights(pe_resource_t *rsc, const char *rhs, for (; gIter != NULL; gIter = gIter->next) { pe_resource_t *other = NULL; - pcmk__colocation_t *constraint = (pcmk__colocation_t *) gIter->data; + rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data; + + if (constraint->score == 0) { + continue; + } if (pcmk_is_set(flags, pe_weights_forward)) { other = constraint->rsc_rh; - } else if (!pcmk__colocation_has_influence(constraint, NULL)) { - continue; } else { other = constraint->rsc_lh; } @@ -526,11 +526,15 @@ pcmk__native_allocate(pe_resource_t *rsc, pe_node_t *prefer, pe__show_node_weights(true, rsc, "Pre-alloc", rsc->allowed_nodes); for (gIter = rsc->rsc_cons; gIter != NULL; gIter = gIter->next) { - pcmk__colocation_t *constraint = (pcmk__colocation_t *) gIter->data; + rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data; GHashTable *archive = NULL; pe_resource_t *rsc_rh = constraint->rsc_rh; + if (constraint->score == 0) { + continue; + } + if (constraint->role_lh >= RSC_ROLE_MASTER || (constraint->score < 0 && constraint->score > -INFINITY)) { archive = pcmk__copy_node_table(rsc->allowed_nodes); @@ -556,9 +560,9 @@ pcmk__native_allocate(pe_resource_t *rsc, pe_node_t *prefer, pe__show_node_weights(true, rsc, "Post-coloc", rsc->allowed_nodes); for (gIter = rsc->rsc_cons_lhs; gIter != NULL; gIter = gIter->next) { - pcmk__colocation_t *constraint = (pcmk__colocation_t *) gIter->data; + rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data; - if (!pcmk__colocation_has_influence(constraint, NULL)) { + if (constraint->score == 0) { continue; } pe_rsc_trace(rsc, "Merging score of '%s' constraint (%s with %s)", @@ -1691,8 +1695,8 @@ native_internal_constraints(pe_resource_t * rsc, pe_working_set_t * data_set) } else { score = INFINITY; /* Force them to run on the same host */ } - pcmk__new_colocation("resource-with-container", NULL, score, rsc, - rsc->container, NULL, NULL, true, data_set); + rsc_colocation_new("resource-with-container", NULL, score, rsc, + rsc->container, NULL, NULL, data_set); } } @@ -1706,7 +1710,7 @@ native_internal_constraints(pe_resource_t * rsc, pe_working_set_t * data_set) void native_rsc_colocation_lh(pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, - pcmk__colocation_t *constraint, + rsc_colocation_t *constraint, pe_working_set_t *data_set) { if (rsc_lh == NULL) { @@ -1718,6 +1722,9 @@ native_rsc_colocation_lh(pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, return; } + if (constraint->score == 0) { + return; + } pe_rsc_trace(rsc_lh, "Processing colocation constraint between %s and %s", rsc_lh->id, rsc_rh->id); @@ -1726,8 +1733,12 @@ native_rsc_colocation_lh(pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, enum filter_colocation_res filter_colocation_constraint(pe_resource_t * rsc_lh, pe_resource_t * rsc_rh, - pcmk__colocation_t *constraint, gboolean preview) + rsc_colocation_t * constraint, gboolean preview) { + if (constraint->score == 0) { + return influence_nothing; + } + /* rh side must be allocated before we can process constraint */ if (!preview && pcmk_is_set(rsc_rh->flags, pe_rsc_provisional)) { return influence_nothing; @@ -1806,14 +1817,16 @@ filter_colocation_constraint(pe_resource_t * rsc_lh, pe_resource_t * rsc_rh, } static void -influence_priority(pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, - pcmk__colocation_t *constraint) +influence_priority(pe_resource_t * rsc_lh, pe_resource_t * rsc_rh, rsc_colocation_t * constraint) { const char *rh_value = NULL; const char *lh_value = NULL; const char *attribute = CRM_ATTR_ID; int score_multiplier = 1; + if (constraint->score == 0) { + return; + } if (!rsc_rh->allocated_to || !rsc_lh->allocated_to) { return; } @@ -1845,8 +1858,7 @@ influence_priority(pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, } static void -colocation_match(pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, - pcmk__colocation_t *constraint) +colocation_match(pe_resource_t * rsc_lh, pe_resource_t * rsc_rh, rsc_colocation_t * constraint) { const char *attribute = CRM_ATTR_ID; const char *value = NULL; @@ -1854,6 +1866,9 @@ colocation_match(pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, GHashTableIter iter; pe_node_t *node = NULL; + if (constraint->score == 0) { + return; + } if (constraint->node_attribute != NULL) { attribute = constraint->node_attribute; } @@ -1911,7 +1926,7 @@ colocation_match(pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, void native_rsc_colocation_rh(pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, - pcmk__colocation_t *constraint, + rsc_colocation_t *constraint, pe_working_set_t *data_set) { enum filter_colocation_res filter_results; @@ -1920,7 +1935,7 @@ native_rsc_colocation_rh(pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, CRM_ASSERT(rsc_rh); filter_results = filter_colocation_constraint(rsc_lh, rsc_rh, constraint, FALSE); pe_rsc_trace(rsc_lh, "%s %s with %s (%s, score=%d, filter=%d)", - ((constraint->score > 0)? "Colocating" : "Anti-colocating"), + ((constraint->score >= 0)? "Colocating" : "Anti-colocating"), rsc_lh->id, rsc_rh->id, constraint->id, constraint->score, filter_results); switch (filter_results) { diff --git a/lib/pacemaker/pcmk_sched_promotable.c b/lib/pacemaker/pcmk_sched_promotable.c index 40d07e9..b976344 100644 --- a/lib/pacemaker/pcmk_sched_promotable.c +++ b/lib/pacemaker/pcmk_sched_promotable.c @@ -1,5 +1,5 @@ /* - * Copyright 2004-2021 the Pacemaker project contributors + * Copyright 2004-2020 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -319,7 +319,11 @@ promotion_order(pe_resource_t *rsc, pe_working_set_t *data_set) gIter = rsc->rsc_cons; for (; gIter != NULL; gIter = gIter->next) { - pcmk__colocation_t *constraint = (pcmk__colocation_t *) gIter->data; + rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data; + + if (constraint->score == 0) { + continue; + } /* (re-)adds location preferences of resources that the * master instance should/must be colocated with @@ -339,9 +343,9 @@ promotion_order(pe_resource_t *rsc, pe_working_set_t *data_set) gIter = rsc->rsc_cons_lhs; for (; gIter != NULL; gIter = gIter->next) { - pcmk__colocation_t *constraint = (pcmk__colocation_t *) gIter->data; + rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data; - if (!pcmk__colocation_has_influence(constraint, NULL)) { + if (constraint->score == 0) { continue; } @@ -734,8 +738,11 @@ pcmk__set_instance_roles(pe_resource_t *rsc, pe_working_set_t *data_set) apply_master_location(child_rsc, rsc->rsc_location, chosen); for (gIter2 = child_rsc->rsc_cons; gIter2 != NULL; gIter2 = gIter2->next) { - pcmk__colocation_t *cons = (pcmk__colocation_t *) gIter2->data; + rsc_colocation_t *cons = (rsc_colocation_t *) gIter2->data; + if (cons->score == 0) { + continue; + } child_rsc->cmds->rsc_colocation_lh(child_rsc, cons->rsc_rh, cons, data_set); } @@ -974,11 +981,14 @@ node_hash_update_one(GHashTable * hash, pe_node_t * other, const char *attr, int void promotable_colocation_rh(pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, - pcmk__colocation_t *constraint, + rsc_colocation_t *constraint, pe_working_set_t *data_set) { GListPtr gIter = NULL; + if (constraint->score == 0) { + return; + } if (pcmk_is_set(rsc_lh->flags, pe_rsc_provisional)) { GListPtr rhs = NULL; diff --git a/lib/pacemaker/pcmk_sched_utilization.c b/lib/pacemaker/pcmk_sched_utilization.c index 0df3a17..b46b2fa 100644 --- a/lib/pacemaker/pcmk_sched_utilization.c +++ b/lib/pacemaker/pcmk_sched_utilization.c @@ -276,7 +276,7 @@ find_colocated_rscs(GListPtr colocated_rscs, pe_resource_t * rsc, pe_resource_t colocated_rscs = g_list_append(colocated_rscs, rsc); for (gIter = rsc->rsc_cons; gIter != NULL; gIter = gIter->next) { - pcmk__colocation_t *constraint = (pcmk__colocation_t *) gIter->data; + rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data; pe_resource_t *rsc_rh = constraint->rsc_rh; /* Break colocation loop */ @@ -298,7 +298,7 @@ find_colocated_rscs(GListPtr colocated_rscs, pe_resource_t * rsc, pe_resource_t } for (gIter = rsc->rsc_cons_lhs; gIter != NULL; gIter = gIter->next) { - pcmk__colocation_t *constraint = (pcmk__colocation_t *) gIter->data; + rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data; pe_resource_t *rsc_lh = constraint->rsc_lh; /* Break colocation loop */ diff --git a/lib/pengine/Makefile.am b/lib/pengine/Makefile.am index 258f594..6289bfc 100644 --- a/lib/pengine/Makefile.am +++ b/lib/pengine/Makefile.am @@ -39,7 +39,6 @@ libpe_status_la_SOURCES += complex.c libpe_status_la_SOURCES += failcounts.c libpe_status_la_SOURCES += group.c libpe_status_la_SOURCES += native.c -libpe_status_la_SOURCES += pe_digest.c libpe_status_la_SOURCES += remote.c libpe_status_la_SOURCES += rules.c libpe_status_la_SOURCES += status.c diff --git a/lib/pengine/bundle.c b/lib/pengine/bundle.c index 05e7335..76730c7 100644 --- a/lib/pengine/bundle.c +++ b/lib/pengine/bundle.c @@ -954,33 +954,44 @@ replica_for_remote(pe_resource_t *remote) } bool -pe__bundle_needs_remote_name(pe_resource_t *rsc, pe_working_set_t *data_set) +pe__bundle_needs_remote_name(pe_resource_t *rsc) { const char *value; - GHashTable *params = NULL; if (rsc == NULL) { - return false; + return FALSE; } - // Use NULL node since pcmk__bundle_expand() uses that to set value - params = pe_rsc_params(rsc, NULL, data_set); - value = g_hash_table_lookup(params, XML_RSC_ATTR_REMOTE_RA_ADDR); + value = g_hash_table_lookup(rsc->parameters, XML_RSC_ATTR_REMOTE_RA_ADDR); + if (!pcmk__str_eq(value, "#uname", pcmk__str_casei)) { + return FALSE; - return pcmk__str_eq(value, "#uname", pcmk__str_casei) - && xml_contains_remote_node(rsc->xml); + } else { + const char *match[3][2] = { + { XML_ATTR_TYPE, "remote" }, + { XML_AGENT_ATTR_CLASS, PCMK_RESOURCE_CLASS_OCF }, + { XML_AGENT_ATTR_PROVIDER, "pacemaker" }, + }; + + for (int m = 0; m < 3; m++) { + value = crm_element_value(rsc->xml, match[m][0]); + if (!pcmk__str_eq(value, match[m][1], pcmk__str_casei)) { + return FALSE; + } + } + } + return TRUE; } const char * -pe__add_bundle_remote_name(pe_resource_t *rsc, pe_working_set_t *data_set, - xmlNode *xml, const char *field) +pe__add_bundle_remote_name(pe_resource_t *rsc, xmlNode *xml, const char *field) { // REMOTE_CONTAINER_HACK: Allow remote nodes that start containers with pacemaker remote inside pe_node_t *node = NULL; pe__bundle_replica_t *replica = NULL; - if (!pe__bundle_needs_remote_name(rsc, data_set)) { + if (!pe__bundle_needs_remote_name(rsc)) { return NULL; } @@ -1489,14 +1500,14 @@ bundle_print_xml(pe_resource_t *rsc, const char *pre_text, long options, free(child_text); } -PCMK__OUTPUT_ARGS("bundle", "unsigned int", "pe_resource_t *", "GList *", "GList *") +PCMK__OUTPUT_ARGS("bundle", "unsigned int", "pe_resource_t *", "GListPtr", "GListPtr") int pe__bundle_xml(pcmk__output_t *out, va_list args) { unsigned int options = va_arg(args, unsigned int); pe_resource_t *rsc = va_arg(args, pe_resource_t *); - GList *only_node = va_arg(args, GList *); - GList *only_rsc = va_arg(args, GList *); + GListPtr only_node = va_arg(args, GListPtr); + GListPtr only_rsc = va_arg(args, GListPtr); pe__bundle_variant_data_t *bundle_data = NULL; int rc = pcmk_rc_no_output; @@ -1612,14 +1623,14 @@ pe__bundle_replica_output_html(pcmk__output_t *out, pe__bundle_replica_t *replic pe__common_output_html(out, rsc, buffer, node, options); } -PCMK__OUTPUT_ARGS("bundle", "unsigned int", "pe_resource_t *", "GList *", "GList *") +PCMK__OUTPUT_ARGS("bundle", "unsigned int", "pe_resource_t *", "GListPtr", "GListPtr") int pe__bundle_html(pcmk__output_t *out, va_list args) { unsigned int options = va_arg(args, unsigned int); pe_resource_t *rsc = va_arg(args, pe_resource_t *); - GList *only_node = va_arg(args, GList *); - GList *only_rsc = va_arg(args, GList *); + GListPtr only_node = va_arg(args, GListPtr); + GListPtr only_rsc = va_arg(args, GListPtr); pe__bundle_variant_data_t *bundle_data = NULL; char buffer[LINE_MAX]; @@ -1667,7 +1678,7 @@ pe__bundle_html(pcmk__output_t *out, va_list args) } if (rc == pcmk_rc_no_output) { - pcmk__output_create_xml_node(out, "br", NULL); + pcmk__output_create_xml_node(out, "br"); } PCMK__OUTPUT_LIST_HEADER(out, FALSE, rc, "Container bundle%s: %s [%s]%s%s", @@ -1676,13 +1687,13 @@ pe__bundle_html(pcmk__output_t *out, va_list args) pcmk_is_set(rsc->flags, pe_rsc_unique) ? " (unique)" : "", pcmk_is_set(rsc->flags, pe_rsc_managed) ? "" : " (unmanaged)"); - pcmk__output_xml_create_parent(out, "li", NULL); + pcmk__output_xml_create_parent(out, "li"); if (pcmk__list_of_multiple(bundle_data->replicas)) { snprintf(buffer, LINE_MAX, " Replica[%d]", replica->offset); xmlNodeSetContent(pcmk__output_xml_peek_parent(out), (pcmkXmlStr) buffer); } - pcmk__output_create_xml_node(out, "br", NULL); + pcmk__output_create_xml_node(out, "br"); out->begin_list(out, NULL, NULL, NULL); if (print_ip) { @@ -1754,14 +1765,14 @@ pe__bundle_replica_output_text(pcmk__output_t *out, pe__bundle_replica_t *replic pe__common_output_text(out, rsc, buffer, node, options); } -PCMK__OUTPUT_ARGS("bundle", "unsigned int", "pe_resource_t *", "GList *", "GList *") +PCMK__OUTPUT_ARGS("bundle", "unsigned int", "pe_resource_t *", "GListPtr", "GListPtr") int pe__bundle_text(pcmk__output_t *out, va_list args) { unsigned int options = va_arg(args, unsigned int); pe_resource_t *rsc = va_arg(args, pe_resource_t *); - GList *only_node = va_arg(args, GList *); - GList *only_rsc = va_arg(args, GList *); + GListPtr only_node = va_arg(args, GListPtr); + GListPtr only_rsc = va_arg(args, GListPtr); pe__bundle_variant_data_t *bundle_data = NULL; int rc = pcmk_rc_no_output; diff --git a/lib/pengine/clone.c b/lib/pengine/clone.c index 9e98178..0708fdc 100644 --- a/lib/pengine/clone.c +++ b/lib/pengine/clone.c @@ -577,16 +577,16 @@ clone_print(pe_resource_t * rsc, const char *pre_text, long options, void *print free(child_text); } -PCMK__OUTPUT_ARGS("clone", "unsigned int", "pe_resource_t *", "GList *", "GList *") +PCMK__OUTPUT_ARGS("clone", "unsigned int", "pe_resource_t *", "GListPtr", "GListPtr") int pe__clone_xml(pcmk__output_t *out, va_list args) { unsigned int options = va_arg(args, unsigned int); pe_resource_t *rsc = va_arg(args, pe_resource_t *); - GList *only_node = va_arg(args, GList *); - GList *only_rsc = va_arg(args, GList *); + GListPtr only_node = va_arg(args, GListPtr); + GListPtr only_rsc = va_arg(args, GListPtr); - GList *gIter = rsc->children; + GListPtr gIter = rsc->children; int rc = pcmk_rc_no_output; gboolean printed_header = FALSE; gboolean print_everything = TRUE; @@ -635,23 +635,23 @@ pe__clone_xml(pcmk__output_t *out, va_list args) return rc; } -PCMK__OUTPUT_ARGS("clone", "unsigned int", "pe_resource_t *", "GList *", "GList *") +PCMK__OUTPUT_ARGS("clone", "unsigned int", "pe_resource_t *", "GListPtr", "GListPtr") int pe__clone_html(pcmk__output_t *out, va_list args) { unsigned int options = va_arg(args, unsigned int); pe_resource_t *rsc = va_arg(args, pe_resource_t *); - GList *only_node = va_arg(args, GList *); - GList *only_rsc = va_arg(args, GList *); + GListPtr only_node = va_arg(args, GListPtr); + GListPtr only_rsc = va_arg(args, GListPtr); char *list_text = NULL; char *stopped_list = NULL; size_t list_text_len = 0; size_t stopped_list_len = 0; - GList *master_list = NULL; - GList *started_list = NULL; - GList *gIter = rsc->children; + GListPtr master_list = NULL; + GListPtr started_list = NULL; + GListPtr gIter = rsc->children; clone_variant_data_t *clone_data = NULL; int active_instances = 0; @@ -751,7 +751,7 @@ pe__clone_html(pcmk__output_t *out, va_list args) } if (print_full) { - GList *all = NULL; + GListPtr all = NULL; /* Print every resource that's a child of this clone. */ all = g_list_prepend(all, strdup("*")); @@ -781,7 +781,7 @@ pe__clone_html(pcmk__output_t *out, va_list args) } if (list_text != NULL) { - out->list_item(out, NULL, "Masters: [ %s ]", list_text); + out->list_item(out, NULL, " Masters: [ %s ]", list_text); g_list_free(master_list); free(list_text); list_text = NULL; @@ -806,13 +806,13 @@ pe__clone_html(pcmk__output_t *out, va_list args) enum rsc_role_e role = configured_role(rsc); if(role == RSC_ROLE_SLAVE) { - out->list_item(out, NULL, "Slaves (target-role): [ %s ]", list_text); + out->list_item(out, NULL, " Slaves (target-role): [ %s ]", list_text); } else { - out->list_item(out, NULL, "Slaves: [ %s ]", list_text); + out->list_item(out, NULL, " Slaves: [ %s ]", list_text); } } else { - out->list_item(out, NULL, "Started: [ %s ]", list_text); + out->list_item(out, NULL, " Started: [ %s ]", list_text); } g_list_free(started_list); @@ -832,8 +832,8 @@ pe__clone_html(pcmk__output_t *out, va_list args) if (!pcmk_is_set(rsc->flags, pe_rsc_unique) && (clone_data->clone_max > active_instances)) { - GList *nIter; - GList *list = g_hash_table_get_values(rsc->allowed_nodes); + GListPtr nIter; + GListPtr list = g_hash_table_get_values(rsc->allowed_nodes); /* Custom stopped list for non-unique clones */ free(stopped_list); @@ -861,7 +861,7 @@ pe__clone_html(pcmk__output_t *out, va_list args) } if (stopped_list != NULL) { - out->list_item(out, NULL, "%s: [ %s ]", state, stopped_list); + out->list_item(out, NULL, " %s: [ %s ]", state, stopped_list); free(stopped_list); stopped_list_len = 0; } @@ -872,23 +872,23 @@ pe__clone_html(pcmk__output_t *out, va_list args) return rc; } -PCMK__OUTPUT_ARGS("clone", "unsigned int", "pe_resource_t *", "GList *", "GList *") +PCMK__OUTPUT_ARGS("clone", "unsigned int", "pe_resource_t *", "GListPtr", "GListPtr") int pe__clone_text(pcmk__output_t *out, va_list args) { unsigned int options = va_arg(args, unsigned int); pe_resource_t *rsc = va_arg(args, pe_resource_t *); - GList *only_node = va_arg(args, GList *); - GList *only_rsc = va_arg(args, GList *); + GListPtr only_node = va_arg(args, GListPtr); + GListPtr only_rsc = va_arg(args, GListPtr); char *list_text = NULL; char *stopped_list = NULL; size_t list_text_len = 0; size_t stopped_list_len = 0; - GList *master_list = NULL; - GList *started_list = NULL; - GList *gIter = rsc->children; + GListPtr master_list = NULL; + GListPtr started_list = NULL; + GListPtr gIter = rsc->children; clone_variant_data_t *clone_data = NULL; int active_instances = 0; @@ -988,7 +988,7 @@ pe__clone_text(pcmk__output_t *out, va_list args) } if (print_full) { - GList *all = NULL; + GListPtr all = NULL; /* Print every resource that's a child of this clone. */ all = g_list_prepend(all, strdup("*")); @@ -1067,8 +1067,8 @@ pe__clone_text(pcmk__output_t *out, va_list args) if (!pcmk_is_set(rsc->flags, pe_rsc_unique) && (clone_data->clone_max > active_instances)) { - GList *nIter; - GList *list = g_hash_table_get_values(rsc->allowed_nodes); + GListPtr nIter; + GListPtr list = g_hash_table_get_values(rsc->allowed_nodes); /* Custom stopped list for non-unique clones */ free(stopped_list); diff --git a/lib/pengine/complex.c b/lib/pengine/complex.c index 3e63510..7eb49f7 100644 --- a/lib/pengine/complex.c +++ b/lib/pengine/complex.c @@ -1,5 +1,5 @@ /* - * Copyright 2004-2021 the Pacemaker project contributors + * Copyright 2004-2020 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -119,11 +119,15 @@ get_meta_attributes(GHashTable * meta_hash, pe_resource_t * rsc, rule_data.node_hash = node->details->attrs; } - for (xmlAttrPtr a = pcmk__xe_first_attr(rsc->xml); a != NULL; a = a->next) { - const char *prop_name = (const char *) a->name; - const char *prop_value = crm_element_value(rsc->xml, prop_name); + if (rsc->xml) { + xmlAttrPtr xIter = NULL; - add_hash_param(meta_hash, prop_name, prop_value); + for (xIter = rsc->xml->properties; xIter; xIter = xIter->next) { + const char *prop_name = (const char *)xIter->name; + const char *prop_value = crm_element_value(rsc->xml, prop_name); + + add_hash_param(meta_hash, prop_name, prop_value); + } } pe__unpack_dataset_nvpairs(rsc->xml, XML_TAG_META_SETS, &rule_data, @@ -388,62 +392,6 @@ detect_promotable(pe_resource_t *rsc) return FALSE; } -static void -free_params_table(gpointer data) -{ - g_hash_table_destroy((GHashTable *) data); -} - -/*! - * \brief Get a table of resource parameters - * - * \param[in] rsc Resource to query - * \param[in] node Node for evaluating rules (NULL for defaults) - * \param[in] data_set Cluster working set - * - * \return Hash table containing resource parameter names and values - * (or NULL if \p rsc or \p data_set is NULL) - * \note The returned table will be destroyed when the resource is freed, so - * callers should not destroy it. - */ -GHashTable * -pe_rsc_params(pe_resource_t *rsc, pe_node_t *node, pe_working_set_t *data_set) -{ - GHashTable *params_on_node = NULL; - - /* A NULL node is used to request the resource's default parameters - * (not evaluated for node), but we always want something non-NULL - * as a hash table key. - */ - const char *node_name = ""; - - // Sanity check - if ((rsc == NULL) || (data_set == NULL)) { - return NULL; - } - if ((node != NULL) && (node->details->uname != NULL)) { - node_name = node->details->uname; - } - - // Find the parameter table for given node - if (rsc->parameter_cache == NULL) { - rsc->parameter_cache = g_hash_table_new_full(crm_strcase_hash, - crm_strcase_equal, free, - free_params_table); - } else { - params_on_node = g_hash_table_lookup(rsc->parameter_cache, node_name); - } - - // If none exists yet, create one with parameters evaluated for node - if (params_on_node == NULL) { - params_on_node = crm_str_table_new(); - get_rsc_attributes(params_on_node, rsc, node, data_set); - g_hash_table_insert(rsc->parameter_cache, strdup(node_name), - params_on_node); - } - return params_on_node; -} - gboolean common_unpack(xmlNode * xml_obj, pe_resource_t ** rsc, pe_resource_t * parent, pe_working_set_t * data_set) @@ -510,6 +458,8 @@ common_unpack(xmlNode * xml_obj, pe_resource_t ** rsc, return FALSE; } + (*rsc)->parameters = crm_str_table_new(); + #if ENABLE_VERSIONED_ATTRS (*rsc)->versioned_parameters = create_xml_node(NULL, XML_TAG_RSC_VER_ATTRS); #endif @@ -535,7 +485,7 @@ common_unpack(xmlNode * xml_obj, pe_resource_t ** rsc, pe_rsc_trace((*rsc), "Unpacking resource..."); get_meta_attributes((*rsc)->meta, *rsc, NULL, data_set); - (*rsc)->parameters = pe_rsc_params(*rsc, NULL, data_set); // \deprecated + get_rsc_attributes((*rsc)->parameters, *rsc, NULL, data_set); #if ENABLE_VERSIONED_ATTRS pe_get_versioned_attributes((*rsc)->versioned_parameters, *rsc, NULL, data_set); #endif @@ -561,11 +511,6 @@ common_unpack(xmlNode * xml_obj, pe_resource_t ** rsc, value = g_hash_table_lookup((*rsc)->meta, XML_CIB_ATTR_PRIORITY); (*rsc)->priority = crm_parse_int(value, "0"); - value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_CRITICAL); - if ((value == NULL) || crm_is_true(value)) { - pe__set_resource_flags(*rsc, pe_rsc_critical); - } - value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_NOTIFY); if (crm_is_true(value)) { pe__set_resource_flags(*rsc, pe_rsc_notify); @@ -764,15 +709,7 @@ common_unpack(xmlNode * xml_obj, pe_resource_t ** rsc, } if (remote_node) { - GHashTable *params = pe_rsc_params(*rsc, NULL, data_set); - - /* Grabbing the value now means that any rules based on node attributes - * will evaluate to false, so such rules should not be used with - * reconnect_interval. - * - * @TODO Evaluate per node before using - */ - value = g_hash_table_lookup(params, XML_REMOTE_ATTR_RECONNECT_INTERVAL); + value = g_hash_table_lookup((*rsc)->parameters, XML_REMOTE_ATTR_RECONNECT_INTERVAL); if (value) { /* reconnect delay works by setting failure_timeout and preventing the * connection from starting until the failure is cleared. */ @@ -886,8 +823,8 @@ common_free(pe_resource_t * rsc) g_list_free(rsc->rsc_tickets); g_list_free(rsc->dangling_migrations); - if (rsc->parameter_cache != NULL) { - g_hash_table_destroy(rsc->parameter_cache); + if (rsc->parameters != NULL) { + g_hash_table_destroy(rsc->parameters); } #if ENABLE_VERSIONED_ATTRS if (rsc->versioned_parameters != NULL) { diff --git a/lib/pengine/group.c b/lib/pengine/group.c index 58c9f7c..33aa177 100644 --- a/lib/pengine/group.c +++ b/lib/pengine/group.c @@ -180,16 +180,16 @@ group_print(pe_resource_t * rsc, const char *pre_text, long options, void *print free(child_text); } -PCMK__OUTPUT_ARGS("group", "unsigned int", "pe_resource_t *", "GList *", "GList *") +PCMK__OUTPUT_ARGS("group", "unsigned int", "pe_resource_t *", "GListPtr", "GListPtr") int pe__group_xml(pcmk__output_t *out, va_list args) { unsigned int options = va_arg(args, unsigned int); pe_resource_t *rsc = va_arg(args, pe_resource_t *); - GList *only_node = va_arg(args, GList *); - GList *only_rsc = va_arg(args, GList *); + GListPtr only_node = va_arg(args, GListPtr); + GListPtr only_rsc = va_arg(args, GListPtr); - GList *gIter = rsc->children; + GListPtr gIter = rsc->children; char *count = crm_itoa(g_list_length(gIter)); int rc = pcmk_rc_no_output; @@ -231,14 +231,14 @@ pe__group_xml(pcmk__output_t *out, va_list args) return rc; } -PCMK__OUTPUT_ARGS("group", "unsigned int", "pe_resource_t *", "GList *", "GList *") +PCMK__OUTPUT_ARGS("group", "unsigned int", "pe_resource_t *", "GListPtr", "GListPtr") int pe__group_html(pcmk__output_t *out, va_list args) { unsigned int options = va_arg(args, unsigned int); pe_resource_t *rsc = va_arg(args, pe_resource_t *); - GList *only_node = va_arg(args, GList *); - GList *only_rsc = va_arg(args, GList *); + GListPtr only_node = va_arg(args, GListPtr); + GListPtr only_rsc = va_arg(args, GListPtr); int rc = pcmk_rc_no_output; gboolean print_everything = TRUE; @@ -251,7 +251,7 @@ pe__group_html(pcmk__output_t *out, va_list args) (strstr(rsc->id, ":") != NULL && pcmk__str_in_list(only_rsc, rsc->id)); if (options & pe_print_brief) { - GList *rscs = pe__filter_rsc_list(rsc->children, only_rsc); + GListPtr rscs = pe__filter_rsc_list(rsc->children, only_rsc); if (rscs != NULL) { out->begin_list(out, NULL, NULL, "Resource Group: %s%s%s", rsc->id, @@ -265,7 +265,7 @@ pe__group_html(pcmk__output_t *out, va_list args) } } else { - for (GList *gIter = rsc->children; gIter; gIter = gIter->next) { + for (GListPtr gIter = rsc->children; gIter; gIter = gIter->next) { pe_resource_t *child_rsc = (pe_resource_t *) gIter->data; if (child_rsc->fns->is_filtered(child_rsc, only_rsc, print_everything)) { @@ -286,14 +286,14 @@ pe__group_html(pcmk__output_t *out, va_list args) return rc; } -PCMK__OUTPUT_ARGS("group", "unsigned int", "pe_resource_t *", "GList *", "GList *") +PCMK__OUTPUT_ARGS("group", "unsigned int", "pe_resource_t *", "GListPtr", "GListPtr") int pe__group_text(pcmk__output_t *out, va_list args) { unsigned int options = va_arg(args, unsigned int); pe_resource_t *rsc = va_arg(args, pe_resource_t *); - GList *only_node = va_arg(args, GList *); - GList *only_rsc = va_arg(args, GList *); + GListPtr only_node = va_arg(args, GListPtr); + GListPtr only_rsc = va_arg(args, GListPtr); int rc = pcmk_rc_no_output; gboolean print_everything = TRUE; @@ -306,7 +306,7 @@ pe__group_text(pcmk__output_t *out, va_list args) (strstr(rsc->id, ":") != NULL && pcmk__str_in_list(only_rsc, rsc->id)); if (options & pe_print_brief) { - GList *rscs = pe__filter_rsc_list(rsc->children, only_rsc); + GListPtr rscs = pe__filter_rsc_list(rsc->children, only_rsc); if (rscs != NULL) { out->begin_list(out, NULL, NULL, "Resource Group: %s%s%s", rsc->id, @@ -320,7 +320,7 @@ pe__group_text(pcmk__output_t *out, va_list args) } } else { - for (GList *gIter = rsc->children; gIter; gIter = gIter->next) { + for (GListPtr gIter = rsc->children; gIter; gIter = gIter->next) { pe_resource_t *child_rsc = (pe_resource_t *) gIter->data; if (child_rsc->fns->is_filtered(child_rsc, only_rsc, print_everything)) { diff --git a/lib/pengine/native.c b/lib/pengine/native.c index 45510db..8f0c5c9 100644 --- a/lib/pengine/native.c +++ b/lib/pengine/native.c @@ -312,28 +312,48 @@ native_find_rsc(pe_resource_t * rsc, const char *id, const pe_node_t *on_node, return NULL; } -// create is ignored char * native_parameter(pe_resource_t * rsc, pe_node_t * node, gboolean create, const char *name, pe_working_set_t * data_set) { char *value_copy = NULL; const char *value = NULL; - GHashTable *params = NULL; + GHashTable *hash = NULL; + GHashTable *local_hash = NULL; CRM_CHECK(rsc != NULL, return NULL); CRM_CHECK(name != NULL && strlen(name) != 0, return NULL); pe_rsc_trace(rsc, "Looking up %s in %s", name, rsc->id); - params = pe_rsc_params(rsc, node, data_set); - value = g_hash_table_lookup(params, name); + + if (create || g_hash_table_size(rsc->parameters) == 0) { + if (node != NULL) { + pe_rsc_trace(rsc, "Creating hash with node %s", node->details->uname); + } else { + pe_rsc_trace(rsc, "Creating default hash"); + } + + local_hash = crm_str_table_new(); + + get_rsc_attributes(local_hash, rsc, node, data_set); + + hash = local_hash; + } else { + hash = rsc->parameters; + } + + value = g_hash_table_lookup(hash, name); if (value == NULL) { /* try meta attributes instead */ value = g_hash_table_lookup(rsc->meta, name); } + if (value != NULL) { value_copy = strdup(value); } + if (local_hash != NULL) { + g_hash_table_destroy(local_hash); + } return value_copy; } @@ -550,21 +570,17 @@ add_output_node(GString *s, const char *node, bool have_nodes) * \return Newly allocated string description of resource * \note Caller must free the result with g_free(). */ -gchar * -pcmk__native_output_string(pe_resource_t *rsc, const char *name, pe_node_t *node, - long options, const char *target_role, bool show_nodes) +static gchar * +native_output_string(pe_resource_t *rsc, const char *name, pe_node_t *node, + long options, const char *target_role, bool show_nodes) { const char *class = crm_element_value(rsc->xml, XML_AGENT_ATTR_CLASS); const char *provider = NULL; const char *kind = crm_element_value(rsc->xml, XML_ATTR_TYPE); - gchar *retval = NULL; + char *retval = NULL; GString *outstr = NULL; bool have_flags = false; - if (rsc->variant != pe_native) { - return NULL; - } - CRM_CHECK(name != NULL, name = "unknown"); CRM_CHECK(kind != NULL, kind = "unknown"); CRM_CHECK(class != NULL, class = "unknown"); @@ -742,8 +758,8 @@ pe__common_output_html(pcmk__output_t *out, pe_resource_t * rsc, } { - gchar *s = pcmk__native_output_string(rsc, name, node, options, - target_role, true); + gchar *s = native_output_string(rsc, name, node, options, target_role, + true); list_node = pcmk__output_create_html_node(out, "li", NULL, NULL, NULL); pcmk_create_html_node(list_node, "span", NULL, cl, s); @@ -810,8 +826,8 @@ pe__common_output_text(pcmk__output_t *out, pe_resource_t * rsc, } { - gchar *s = pcmk__native_output_string(rsc, name, node, options, - target_role, true); + gchar *s = native_output_string(rsc, name, node, options, target_role, + true); out->list_item(out, NULL, "%s", s); g_free(s); @@ -907,8 +923,8 @@ common_print(pe_resource_t * rsc, const char *pre_text, const char *name, pe_nod } { - gchar *resource_s = pcmk__native_output_string(rsc, name, node, options, - target_role, false); + gchar *resource_s = native_output_string(rsc, name, node, options, + target_role, false); status_print("%s%s", (pre_text? pre_text : ""), resource_s); g_free(resource_s); } @@ -1031,14 +1047,14 @@ native_print(pe_resource_t * rsc, const char *pre_text, long options, void *prin common_print(rsc, pre_text, rsc_printable_id(rsc), node, options, print_data); } -PCMK__OUTPUT_ARGS("primitive", "unsigned int", "pe_resource_t *", "GList *", "GList *") +PCMK__OUTPUT_ARGS("primitive", "unsigned int", "pe_resource_t *", "GListPtr", "GListPtr") int pe__resource_xml(pcmk__output_t *out, va_list args) { unsigned int options = va_arg(args, unsigned int); pe_resource_t *rsc = va_arg(args, pe_resource_t *); - GList *only_node G_GNUC_UNUSED = va_arg(args, GList *); - GList *only_rsc = va_arg(args, GList *); + GListPtr only_node G_GNUC_UNUSED = va_arg(args, GListPtr); + GListPtr only_rsc = va_arg(args, GListPtr); const char *class = crm_element_value(rsc->xml, XML_AGENT_ATTR_CLASS); const char *prov = crm_element_value(rsc->xml, XML_AGENT_ATTR_PROVIDER); @@ -1093,7 +1109,7 @@ pe__resource_xml(pcmk__output_t *out, va_list args) CRM_ASSERT(rc == pcmk_rc_ok); if (rsc->running_on != NULL) { - GList *gIter = rsc->running_on; + GListPtr gIter = rsc->running_on; for (; gIter != NULL; gIter = gIter->next) { pe_node_t *node = (pe_node_t *) gIter->data; @@ -1110,14 +1126,14 @@ pe__resource_xml(pcmk__output_t *out, va_list args) return rc; } -PCMK__OUTPUT_ARGS("primitive", "unsigned int", "pe_resource_t *", "GList *", "GList *") +PCMK__OUTPUT_ARGS("primitive", "unsigned int", "pe_resource_t *", "GListPtr", "GListPtr") int pe__resource_html(pcmk__output_t *out, va_list args) { unsigned int options = va_arg(args, unsigned int); pe_resource_t *rsc = va_arg(args, pe_resource_t *); - GList *only_node G_GNUC_UNUSED = va_arg(args, GList *); - GList *only_rsc = va_arg(args, GList *); + GListPtr only_node G_GNUC_UNUSED = va_arg(args, GListPtr); + GListPtr only_rsc = va_arg(args, GListPtr); pe_node_t *node = pe__current_node(rsc); @@ -1134,14 +1150,14 @@ pe__resource_html(pcmk__output_t *out, va_list args) return pe__common_output_html(out, rsc, rsc_printable_id(rsc), node, options); } -PCMK__OUTPUT_ARGS("primitive", "unsigned int", "pe_resource_t *", "GList *", "GList *") +PCMK__OUTPUT_ARGS("primitive", "unsigned int", "pe_resource_t *", "GListPtr", "GListPtr") int pe__resource_text(pcmk__output_t *out, va_list args) { unsigned int options = va_arg(args, unsigned int); pe_resource_t *rsc = va_arg(args, pe_resource_t *); - GList *only_node G_GNUC_UNUSED = va_arg(args, GList *); - GList *only_rsc = va_arg(args, GList *); + GListPtr only_node G_GNUC_UNUSED = va_arg(args, GListPtr); + GListPtr only_rsc = va_arg(args, GListPtr); pe_node_t *node = pe__current_node(rsc); @@ -1436,12 +1452,12 @@ pe__rscs_brief_output(pcmk__output_t *out, GListPtr rsc_list, long options, gboo } if (print_all) { - out->list_item(out, NULL, "%d/%d\t(%s):\tActive %s", + out->list_item(out, NULL, " %d/%d\t(%s):\tActive %s", *active_counter, rsc_counter ? *rsc_counter : 0, type, (*active_counter > 0) && node_name ? node_name : ""); } else { - out->list_item(out, NULL, "%d\t(%s):\tActive %s", + out->list_item(out, NULL, " %d\t(%s):\tActive %s", *active_counter, type, (*active_counter > 0) && node_name ? node_name : ""); } @@ -1450,7 +1466,7 @@ pe__rscs_brief_output(pcmk__output_t *out, GListPtr rsc_list, long options, gboo } if (print_all && active_counter_all == 0) { - out->list_item(out, NULL, "%d/%d\t(%s):\tActive", + out->list_item(out, NULL, " %d/%d\t(%s):\tActive", active_counter_all, rsc_counter ? *rsc_counter : 0, type); rc = pcmk_rc_ok; diff --git a/lib/pengine/pe_digest.c b/lib/pengine/pe_digest.c deleted file mode 100644 index 2066a53..0000000 --- a/lib/pengine/pe_digest.c +++ /dev/null @@ -1,566 +0,0 @@ -/* - * Copyright 2004-2020 the Pacemaker project contributors - * - * The version control history for this file may have further details. - * - * This source code is licensed under the GNU Lesser General Public License - * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. - */ - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include "pe_status_private.h" - -/*! - * \internal - * \brief Free an operation digest cache entry - * - * \param[in] ptr Pointer to cache entry to free - * - * \note The argument is a gpointer so this can be used as a hash table - * free function. - */ -void -pe__free_digests(gpointer ptr) -{ - op_digest_cache_t *data = ptr; - - if (data != NULL) { - free_xml(data->params_all); - free_xml(data->params_secure); - free_xml(data->params_restart); - - free(data->digest_all_calc); - free(data->digest_restart_calc); - free(data->digest_secure_calc); - - free(data); - } -} - -// Return true if XML attribute name is substring of a given string -static bool -attr_in_string(xmlAttrPtr a, void *user_data) -{ - bool filter = false; - char *name = crm_strdup_printf(" %s ", (const char *) a->name); - - if (strstr((const char *) user_data, name) == NULL) { - crm_trace("Filtering %s (not found in '%s')", - (const char *) a->name, (const char *) user_data); - filter = true; - } - free(name); - return filter; -} - -// Return true if XML attribute name is not substring of a given string -static bool -attr_not_in_string(xmlAttrPtr a, void *user_data) -{ - bool filter = false; - char *name = crm_strdup_printf(" %s ", (const char *) a->name); - - if (strstr((const char *) user_data, name) != NULL) { - crm_trace("Filtering %s (found in '%s')", - (const char *) a->name, (const char *) user_data); - filter = true; - } - free(name); - return filter; -} - -#if ENABLE_VERSIONED_ATTRS -static void -append_versioned_params(xmlNode *versioned_params, const char *ra_version, xmlNode *params) -{ - GHashTable *hash = pe_unpack_versioned_parameters(versioned_params, ra_version); - char *key = NULL; - char *value = NULL; - GHashTableIter iter; - - g_hash_table_iter_init(&iter, hash); - while (g_hash_table_iter_next(&iter, (gpointer *) &key, (gpointer *) &value)) { - crm_xml_add(params, key, value); - } - g_hash_table_destroy(hash); -} - -static void -append_all_versioned_params(pe_resource_t *rsc, pe_node_t *node, - pe_action_t *action, xmlNode *xml_op, - pe_working_set_t *data_set) -{ - const char *ra_version = NULL; - xmlNode *local_versioned_params = NULL; - pe_rsc_action_details_t *details = pe_rsc_action_details(action); - - local_versioned_params = create_xml_node(NULL, XML_TAG_RSC_VER_ATTRS); - pe_get_versioned_attributes(local_versioned_params, rsc, node, data_set); - if (xml_op != NULL) { - ra_version = crm_element_value(xml_op, XML_ATTR_RA_VERSION); - } - append_versioned_params(local_versioned_params, ra_version, - data->params_all); - append_versioned_params(rsc->versioned_parameters, ra_version, - data->params_all); - append_versioned_params(details->versioned_parameters, ra_version, - data->params_all); -} -#endif - -/*! - * \internal - * \brief Add digest of all parameters to a digest cache entry - * - * \param[out] data Digest cache entry to modify - * \param[in] rsc Resource that action was for - * \param[in] node Node action was performed on - * \param[in] params Resource parameters evaluated for node - * \param[in] task Name of action performed - * \param[in,out] interval_ms Action's interval (will be reset if in overrides) - * \param[in] xml_op XML of operation in CIB status (if available) - * \param[in] op_version CRM feature set to use for digest calculation - * \param[in] overrides Key/value table to override resource parameters - * \param[in] data_set Cluster working set - */ -static void -calculate_main_digest(op_digest_cache_t *data, pe_resource_t *rsc, - pe_node_t *node, GHashTable *params, - const char *task, guint *interval_ms, - xmlNode *xml_op, const char *op_version, - GHashTable *overrides, pe_working_set_t *data_set) -{ - pe_action_t *action = NULL; - - data->params_all = create_xml_node(NULL, XML_TAG_PARAMS); - - /* REMOTE_CONTAINER_HACK: Allow Pacemaker Remote nodes to run containers - * that themselves are Pacemaker Remote nodes - */ - if (pe__add_bundle_remote_name(rsc, data_set, data->params_all, - XML_RSC_ATTR_REMOTE_RA_ADDR)) { - crm_trace("Set address for bundle connection %s (on %s)", - rsc->id, node->details->uname); - } - - // If interval was overridden, reset it - if (overrides != NULL) { - const char *interval_s = g_hash_table_lookup(overrides, CRM_META "_" - XML_LRM_ATTR_INTERVAL); - - if (interval_s != NULL) { - long long value_ll; - - errno = 0; - value_ll = crm_parse_ll(interval_s, NULL); - if ((errno == 0) && (value_ll >= 0) && (value_ll <= G_MAXUINT)) { - *interval_ms = (guint) value_ll; - } - } - } - - action = custom_action(rsc, pcmk__op_key(rsc->id, task, *interval_ms), - task, node, TRUE, FALSE, data_set); - if (overrides != NULL) { - g_hash_table_foreach(overrides, hash2field, data->params_all); - } - g_hash_table_foreach(params, hash2field, data->params_all); - g_hash_table_foreach(action->extra, hash2field, data->params_all); - g_hash_table_foreach(action->meta, hash2metafield, data->params_all); - -#if ENABLE_VERSIONED_ATTRS - append_all_versioned_params(rsc, node, action, xml_op, data_set); -#endif - - pcmk__filter_op_for_digest(data->params_all); - - pe_free_action(action); - - data->digest_all_calc = calculate_operation_digest(data->params_all, - op_version); -} - -// Return true if XML attribute name is a Pacemaker-defined fencing parameter -static bool -is_fence_param(xmlAttrPtr attr, void *user_data) -{ - return pcmk_stonith_param((const char *) attr->name); -} - -/*! - * \internal - * \brief Add secure digest to a digest cache entry - * - * \param[out] data Digest cache entry to modify - * \param[in] rsc Resource that action was for - * \param[in] params Resource parameters evaluated for node - * \param[in] xml_op XML of operation in CIB status (if available) - * \param[in] op_version CRM feature set to use for digest calculation - * \param[in] overrides Key/value hash table to override resource parameters - */ -static void -calculate_secure_digest(op_digest_cache_t *data, pe_resource_t *rsc, - GHashTable *params, xmlNode *xml_op, - const char *op_version, GHashTable *overrides) -{ - const char *class = crm_element_value(rsc->xml, XML_AGENT_ATTR_CLASS); - const char *secure_list = NULL; - - if (xml_op == NULL) { - secure_list = " passwd password user "; - } else { - secure_list = crm_element_value(xml_op, XML_LRM_ATTR_OP_SECURE); - } - - data->params_secure = create_xml_node(NULL, XML_TAG_PARAMS); - if (overrides != NULL) { - g_hash_table_foreach(overrides, hash2field, data->params_secure); - } - - g_hash_table_foreach(params, hash2field, data->params_secure); - if (secure_list != NULL) { - pcmk__xe_remove_matching_attrs(data->params_secure, attr_not_in_string, - (void *) secure_list); - } - if (pcmk_is_set(pcmk_get_ra_caps(class), - pcmk_ra_cap_fence_params)) { - /* For stonith resources, Pacemaker adds special parameters, - * but these are not listed in fence agent meta-data, so the - * controller will not hash them. That means we have to filter - * them out before calculating our hash for comparison. - */ - pcmk__xe_remove_matching_attrs(data->params_secure, is_fence_param, - NULL); - } - pcmk__filter_op_for_digest(data->params_secure); - - /* CRM_meta_timeout *should* be part of a digest for recurring operations. - * However, currently the controller does not add timeout to secure digests, - * because it only includes parameters declared by the resource agent. - * Remove any timeout that made it this far, to match. - * - * @TODO Update the controller to add the timeout (which will require - * bumping the feature set and checking that here). - */ - xml_remove_prop(data->params_secure, CRM_META "_" XML_ATTR_TIMEOUT); - - data->digest_secure_calc = calculate_operation_digest(data->params_secure, - op_version); -} - -/*! - * \internal - * \brief Add restart digest to a digest cache entry - * - * \param[out] data Digest cache entry to modify - * \param[in] xml_op XML of operation in CIB status (if available) - * \param[in] op_version CRM feature set to use for digest calculation - * - * \note This function doesn't need to handle overrides because it starts with - * data->params_all, which already has overrides applied. - */ -static void -calculate_restart_digest(op_digest_cache_t *data, xmlNode *xml_op, - const char *op_version) -{ - const char *value = NULL; - - // We must have XML of resource operation history - if (xml_op == NULL) { - return; - } - - // And the history must have a restart digest to compare against - if (crm_element_value(xml_op, XML_LRM_ATTR_RESTART_DIGEST) == NULL) { - return; - } - - // Start with a copy of all parameters - data->params_restart = copy_xml(data->params_all); - - // Then filter out reloadable parameters, if any - value = crm_element_value(xml_op, XML_LRM_ATTR_OP_RESTART); - if (value != NULL) { - pcmk__xe_remove_matching_attrs(data->params_restart, attr_in_string, - (void *) value); - } - - value = crm_element_value(xml_op, XML_ATTR_CRM_VERSION); - data->digest_restart_calc = calculate_operation_digest(data->params_restart, - value); -} - -/*! - * \internal - * \brief Create a new digest cache entry with calculated digests - * - * \param[in] rsc Resource that action was for - * \param[in] task Name of action performed - * \param[in,out] interval_ms Action's interval (will be reset if in overrides) - * \param[in] node Node action was performed on - * \param[in] xml_op XML of operation in CIB status (if available) - * \param[in] overrides Key/value table to override resource parameters - * \param[in] calc_secure Whether to calculate secure digest - * \param[in] data_set Cluster working set - * - * \return Pointer to new digest cache entry (or NULL on memory error) - * \note It is the caller's responsibility to free the result using - * pe__free_digests(). - */ -op_digest_cache_t * -pe__calculate_digests(pe_resource_t *rsc, const char *task, guint *interval_ms, - pe_node_t *node, xmlNode *xml_op, GHashTable *overrides, - bool calc_secure, pe_working_set_t *data_set) -{ - op_digest_cache_t *data = calloc(1, sizeof(op_digest_cache_t)); - const char *op_version = CRM_FEATURE_SET; - GHashTable *params = NULL; - - if (data == NULL) { - return NULL; - } - if (xml_op != NULL) { - op_version = crm_element_value(xml_op, XML_ATTR_CRM_VERSION); - } - - params = pe_rsc_params(rsc, node, data_set); - calculate_main_digest(data, rsc, node, params, task, interval_ms, xml_op, - op_version, overrides, data_set); - if (calc_secure) { - calculate_secure_digest(data, rsc, params, xml_op, op_version, - overrides); - } - calculate_restart_digest(data, xml_op, op_version); - return data; -} - -/*! - * \internal - * \brief Calculate action digests and store in node's digest cache - * - * \param[in] rsc Resource that action was for - * \param[in] task Name of action performed - * \param[in] interval_ms Action's interval - * \param[in] node Node action was performed on - * \param[in] xml_op XML of operation in CIB status (if available) - * \param[in] calc_secure Whether to calculate secure digest - * \param[in] data_set Cluster working set - * - * \return Pointer to node's digest cache entry - */ -static op_digest_cache_t * -rsc_action_digest(pe_resource_t *rsc, const char *task, guint interval_ms, - pe_node_t *node, xmlNode *xml_op, bool calc_secure, - pe_working_set_t *data_set) -{ - op_digest_cache_t *data = NULL; - char *key = pcmk__op_key(rsc->id, task, interval_ms); - - data = g_hash_table_lookup(node->details->digest_cache, key); - if (data == NULL) { - data = pe__calculate_digests(rsc, task, &interval_ms, node, xml_op, - NULL, calc_secure, data_set); - CRM_ASSERT(data != NULL); - g_hash_table_insert(node->details->digest_cache, strdup(key), data); - } - free(key); - return data; -} - -/*! - * \internal - * \brief Calculate operation digests and compare against an XML history entry - * - * \param[in] rsc Resource to check - * \param[in] xml_op Resource history XML - * \param[in] node Node to use for digest calculation - * \param[in] data_set Cluster working set - * - * \return Pointer to node's digest cache entry, with comparison result set - */ -op_digest_cache_t * -rsc_action_digest_cmp(pe_resource_t * rsc, xmlNode * xml_op, pe_node_t * node, - pe_working_set_t * data_set) -{ - op_digest_cache_t *data = NULL; - guint interval_ms = 0; - - const char *op_version; - const char *task = crm_element_value(xml_op, XML_LRM_ATTR_TASK); - const char *digest_all; - const char *digest_restart; - - CRM_ASSERT(node != NULL); - - op_version = crm_element_value(xml_op, XML_ATTR_CRM_VERSION); - digest_all = crm_element_value(xml_op, XML_LRM_ATTR_OP_DIGEST); - digest_restart = crm_element_value(xml_op, XML_LRM_ATTR_RESTART_DIGEST); - - crm_element_value_ms(xml_op, XML_LRM_ATTR_INTERVAL_MS, &interval_ms); - data = rsc_action_digest(rsc, task, interval_ms, node, xml_op, - pcmk_is_set(data_set->flags, pe_flag_sanitized), - data_set); - - data->rc = RSC_DIGEST_MATCH; - if (digest_restart && data->digest_restart_calc && strcmp(data->digest_restart_calc, digest_restart) != 0) { - pe_rsc_info(rsc, "Parameters to %ums-interval %s action for %s on %s " - "changed: hash was %s vs. now %s (restart:%s) %s", - interval_ms, task, rsc->id, node->details->uname, - crm_str(digest_restart), data->digest_restart_calc, - op_version, - crm_element_value(xml_op, XML_ATTR_TRANSITION_MAGIC)); - data->rc = RSC_DIGEST_RESTART; - - } else if (digest_all == NULL) { - /* it is unknown what the previous op digest was */ - data->rc = RSC_DIGEST_UNKNOWN; - - } else if (strcmp(digest_all, data->digest_all_calc) != 0) { - pe_rsc_info(rsc, "Parameters to %ums-interval %s action for %s on %s " - "changed: hash was %s vs. now %s (%s:%s) %s", - interval_ms, task, rsc->id, node->details->uname, - crm_str(digest_all), data->digest_all_calc, - (interval_ms > 0)? "reschedule" : "reload", - op_version, - crm_element_value(xml_op, XML_ATTR_TRANSITION_MAGIC)); - data->rc = RSC_DIGEST_ALL; - } - return data; -} - -/*! - * \internal - * \brief Create an unfencing summary for use in special node attribute - * - * Create a string combining a fence device's resource ID, agent type, and - * parameter digest (whether for all parameters or just non-private parameters). - * This can be stored in a special node attribute, allowing us to detect changes - * in either the agent type or parameters, to know whether unfencing must be - * redone or can be safely skipped when the device's history is cleaned. - * - * \param[in] rsc_id Fence device resource ID - * \param[in] agent_type Fence device agent - * \param[in] param_digest Fence device parameter digest - * - * \return Newly allocated string with unfencing digest - * \note The caller is responsible for freeing the result. - */ -static inline char * -create_unfencing_summary(const char *rsc_id, const char *agent_type, - const char *param_digest) -{ - return crm_strdup_printf("%s:%s:%s", rsc_id, agent_type, param_digest); -} - -/*! - * \internal - * \brief Check whether a node can skip unfencing - * - * Check whether a fence device's current definition matches a node's - * stored summary of when it was last unfenced by the device. - * - * \param[in] rsc_id Fence device's resource ID - * \param[in] agent Fence device's agent type - * \param[in] digest_calc Fence device's current parameter digest - * \param[in] node_summary Value of node's special unfencing node attribute - * (a comma-separated list of unfencing summaries for - * all devices that have unfenced this node) - * - * \return TRUE if digest matches, FALSE otherwise - */ -static bool -unfencing_digest_matches(const char *rsc_id, const char *agent, - const char *digest_calc, const char *node_summary) -{ - bool matches = FALSE; - - if (rsc_id && agent && digest_calc && node_summary) { - char *search_secure = create_unfencing_summary(rsc_id, agent, - digest_calc); - - /* The digest was calculated including the device ID and agent, - * so there is no risk of collision using strstr(). - */ - matches = (strstr(node_summary, search_secure) != NULL); - crm_trace("Calculated unfencing digest '%s' %sfound in '%s'", - search_secure, matches? "" : "not ", node_summary); - free(search_secure); - } - return matches; -} - -/* Magic string to use as action name for digest cache entries used for - * unfencing checks. This is not a real action name (i.e. "on"), so - * check_action_definition() won't confuse these entries with real actions. - */ -#define STONITH_DIGEST_TASK "stonith-on" - -/*! - * \internal - * \brief Calculate fence device digests and digest comparison result - * - * \param[in] rsc Fence device resource - * \param[in] agent Fence device's agent type - * \param[in] node Node with digest cache to use - * \param[in] data_set Cluster working set - * - * \return Node's digest cache entry - */ -op_digest_cache_t * -pe__compare_fencing_digest(pe_resource_t *rsc, const char *agent, - pe_node_t *node, pe_working_set_t *data_set) -{ - const char *node_summary = NULL; - - // Calculate device's current parameter digests - op_digest_cache_t *data = rsc_action_digest(rsc, STONITH_DIGEST_TASK, 0U, - node, NULL, TRUE, data_set); - - // Check whether node has special unfencing summary node attribute - node_summary = pe_node_attribute_raw(node, CRM_ATTR_DIGESTS_ALL); - if (node_summary == NULL) { - data->rc = RSC_DIGEST_UNKNOWN; - return data; - } - - // Check whether full parameter digest matches - if (unfencing_digest_matches(rsc->id, agent, data->digest_all_calc, - node_summary)) { - data->rc = RSC_DIGEST_MATCH; - return data; - } - - // Check whether secure parameter digest matches - node_summary = pe_node_attribute_raw(node, CRM_ATTR_DIGESTS_SECURE); - if (unfencing_digest_matches(rsc->id, agent, data->digest_secure_calc, - node_summary)) { - data->rc = RSC_DIGEST_MATCH; - if (pcmk_is_set(data_set->flags, pe_flag_stdout)) { - printf("Only 'private' parameters to %s for unfencing %s changed\n", - rsc->id, node->details->uname); - } - return data; - } - - // Parameters don't match - data->rc = RSC_DIGEST_ALL; - if (pcmk_is_set(data_set->flags, (pe_flag_sanitized|pe_flag_stdout)) - && data->digest_secure_calc) { - char *digest = create_unfencing_summary(rsc->id, agent, - data->digest_secure_calc); - - printf("Parameters to %s for unfencing %s changed, try '%s'\n", - rsc->id, node->details->uname, digest); - free(digest); - } - return data; -} diff --git a/lib/pengine/pe_output.c b/lib/pengine/pe_output.c index f1a6b43..186be33 100644 --- a/lib/pengine/pe_output.c +++ b/lib/pengine/pe_output.c @@ -9,7 +9,6 @@ #include #include -#include #include #include @@ -216,8 +215,8 @@ pe__cluster_summary(pcmk__output_t *out, va_list args) { gboolean show_times = va_arg(args, gboolean); gboolean show_counts = va_arg(args, gboolean); gboolean show_options = va_arg(args, gboolean); - int rc = pcmk_rc_no_output; + const char *stack_s = get_cluster_stack(data_set); if (show_stack) { @@ -273,8 +272,8 @@ pe__cluster_summary(pcmk__output_t *out, va_list args) { PCMK__OUTPUT_ARGS("cluster-summary", "pe_working_set_t *", "gboolean", "gboolean", "gboolean", "gboolean", "gboolean", "gboolean") -static int -cluster_summary_html(pcmk__output_t *out, va_list args) { +int +pe__cluster_summary_html(pcmk__output_t *out, va_list args) { pe_working_set_t *data_set = va_arg(args, pe_working_set_t *); gboolean print_clone_detail = va_arg(args, gboolean); gboolean show_stack = va_arg(args, gboolean); @@ -282,8 +281,8 @@ cluster_summary_html(pcmk__output_t *out, va_list args) { gboolean show_times = va_arg(args, gboolean); gboolean show_counts = va_arg(args, gboolean); gboolean show_options = va_arg(args, gboolean); - int rc = pcmk_rc_no_output; + const char *stack_s = get_cluster_stack(data_set); if (show_stack) { @@ -415,7 +414,7 @@ pe__name_and_nvpairs_xml(pcmk__output_t *out, bool is_list, const char *tag_name const char *param_name = va_arg(args, const char *); const char *param_value = va_arg(args, const char *); if (param_name && param_value) { - crm_xml_add(xml_node, param_name, param_value); + xmlSetProp(xml_node, (pcmkXmlStr)param_name, (pcmkXmlStr)param_value); } }; va_end(args); @@ -427,8 +426,8 @@ pe__name_and_nvpairs_xml(pcmk__output_t *out, bool is_list, const char *tag_name } PCMK__OUTPUT_ARGS("ban", "pe_node_t *", "pe__location_t *", "gboolean") -static int -ban_html(pcmk__output_t *out, va_list args) { +int +pe__ban_html(pcmk__output_t *out, va_list args) { pe_node_t *pe_node = va_arg(args, pe_node_t *); pe__location_t *location = va_arg(args, pe__location_t *); gboolean print_clone_detail = va_arg(args, gboolean); @@ -464,37 +463,37 @@ pe__ban_text(pcmk__output_t *out, va_list args) { } PCMK__OUTPUT_ARGS("ban", "pe_node_t *", "pe__location_t *", "gboolean") -static int -ban_xml(pcmk__output_t *out, va_list args) { +int +pe__ban_xml(pcmk__output_t *out, va_list args) { + xmlNodePtr node = pcmk__output_create_xml_node(out, "ban"); pe_node_t *pe_node = va_arg(args, pe_node_t *); pe__location_t *location = va_arg(args, pe__location_t *); gboolean print_clone_detail G_GNUC_UNUSED = va_arg(args, gboolean); char *weight_s = crm_itoa(pe_node->weight); - pcmk__output_create_xml_node(out, "ban", - "id", location->id, - "resource", location->rsc_lh->id, - "node", pe_node->details->uname, - "weight", weight_s, - "master_only", pcmk__btoa(location->role_filter == RSC_ROLE_MASTER), - NULL); + xmlSetProp(node, (pcmkXmlStr) "id", (pcmkXmlStr) location->id); + xmlSetProp(node, (pcmkXmlStr) "resource", (pcmkXmlStr) location->rsc_lh->id); + xmlSetProp(node, (pcmkXmlStr) "node", (pcmkXmlStr) pe_node->details->uname); + xmlSetProp(node, (pcmkXmlStr) "weight", (pcmkXmlStr) weight_s); + xmlSetProp(node, (pcmkXmlStr) "master_only", + (pcmkXmlStr) pcmk__btoa(location->role_filter == RSC_ROLE_MASTER)); free(weight_s); return pcmk_rc_ok; } PCMK__OUTPUT_ARGS("cluster-counts", "unsigned int", "int", "int", "int") -static int -cluster_counts_html(pcmk__output_t *out, va_list args) { +int +pe__cluster_counts_html(pcmk__output_t *out, va_list args) { + xmlNodePtr nodes_node = pcmk__output_create_xml_node(out, "li"); + xmlNodePtr resources_node = pcmk__output_create_xml_node(out, "li"); + unsigned int nnodes = va_arg(args, unsigned int); int nresources = va_arg(args, int); int ndisabled = va_arg(args, int); int nblocked = va_arg(args, int); - xmlNodePtr nodes_node = pcmk__output_create_xml_node(out, "li", NULL); - xmlNodePtr resources_node = pcmk__output_create_xml_node(out, "li", NULL); - char *nnodes_str = crm_strdup_printf("%d node%s configured", nnodes, pcmk__plural_s(nnodes)); @@ -581,45 +580,45 @@ pe__cluster_counts_text(pcmk__output_t *out, va_list args) { } PCMK__OUTPUT_ARGS("cluster-counts", "unsigned int", "int", "int", "int") -static int -cluster_counts_xml(pcmk__output_t *out, va_list args) { +int +pe__cluster_counts_xml(pcmk__output_t *out, va_list args) { + xmlNodePtr nodes_node = pcmk__output_create_xml_node(out, "nodes_configured"); + xmlNodePtr resources_node = pcmk__output_create_xml_node(out, "resources_configured"); + unsigned int nnodes = va_arg(args, unsigned int); int nresources = va_arg(args, int); int ndisabled = va_arg(args, int); int nblocked = va_arg(args, int); - xmlNodePtr nodes_node = pcmk__output_create_xml_node(out, "nodes_configured", NULL); - xmlNodePtr resources_node = pcmk__output_create_xml_node(out, "resources_configured", NULL); - char *s = crm_itoa(nnodes); - crm_xml_add(nodes_node, "number", s); + xmlSetProp(nodes_node, (pcmkXmlStr) "number", (pcmkXmlStr) s); free(s); s = crm_itoa(nresources); - crm_xml_add(resources_node, "number", s); + xmlSetProp(resources_node, (pcmkXmlStr) "number", (pcmkXmlStr) s); free(s); s = crm_itoa(ndisabled); - crm_xml_add(resources_node, "disabled", s); + xmlSetProp(resources_node, (pcmkXmlStr) "disabled", (pcmkXmlStr) s); free(s); s = crm_itoa(nblocked); - crm_xml_add(resources_node, "blocked", s); + xmlSetProp(resources_node, (pcmkXmlStr) "blocked", (pcmkXmlStr) s); free(s); return pcmk_rc_ok; } PCMK__OUTPUT_ARGS("cluster-dc", "pe_node_t *", "const char *", "const char *", "char *") -static int -cluster_dc_html(pcmk__output_t *out, va_list args) { +int +pe__cluster_dc_html(pcmk__output_t *out, va_list args) { + xmlNodePtr node = pcmk__output_create_xml_node(out, "li"); + pe_node_t *dc = va_arg(args, pe_node_t *); const char *quorum = va_arg(args, const char *); const char *dc_version_s = va_arg(args, const char *); char *dc_name = va_arg(args, char *); - xmlNodePtr node = pcmk__output_create_xml_node(out, "li", NULL); - pcmk_create_html_node(node, "span", NULL, "bold", "Current DC: "); if (dc) { @@ -664,42 +663,43 @@ pe__cluster_dc_text(pcmk__output_t *out, va_list args) { } PCMK__OUTPUT_ARGS("cluster-dc", "pe_node_t *", "const char *", "const char *", "char *") -static int -cluster_dc_xml(pcmk__output_t *out, va_list args) { +int +pe__cluster_dc_xml(pcmk__output_t *out, va_list args) { + xmlNodePtr node = pcmk__output_create_xml_node(out, "current_dc"); + pe_node_t *dc = va_arg(args, pe_node_t *); const char *quorum = va_arg(args, const char *); const char *dc_version_s = va_arg(args, const char *); char *dc_name G_GNUC_UNUSED = va_arg(args, char *); if (dc) { - pcmk__output_create_xml_node(out, "current_dc", - "present", "true", - "version", dc_version_s ? dc_version_s : "", - "name", dc->details->uname, - "id", dc->details->id, - "with_quorum", pcmk__btoa(crm_is_true(quorum)), - NULL); + xmlSetProp(node, (pcmkXmlStr) "present", (pcmkXmlStr) "true"); + xmlSetProp(node, (pcmkXmlStr) "version", (pcmkXmlStr) (dc_version_s ? dc_version_s : "")); + xmlSetProp(node, (pcmkXmlStr) "name", (pcmkXmlStr) dc->details->uname); + xmlSetProp(node, (pcmkXmlStr) "id", (pcmkXmlStr) dc->details->id); + xmlSetProp(node, (pcmkXmlStr) "with_quorum", + (pcmkXmlStr) pcmk__btoa(crm_is_true(quorum))); } else { - pcmk__output_create_xml_node(out, "current_dc", - "present", "false", - NULL); + xmlSetProp(node, (pcmkXmlStr) "present", (pcmkXmlStr) "false"); } return pcmk_rc_ok; } -PCMK__OUTPUT_ARGS("maint-mode", "unsigned long long int") +PCMK__OUTPUT_ARGS("maint-mode", "unsigned long long") int pe__cluster_maint_mode_text(pcmk__output_t *out, va_list args) { unsigned long long flags = va_arg(args, unsigned long long); if (pcmk_is_set(flags, pe_flag_maintenance_mode)) { - out->info(out, "\n *** Resource management is DISABLED ***"); - out->info(out, " The cluster will not attempt to start, stop or recover services"); + fprintf(out->dest, "\n *** Resource management is DISABLED ***"); + fprintf(out->dest, "\n The cluster will not attempt to start, stop or recover services"); + fprintf(out->dest, "\n"); return pcmk_rc_ok; } else if (pcmk_is_set(flags, pe_flag_stop_everything)) { - out->info(out, "\n *** Resource management is DISABLED ***"); - out->info(out, " The cluster will keep all resources stopped"); + fprintf(out->dest, "\n *** Resource management is DISABLED ***"); + fprintf(out->dest, "\n The cluster will keep all resources stopped"); + fprintf(out->dest, "\n"); return pcmk_rc_ok; } else { return pcmk_rc_no_output; @@ -707,8 +707,8 @@ pe__cluster_maint_mode_text(pcmk__output_t *out, va_list args) { } PCMK__OUTPUT_ARGS("cluster-options", "pe_working_set_t *") -static int -cluster_options_html(pcmk__output_t *out, va_list args) { +int +pe__cluster_options_html(pcmk__output_t *out, va_list args) { pe_working_set_t *data_set = va_arg(args, pe_working_set_t *); out->list_item(out, NULL, "STONITH of failed nodes %s", @@ -741,14 +741,14 @@ cluster_options_html(pcmk__output_t *out, va_list args) { } if (pcmk_is_set(data_set->flags, pe_flag_maintenance_mode)) { - xmlNodePtr node = pcmk__output_create_xml_node(out, "li", NULL); + xmlNodePtr node = pcmk__output_create_xml_node(out, "li"); pcmk_create_html_node(node, "span", NULL, NULL, "Resource management: "); pcmk_create_html_node(node, "span", NULL, "bold", "DISABLED"); pcmk_create_html_node(node, "span", NULL, NULL, " (the cluster will not attempt to start, stop, or recover services)"); } else if (pcmk_is_set(data_set->flags, pe_flag_stop_everything)) { - xmlNodePtr node = pcmk__output_create_xml_node(out, "li", NULL); + xmlNodePtr node = pcmk__output_create_xml_node(out, "li"); pcmk_create_html_node(node, "span", NULL, NULL, "Resource management: "); pcmk_create_html_node(node, "span", NULL, "bold", "STOPPED"); @@ -762,8 +762,8 @@ cluster_options_html(pcmk__output_t *out, va_list args) { } PCMK__OUTPUT_ARGS("cluster-options", "pe_working_set_t *") -static int -cluster_options_log(pcmk__output_t *out, va_list args) { +int +pe__cluster_options_log(pcmk__output_t *out, va_list args) { pe_working_set_t *data_set = va_arg(args, pe_working_set_t *); if (pcmk_is_set(data_set->flags, pe_flag_maintenance_mode)) { @@ -815,51 +815,52 @@ pe__cluster_options_text(pcmk__output_t *out, va_list args) { } PCMK__OUTPUT_ARGS("cluster-options", "pe_working_set_t *") -static int -cluster_options_xml(pcmk__output_t *out, va_list args) { +int +pe__cluster_options_xml(pcmk__output_t *out, va_list args) { + xmlNodePtr node = pcmk__output_create_xml_node(out, "cluster_options"); pe_working_set_t *data_set = va_arg(args, pe_working_set_t *); - const char *no_quorum_policy = NULL; + xmlSetProp(node, (pcmkXmlStr) "stonith-enabled", + (pcmkXmlStr) pcmk__btoa(pcmk_is_set(data_set->flags, pe_flag_stonith_enabled))); + xmlSetProp(node, (pcmkXmlStr) "symmetric-cluster", + (pcmkXmlStr) pcmk__btoa(pcmk_is_set(data_set->flags, pe_flag_symmetric_cluster))); switch (data_set->no_quorum_policy) { case no_quorum_freeze: - no_quorum_policy = "freeze"; + xmlSetProp(node, (pcmkXmlStr) "no-quorum-policy", (pcmkXmlStr) "freeze"); break; case no_quorum_stop: - no_quorum_policy = "stop"; + xmlSetProp(node, (pcmkXmlStr) "no-quorum-policy", (pcmkXmlStr) "stop"); break; case no_quorum_demote: - no_quorum_policy = "demote"; + xmlSetProp(node, (pcmkXmlStr) "no-quorum-policy", (pcmkXmlStr) "demote"); break; case no_quorum_ignore: - no_quorum_policy = "ignore"; + xmlSetProp(node, (pcmkXmlStr) "no-quorum-policy", (pcmkXmlStr) "ignore"); break; case no_quorum_suicide: - no_quorum_policy = "suicide"; + xmlSetProp(node, (pcmkXmlStr) "no-quorum-policy", (pcmkXmlStr) "suicide"); break; } - pcmk__output_create_xml_node(out, "cluster_options", - "stonith-enabled", pcmk__btoa(pcmk_is_set(data_set->flags, pe_flag_stonith_enabled)), - "symmetric-cluster", pcmk__btoa(pcmk_is_set(data_set->flags, pe_flag_symmetric_cluster)), - "no-quorum-policy", no_quorum_policy, - "maintenance-mode", pcmk__btoa(pcmk_is_set(data_set->flags, pe_flag_maintenance_mode)), - "stop-all-resources", pcmk__btoa(pcmk_is_set(data_set->flags, pe_flag_stop_everything)), - NULL); + xmlSetProp(node, (pcmkXmlStr) "maintenance-mode", + (pcmkXmlStr) pcmk__btoa(pcmk_is_set(data_set->flags, pe_flag_maintenance_mode))); + xmlSetProp(node, (pcmkXmlStr) "stop-all-resources", + (pcmkXmlStr) pcmk__btoa(pcmk_is_set(data_set->flags, pe_flag_stop_everything))); + return pcmk_rc_ok; } PCMK__OUTPUT_ARGS("cluster-stack", "const char *") -static int -cluster_stack_html(pcmk__output_t *out, va_list args) { +int +pe__cluster_stack_html(pcmk__output_t *out, va_list args) { + xmlNodePtr node = pcmk__output_create_xml_node(out, "li"); const char *stack_s = va_arg(args, const char *); - xmlNodePtr node = pcmk__output_create_xml_node(out, "li", NULL); - pcmk_create_html_node(node, "span", NULL, "bold", "Stack: "); pcmk_create_html_node(node, "span", NULL, NULL, stack_s); @@ -870,34 +871,32 @@ PCMK__OUTPUT_ARGS("cluster-stack", "const char *") int pe__cluster_stack_text(pcmk__output_t *out, va_list args) { const char *stack_s = va_arg(args, const char *); - out->list_item(out, "Stack", "%s", stack_s); return pcmk_rc_ok; } PCMK__OUTPUT_ARGS("cluster-stack", "const char *") -static int -cluster_stack_xml(pcmk__output_t *out, va_list args) { +int +pe__cluster_stack_xml(pcmk__output_t *out, va_list args) { + xmlNodePtr node = pcmk__output_create_xml_node(out, "stack"); const char *stack_s = va_arg(args, const char *); - pcmk__output_create_xml_node(out, "stack", - "type", stack_s, - NULL); + xmlSetProp(node, (pcmkXmlStr) "type", (pcmkXmlStr) stack_s); return pcmk_rc_ok; } PCMK__OUTPUT_ARGS("cluster-times", "const char *", "const char *", "const char *", "const char *") -static int -cluster_times_html(pcmk__output_t *out, va_list args) { +int +pe__cluster_times_html(pcmk__output_t *out, va_list args) { + xmlNodePtr updated_node = pcmk__output_create_xml_node(out, "li"); + xmlNodePtr changed_node = pcmk__output_create_xml_node(out, "li"); + const char *last_written = va_arg(args, const char *); const char *user = va_arg(args, const char *); const char *client = va_arg(args, const char *); const char *origin = va_arg(args, const char *); - xmlNodePtr updated_node = pcmk__output_create_xml_node(out, "li", NULL); - xmlNodePtr changed_node = pcmk__output_create_xml_node(out, "li", NULL); - char *buf = last_changed_string(last_written, user, client, origin); pcmk_create_html_node(updated_node, "span", NULL, "bold", "Last updated: "); @@ -912,22 +911,22 @@ cluster_times_html(pcmk__output_t *out, va_list args) { } PCMK__OUTPUT_ARGS("cluster-times", "const char *", "const char *", "const char *", "const char *") -static int -cluster_times_xml(pcmk__output_t *out, va_list args) { +int +pe__cluster_times_xml(pcmk__output_t *out, va_list args) { + xmlNodePtr updated_node = pcmk__output_create_xml_node(out, "last_update"); + xmlNodePtr changed_node = pcmk__output_create_xml_node(out, "last_change"); + const char *last_written = va_arg(args, const char *); const char *user = va_arg(args, const char *); const char *client = va_arg(args, const char *); const char *origin = va_arg(args, const char *); - pcmk__output_create_xml_node(out, "last_update", - "time", pcmk__epoch2str(NULL), - NULL); - pcmk__output_create_xml_node(out, "last_change", - "time", last_written ? last_written : "", - "user", user ? user : "", - "client", client ? client : "", - "origin", origin ? origin : "", - NULL); + xmlSetProp(updated_node, (pcmkXmlStr) "time", + (pcmkXmlStr) pcmk__epoch2str(NULL)); + xmlSetProp(changed_node, (pcmkXmlStr) "time", (pcmkXmlStr) (last_written ? last_written : "")); + xmlSetProp(changed_node, (pcmkXmlStr) "user", (pcmkXmlStr) (user ? user : "")); + xmlSetProp(changed_node, (pcmkXmlStr) "client", (pcmkXmlStr) (client ? client : "")); + xmlSetProp(changed_node, (pcmkXmlStr) "origin", (pcmkXmlStr) (origin ? origin : "")); return pcmk_rc_ok; } @@ -953,7 +952,6 @@ PCMK__OUTPUT_ARGS("failed-action", "xmlNodePtr") int pe__failed_action_text(pcmk__output_t *out, va_list args) { xmlNodePtr xml_op = va_arg(args, xmlNodePtr); - char *s = failed_action_string(xml_op); out->list_item(out, NULL, "%s", s); @@ -962,8 +960,8 @@ pe__failed_action_text(pcmk__output_t *out, va_list args) { } PCMK__OUTPUT_ARGS("failed-action", "xmlNodePtr") -static int -failed_action_xml(pcmk__output_t *out, va_list args) { +int +pe__failed_action_xml(pcmk__output_t *out, va_list args) { xmlNodePtr xml_op = va_arg(args, xmlNodePtr); const char *op_key = crm_element_value(xml_op, XML_LRM_ATTR_TASK_KEY); @@ -974,15 +972,20 @@ failed_action_xml(pcmk__output_t *out, va_list args) { char *rc_s = crm_itoa(rc); char *reason_s = crm_xml_escape(exit_reason ? exit_reason : "none"); - xmlNodePtr node = pcmk__output_create_xml_node(out, "failure", - op_key ? "op_key" : "id", op_key ? op_key : ID(xml_op), - "node", crm_element_value(xml_op, XML_ATTR_UNAME), - "exitstatus", services_ocf_exitcode_str(rc), - "exitreason", reason_s, - "exitcode", rc_s, - "call", crm_element_value(xml_op, XML_LRM_ATTR_CALLID), - "status", services_lrm_status_str(status), - NULL); + xmlNodePtr node = pcmk__output_create_xml_node(out, "failure"); + + xmlSetProp(node, (pcmkXmlStr) (op_key ? "op_key" : "id"), + (pcmkXmlStr) (op_key ? op_key : "id")); + xmlSetProp(node, (pcmkXmlStr) "node", + (pcmkXmlStr) crm_element_value(xml_op, XML_ATTR_UNAME)); + xmlSetProp(node, (pcmkXmlStr) "exitstatus", + (pcmkXmlStr) services_ocf_exitcode_str(rc)); + xmlSetProp(node, (pcmkXmlStr) "exitreason", (pcmkXmlStr) reason_s); + xmlSetProp(node, (pcmkXmlStr) "exitcode", (pcmkXmlStr) rc_s); + xmlSetProp(node, (pcmkXmlStr) "call", + (pcmkXmlStr) crm_element_value(xml_op, XML_LRM_ATTR_CALLID)); + xmlSetProp(node, (pcmkXmlStr) "status", + (pcmkXmlStr) services_lrm_status_str(status)); if (last) { guint interval_ms = 0; @@ -997,12 +1000,14 @@ failed_action_xml(pcmk__output_t *out, va_list args) { crm_time_set_timet(crm_when, &when); rc_change = crm_time_as_string(crm_when, crm_time_log_date | crm_time_log_timeofday | crm_time_log_with_timezone); - pcmk__xe_set_props(node, XML_RSC_OP_LAST_CHANGE, rc_change, - "queued", crm_element_value(xml_op, XML_RSC_OP_T_QUEUE), - "exec", crm_element_value(xml_op, XML_RSC_OP_T_EXEC), - "interval", s, - "task", crm_element_value(xml_op, XML_LRM_ATTR_TASK), - NULL); + xmlSetProp(node, (pcmkXmlStr) XML_RSC_OP_LAST_CHANGE, (pcmkXmlStr) rc_change); + xmlSetProp(node, (pcmkXmlStr) "queued", + (pcmkXmlStr) crm_element_value(xml_op, XML_RSC_OP_T_QUEUE)); + xmlSetProp(node, (pcmkXmlStr) "exec", + (pcmkXmlStr) crm_element_value(xml_op, XML_RSC_OP_T_EXEC)); + xmlSetProp(node, (pcmkXmlStr) "interval", (pcmkXmlStr) s); + xmlSetProp(node, (pcmkXmlStr) "task", + (pcmkXmlStr) crm_element_value(xml_op, XML_LRM_ATTR_TASK)); free(s); free(rc_change); @@ -1015,7 +1020,7 @@ failed_action_xml(pcmk__output_t *out, va_list args) { } PCMK__OUTPUT_ARGS("node", "pe_node_t *", "unsigned int", "gboolean", "const char *", - "gboolean", "gboolean", "gboolean", "GList *", "GList *") + "gboolean", "gboolean", "gboolean", "GListPtr", "GListPtr") int pe__node_html(pcmk__output_t *out, va_list args) { pe_node_t *node = va_arg(args, pe_node_t *); @@ -1025,14 +1030,14 @@ pe__node_html(pcmk__output_t *out, va_list args) { gboolean print_clone_detail = va_arg(args, gboolean); gboolean print_brief = va_arg(args, gboolean); gboolean group_by_node = va_arg(args, gboolean); - GList *only_node = va_arg(args, GList *); - GList *only_rsc = va_arg(args, GList *); + GListPtr only_node = va_arg(args, GListPtr); + GListPtr only_rsc = va_arg(args, GListPtr); char *node_name = pe__node_display_name(node, print_clone_detail); char *buf = crm_strdup_printf("Node: %s", node_name); if (full) { - xmlNodePtr item_node = pcmk__output_create_xml_node(out, "li", NULL); + xmlNodePtr item_node = pcmk__output_create_xml_node(out, "li"); pcmk_create_html_node(item_node, "span", NULL, NULL, buf); @@ -1054,7 +1059,7 @@ pe__node_html(pcmk__output_t *out, va_list args) { pcmk_create_html_node(item_node, "span", NULL, "offline", " OFFLINE"); } if (print_brief && group_by_node) { - GList *rscs = pe__filter_rsc_list(node->details->running_rsc, only_rsc); + GListPtr rscs = pe__filter_rsc_list(node->details->running_rsc, only_rsc); if (rscs != NULL) { out->begin_list(out, NULL, NULL, NULL); @@ -1063,7 +1068,7 @@ pe__node_html(pcmk__output_t *out, va_list args) { } } else if (group_by_node) { - GList *lpc2 = NULL; + GListPtr lpc2 = NULL; out->begin_list(out, NULL, NULL, NULL); for (lpc2 = node->details->running_rsc; lpc2 != NULL; lpc2 = lpc2->next) { @@ -1083,7 +1088,7 @@ pe__node_html(pcmk__output_t *out, va_list args) { } PCMK__OUTPUT_ARGS("node", "pe_node_t *", "unsigned int", "gboolean", "const char *", - "gboolean", "gboolean", "gboolean", "GList *", "GList *") + "gboolean", "gboolean", "gboolean", "GListPtr", "GListPtr") int pe__node_text(pcmk__output_t *out, va_list args) { pe_node_t *node = va_arg(args, pe_node_t *); @@ -1093,8 +1098,8 @@ pe__node_text(pcmk__output_t *out, va_list args) { gboolean print_clone_detail = va_arg(args, gboolean); gboolean print_brief = va_arg(args, gboolean); gboolean group_by_node = va_arg(args, gboolean); - GList *only_node = va_arg(args, GList *); - GList *only_rsc = va_arg(args, GList *); + GListPtr only_node = va_arg(args, GListPtr); + GListPtr only_rsc = va_arg(args, GListPtr); if (full) { char *node_name = pe__node_display_name(node, print_clone_detail); @@ -1112,7 +1117,7 @@ pe__node_text(pcmk__output_t *out, va_list args) { /* If we're grouping by node, print its resources */ if (group_by_node) { if (print_brief) { - GList *rscs = pe__filter_rsc_list(node->details->running_rsc, only_rsc); + GListPtr rscs = pe__filter_rsc_list(node->details->running_rsc, only_rsc); if (rscs != NULL) { out->begin_list(out, NULL, NULL, "%s", buf); @@ -1125,7 +1130,7 @@ pe__node_text(pcmk__output_t *out, va_list args) { } } else { - GList *gIter2 = NULL; + GListPtr gIter2 = NULL; out->begin_list(out, NULL, NULL, "%s", buf); out->begin_list(out, NULL, NULL, "Resources"); @@ -1153,7 +1158,7 @@ pe__node_text(pcmk__output_t *out, va_list args) { } PCMK__OUTPUT_ARGS("node", "pe_node_t *", "unsigned int", "gboolean", "const char *", - "gboolean", "gboolean", "gboolean", "GList *", "GList *") + "gboolean", "gboolean", "gboolean", "GListPtr", "GListPtr") int pe__node_xml(pcmk__output_t *out, va_list args) { pe_node_t *node = va_arg(args, pe_node_t *); @@ -1163,8 +1168,8 @@ pe__node_xml(pcmk__output_t *out, va_list args) { gboolean print_clone_detail G_GNUC_UNUSED = va_arg(args, gboolean); gboolean print_brief G_GNUC_UNUSED = va_arg(args, gboolean); gboolean group_by_node = va_arg(args, gboolean); - GList *only_node = va_arg(args, GList *); - GList *only_rsc = va_arg(args, GList *); + GListPtr only_node = va_arg(args, GListPtr); + GListPtr only_rsc = va_arg(args, GListPtr); if (full) { const char *node_type = "unknown"; @@ -1198,11 +1203,12 @@ pe__node_xml(pcmk__output_t *out, va_list args) { if (pe__is_guest_node(node)) { xmlNodePtr xml_node = pcmk__output_xml_peek_parent(out); - crm_xml_add(xml_node, "id_as_resource", node->details->remote_rsc->container->id); + xmlSetProp(xml_node, (pcmkXmlStr) "id_as_resource", + (pcmkXmlStr) node->details->remote_rsc->container->id); } if (group_by_node) { - GList *lpc = NULL; + GListPtr lpc = NULL; for (lpc = node->details->running_rsc; lpc != NULL; lpc = lpc->next) { pe_resource_t *rsc = (pe_resource_t *) lpc->data; @@ -1215,9 +1221,8 @@ pe__node_xml(pcmk__output_t *out, va_list args) { out->end_list(out); } else { - pcmk__output_xml_create_parent(out, "node", - "name", node->details->uname, - NULL); + xmlNodePtr parent = pcmk__output_xml_create_parent(out, "node"); + xmlSetProp(parent, (pcmkXmlStr) "name", (pcmkXmlStr) node->details->uname); } return pcmk_rc_ok; @@ -1231,6 +1236,7 @@ pe__node_attribute_text(pcmk__output_t *out, va_list args) { gboolean add_extra = va_arg(args, gboolean); int expected_score = va_arg(args, int); + if (add_extra) { int v = crm_parse_int(value, "0"); @@ -1249,8 +1255,8 @@ pe__node_attribute_text(pcmk__output_t *out, va_list args) { } PCMK__OUTPUT_ARGS("node-attribute", "const char *", "const char *", "gboolean", "int") -static int -node_attribute_html(pcmk__output_t *out, va_list args) { +int +pe__node_attribute_html(pcmk__output_t *out, va_list args) { const char *name = va_arg(args, const char *); const char *value = va_arg(args, const char *); gboolean add_extra = va_arg(args, gboolean); @@ -1259,7 +1265,7 @@ node_attribute_html(pcmk__output_t *out, va_list args) { if (add_extra) { int v = crm_parse_int(value, "0"); char *s = crm_strdup_printf("%s: %s", name, value); - xmlNodePtr item_node = pcmk__output_create_xml_node(out, "li", NULL); + xmlNodePtr item_node = pcmk__output_create_xml_node(out, "li"); pcmk_create_html_node(item_node, "span", NULL, NULL, s); free(s); @@ -1278,136 +1284,33 @@ node_attribute_html(pcmk__output_t *out, va_list args) { return pcmk_rc_ok; } -PCMK__OUTPUT_ARGS("node-and-op", "pe_working_set_t *", "xmlNodePtr") -static int -node_and_op(pcmk__output_t *out, va_list args) { - pe_working_set_t *data_set = va_arg(args, pe_working_set_t *); - xmlNodePtr xml_op = va_arg(args, xmlNodePtr); - - pe_resource_t *rsc = NULL; - gchar *node_str = NULL; - char *last_change_str = NULL; - - const char *op_rsc = crm_element_value(xml_op, "resource"); - const char *status_s = crm_element_value(xml_op, XML_LRM_ATTR_OPSTATUS); - const char *op_key = crm_element_value(xml_op, XML_LRM_ATTR_TASK_KEY); - int status = crm_parse_int(status_s, "0"); - time_t last_change = 0; - - rsc = pe_find_resource(data_set->resources, op_rsc); - - if (rsc) { - pe_node_t *node = pe__current_node(rsc); - const char *target_role = g_hash_table_lookup(rsc->meta, XML_RSC_ATTR_TARGET_ROLE); - int opts = pe_print_rsconly | pe_print_pending; - - if (node == NULL) { - node = rsc->pending_node; - } - - node_str = pcmk__native_output_string(rsc, rsc_printable_id(rsc), node, - opts, target_role, false); - } else { - node_str = crm_strdup_printf("Unknown resource %s", op_rsc); - } - - if (crm_element_value_epoch(xml_op, XML_RSC_OP_LAST_CHANGE, - &last_change) == pcmk_ok) { - last_change_str = crm_strdup_printf(", %s=%s, exec=%sms", - XML_RSC_OP_LAST_CHANGE, - crm_strip_trailing_newline(ctime(&last_change)), - crm_element_value(xml_op, XML_RSC_OP_T_EXEC)); - } - - out->list_item(out, NULL, "%s: %s (node=%s, call=%s, rc=%s%s): %s", - node_str, op_key ? op_key : ID(xml_op), - crm_element_value(xml_op, XML_ATTR_UNAME), - crm_element_value(xml_op, XML_LRM_ATTR_CALLID), - crm_element_value(xml_op, XML_LRM_ATTR_RC), - last_change_str ? last_change_str : "", - services_lrm_status_str(status)); - - g_free(node_str); - free(last_change_str); - return pcmk_rc_ok; -} - -PCMK__OUTPUT_ARGS("node-and-op", "pe_working_set_t *", "xmlNodePtr") -static int -node_and_op_xml(pcmk__output_t *out, va_list args) { - pe_working_set_t *data_set = va_arg(args, pe_working_set_t *); - xmlNodePtr xml_op = va_arg(args, xmlNodePtr); - - pe_resource_t *rsc = NULL; - const char *op_rsc = crm_element_value(xml_op, "resource"); - const char *status_s = crm_element_value(xml_op, XML_LRM_ATTR_OPSTATUS); - const char *op_key = crm_element_value(xml_op, XML_LRM_ATTR_TASK_KEY); - int status = crm_parse_int(status_s, "0"); - time_t last_change = 0; - - xmlNode *node = pcmk__output_create_xml_node(out, "operation", - "op", op_key ? op_key : ID(xml_op), - "node", crm_element_value(xml_op, XML_ATTR_UNAME), - "call", crm_element_value(xml_op, XML_LRM_ATTR_CALLID), - "rc", crm_element_value(xml_op, XML_LRM_ATTR_RC), - "status", services_lrm_status_str(status), - NULL); - - rsc = pe_find_resource(data_set->resources, op_rsc); - - if (rsc) { - const char *class = crm_element_value(rsc->xml, XML_AGENT_ATTR_CLASS); - const char *kind = crm_element_value(rsc->xml, XML_ATTR_TYPE); - char *agent_tuple = NULL; - - agent_tuple = crm_strdup_printf("%s:%s:%s", class, - pcmk_is_set(pcmk_get_ra_caps(class), pcmk_ra_cap_provider) ? crm_element_value(rsc->xml, XML_AGENT_ATTR_PROVIDER) : "", - kind); - - pcmk__xe_set_props(node, "rsc", rsc_printable_id(rsc), - "agent", agent_tuple, - NULL); - free(agent_tuple); - } - - if (crm_element_value_epoch(xml_op, XML_RSC_OP_LAST_CHANGE, - &last_change) == pcmk_ok) { - pcmk__xe_set_props(node, XML_RSC_OP_LAST_CHANGE, crm_strip_trailing_newline(ctime(&last_change)), - XML_RSC_OP_T_EXEC, crm_element_value(xml_op, XML_RSC_OP_T_EXEC), - NULL); - } - - return pcmk_rc_ok; -} - PCMK__OUTPUT_ARGS("node-attribute", "const char *", "const char *", "gboolean", "int") -static int -node_attribute_xml(pcmk__output_t *out, va_list args) { +int +pe__node_attribute_xml(pcmk__output_t *out, va_list args) { const char *name = va_arg(args, const char *); const char *value = va_arg(args, const char *); gboolean add_extra = va_arg(args, gboolean); int expected_score = va_arg(args, int); - xmlNodePtr node = pcmk__output_create_xml_node(out, "attribute", - "name", name, - "value", value, - NULL); + xmlNodePtr node = pcmk__output_create_xml_node(out, "attribute"); + xmlSetProp(node, (pcmkXmlStr) "name", (pcmkXmlStr) name); + xmlSetProp(node, (pcmkXmlStr) "value", (pcmkXmlStr) value); if (add_extra) { char *buf = crm_itoa(expected_score); - crm_xml_add(node, "expected", buf); + xmlSetProp(node, (pcmkXmlStr) "expected", (pcmkXmlStr) buf); free(buf); } return pcmk_rc_ok; } -PCMK__OUTPUT_ARGS("node-list", "GList *", "GList *", "GList *", "unsigned int", "gboolean", "gboolean", "gboolean") -static int -node_list_html(pcmk__output_t *out, va_list args) { - GList *nodes = va_arg(args, GList *); - GList *only_node = va_arg(args, GList *); - GList *only_rsc = va_arg(args, GList *); +PCMK__OUTPUT_ARGS("node-list", "GListPtr", "GListPtr", "GListPtr", "unsigned int", "gboolean", "gboolean", "gboolean") +int +pe__node_list_html(pcmk__output_t *out, va_list args) { + GListPtr nodes = va_arg(args, GListPtr); + GListPtr only_node = va_arg(args, GListPtr); + GListPtr only_rsc = va_arg(args, GListPtr); unsigned int print_opts = va_arg(args, unsigned int); gboolean print_clone_detail = va_arg(args, gboolean); gboolean print_brief = va_arg(args, gboolean); @@ -1415,7 +1318,7 @@ node_list_html(pcmk__output_t *out, va_list args) { int rc = pcmk_rc_no_output; - for (GList *gIter = nodes; gIter != NULL; gIter = gIter->next) { + for (GListPtr gIter = nodes; gIter != NULL; gIter = gIter->next) { pe_node_t *node = (pe_node_t *) gIter->data; if (!pcmk__str_in_list(only_node, node->details->uname)) { @@ -1432,12 +1335,12 @@ node_list_html(pcmk__output_t *out, va_list args) { return rc; } -PCMK__OUTPUT_ARGS("node-list", "GList *", "GList *", "GList *", "unsigned int", "gboolean", "gboolean", "gboolean") +PCMK__OUTPUT_ARGS("node-list", "GListPtr", "GListPtr", "GListPtr", "unsigned int", "gboolean", "gboolean", "gboolean") int pe__node_list_text(pcmk__output_t *out, va_list args) { - GList *nodes = va_arg(args, GList *); - GList *only_node = va_arg(args, GList *); - GList *only_rsc = va_arg(args, GList *); + GListPtr nodes = va_arg(args, GListPtr); + GListPtr only_node = va_arg(args, GListPtr); + GListPtr only_rsc = va_arg(args, GListPtr); unsigned int print_opts = va_arg(args, unsigned int); gboolean print_clone_detail = va_arg(args, gboolean); gboolean print_brief = va_arg(args, gboolean); @@ -1458,7 +1361,7 @@ pe__node_list_text(pcmk__output_t *out, va_list args) { int rc = pcmk_rc_no_output; - for (GList *gIter = nodes; gIter != NULL; gIter = gIter->next) { + for (GListPtr gIter = nodes; gIter != NULL; gIter = gIter->next) { pe_node_t *node = (pe_node_t *) gIter->data; const char *node_mode = NULL; char *node_name = pe__node_display_name(node, print_clone_detail); @@ -1571,19 +1474,19 @@ pe__node_list_text(pcmk__output_t *out, va_list args) { return rc; } -PCMK__OUTPUT_ARGS("node-list", "GList *", "GList *", "GList *", "unsigned int", "gboolean", "gboolean", "gboolean") -static int -node_list_xml(pcmk__output_t *out, va_list args) { - GList *nodes = va_arg(args, GList *); - GList *only_node = va_arg(args, GList *); - GList *only_rsc = va_arg(args, GList *); +PCMK__OUTPUT_ARGS("node-list", "GListPtr", "GListPtr", "GListPtr", "unsigned int", "gboolean", "gboolean", "gboolean") +int +pe__node_list_xml(pcmk__output_t *out, va_list args) { + GListPtr nodes = va_arg(args, GListPtr); + GListPtr only_node = va_arg(args, GListPtr); + GListPtr only_rsc = va_arg(args, GListPtr); unsigned int print_opts = va_arg(args, unsigned int); gboolean print_clone_detail = va_arg(args, gboolean); gboolean print_brief = va_arg(args, gboolean); gboolean group_by_node = va_arg(args, gboolean); out->begin_list(out, NULL, NULL, "nodes"); - for (GList *gIter = nodes; gIter != NULL; gIter = gIter->next) { + for (GListPtr gIter = nodes; gIter != NULL; gIter = gIter->next) { pe_node_t *node = (pe_node_t *) gIter->data; if (!pcmk__str_in_list(only_node, node->details->uname)) { @@ -1598,10 +1501,10 @@ node_list_xml(pcmk__output_t *out, va_list args) { return pcmk_rc_ok; } -PCMK__OUTPUT_ARGS("op-history", "xmlNodePtr", "const char *", "const char *", "int", "gboolean") +PCMK__OUTPUT_ARGS("op-history", "struct xmlNode *", "const char *", "const char *", "int", "gboolean") int pe__op_history_text(pcmk__output_t *out, va_list args) { - xmlNodePtr xml_op = va_arg(args, xmlNodePtr); + xmlNode *xml_op = va_arg(args, xmlNode *); const char *task = va_arg(args, const char *); const char *interval_ms_s = va_arg(args, const char *); int rc = va_arg(args, int); @@ -1615,27 +1518,26 @@ pe__op_history_text(pcmk__output_t *out, va_list args) { return pcmk_rc_ok; } -PCMK__OUTPUT_ARGS("op-history", "xmlNodePtr", "const char *", "const char *", "int", "gboolean") -static int -op_history_xml(pcmk__output_t *out, va_list args) { - xmlNodePtr xml_op = va_arg(args, xmlNodePtr); +PCMK__OUTPUT_ARGS("op-history", "struct xmlNode *", "const char *", "const char *", "int", "gboolean") +int +pe__op_history_xml(pcmk__output_t *out, va_list args) { + xmlNode *xml_op = va_arg(args, xmlNode *); const char *task = va_arg(args, const char *); const char *interval_ms_s = va_arg(args, const char *); int rc = va_arg(args, int); gboolean print_timing = va_arg(args, gboolean); - char *rc_s = crm_itoa(rc); - xmlNodePtr node = pcmk__output_create_xml_node(out, "operation_history", - "call", crm_element_value(xml_op, XML_LRM_ATTR_CALLID), - "task", task, - "rc", rc_s, - "rc_text", services_ocf_exitcode_str(rc), - NULL); - free(rc_s); + char *rc_s = NULL; + + xmlNodePtr node = pcmk__output_create_xml_node(out, "operation_history"); + + xmlSetProp(node, (pcmkXmlStr) "call", + (pcmkXmlStr) crm_element_value(xml_op, XML_LRM_ATTR_CALLID)); + xmlSetProp(node, (pcmkXmlStr) "task", (pcmkXmlStr) task); if (interval_ms_s && !pcmk__str_eq(interval_ms_s, "0", pcmk__str_casei)) { char *s = crm_strdup_printf("%sms", interval_ms_s); - crm_xml_add(node, "interval", s); + xmlSetProp(node, (pcmkXmlStr) "interval", (pcmkXmlStr) s); free(s); } @@ -1646,7 +1548,8 @@ op_history_xml(pcmk__output_t *out, va_list args) { if (value) { time_t int_value = (time_t) crm_parse_int(value, NULL); if (int_value > 0) { - crm_xml_add(node, XML_RSC_OP_LAST_CHANGE, pcmk__epoch2str(&int_value)); + xmlSetProp(node, (pcmkXmlStr) XML_RSC_OP_LAST_CHANGE, + (pcmkXmlStr) pcmk__epoch2str(&int_value)); } } @@ -1654,45 +1557,29 @@ op_history_xml(pcmk__output_t *out, va_list args) { if (value) { time_t int_value = (time_t) crm_parse_int(value, NULL); if (int_value > 0) { - crm_xml_add(node, XML_RSC_OP_LAST_RUN, pcmk__epoch2str(&int_value)); + xmlSetProp(node, (pcmkXmlStr) XML_RSC_OP_LAST_RUN, + (pcmkXmlStr) pcmk__epoch2str(&int_value)); } } value = crm_element_value(xml_op, XML_RSC_OP_T_EXEC); if (value) { char *s = crm_strdup_printf("%sms", value); - crm_xml_add(node, XML_RSC_OP_T_EXEC, s); + xmlSetProp(node, (pcmkXmlStr) XML_RSC_OP_T_EXEC, (pcmkXmlStr) s); free(s); } value = crm_element_value(xml_op, XML_RSC_OP_T_QUEUE); if (value) { char *s = crm_strdup_printf("%sms", value); - crm_xml_add(node, XML_RSC_OP_T_QUEUE, s); + xmlSetProp(node, (pcmkXmlStr) XML_RSC_OP_T_QUEUE, (pcmkXmlStr) s); free(s); } } - return pcmk_rc_ok; -} - -PCMK__OUTPUT_ARGS("resource-config", "pe_resource_t *", "gboolean") -static int -resource_config(pcmk__output_t *out, va_list args) { - pe_resource_t *rsc = va_arg(args, pe_resource_t *); - gboolean raw = va_arg(args, gboolean); - - char *rsc_xml = NULL; - - if (raw) { - rsc_xml = dump_xml_formatted(rsc->orig_xml ? rsc->orig_xml : rsc->xml); - } else { - rsc_xml = dump_xml_formatted(rsc->xml); - } - - out->info(out, "Resource XML:"); - out->output_xml(out, "xml", rsc_xml); - - free(rsc_xml); + rc_s = crm_itoa(rc); + xmlSetProp(node, (pcmkXmlStr) "rc", (pcmkXmlStr) rc_s); + xmlSetProp(node, (pcmkXmlStr) "rc_text", (pcmkXmlStr) services_ocf_exitcode_str(rc)); + free(rc_s); return pcmk_rc_ok; } @@ -1719,8 +1606,8 @@ pe__resource_history_text(pcmk__output_t *out, va_list args) { } PCMK__OUTPUT_ARGS("resource-history", "pe_resource_t *", "const char *", "gboolean", "int", "time_t", "gboolean") -static int -resource_history_xml(pcmk__output_t *out, va_list args) { +int +pe__resource_history_xml(pcmk__output_t *out, va_list args) { pe_resource_t *rsc = va_arg(args, pe_resource_t *); const char *rsc_id = va_arg(args, const char *); gboolean all = va_arg(args, gboolean); @@ -1728,29 +1615,30 @@ resource_history_xml(pcmk__output_t *out, va_list args) { time_t last_failure = va_arg(args, int); gboolean as_header = va_arg(args, gboolean); - xmlNodePtr node = pcmk__output_xml_create_parent(out, "resource_history", - "id", rsc_id, - NULL); + xmlNodePtr node = pcmk__output_xml_create_parent(out, "resource_history"); + xmlSetProp(node, (pcmkXmlStr) "id", (pcmkXmlStr) rsc_id); if (rsc == NULL) { - crm_xml_add(node, "orphan", "true"); + xmlSetProp(node, (pcmkXmlStr) "orphan", (pcmkXmlStr) "true"); } else if (all || failcount || last_failure > 0) { char *migration_s = crm_itoa(rsc->migration_threshold); - pcmk__xe_set_props(node, "orphan", "false", - "migration-threshold", migration_s, - NULL); + xmlSetProp(node, (pcmkXmlStr) "orphan", (pcmkXmlStr) "false"); + xmlSetProp(node, (pcmkXmlStr) "migration-threshold", + (pcmkXmlStr) migration_s); free(migration_s); if (failcount > 0) { char *s = crm_itoa(failcount); - crm_xml_add(node, PCMK__FAIL_COUNT_PREFIX, s); + xmlSetProp(node, (pcmkXmlStr) PCMK__FAIL_COUNT_PREFIX, + (pcmkXmlStr) s); free(s); } if (last_failure > 0) { - crm_xml_add(node, PCMK__LAST_FAILURE_PREFIX, pcmk__epoch2str(&last_failure)); + xmlSetProp(node, (pcmkXmlStr) PCMK__LAST_FAILURE_PREFIX, + (pcmkXmlStr) pcmk__epoch2str(&last_failure)); } } @@ -1761,25 +1649,10 @@ resource_history_xml(pcmk__output_t *out, va_list args) { return pcmk_rc_ok; } -static void -print_resource_header(pcmk__output_t *out, gboolean group_by_node, - gboolean inactive_resources) -{ - if (group_by_node) { - /* Active resources have already been printed by node */ - out->begin_list(out, NULL, NULL, "Inactive Resources"); - } else if (inactive_resources) { - out->begin_list(out, NULL, NULL, "Full List of Resources"); - } else { - out->begin_list(out, NULL, NULL, "Active Resources"); - } -} - - PCMK__OUTPUT_ARGS("resource-list", "pe_working_set_t *", "unsigned int", "gboolean", - "gboolean", "gboolean", "gboolean", "GList *", "GList *", "gboolean") -static int -resource_list(pcmk__output_t *out, va_list args) + "gboolean", "gboolean", "gboolean", "GListPtr", "GListPtr", "gboolean") +int +pe__resource_list(pcmk__output_t *out, va_list args) { pe_working_set_t *data_set = va_arg(args, pe_working_set_t *); unsigned int print_opts = va_arg(args, unsigned int); @@ -1787,13 +1660,12 @@ resource_list(pcmk__output_t *out, va_list args) gboolean inactive_resources = va_arg(args, gboolean); gboolean brief_output = va_arg(args, gboolean); gboolean print_summary = va_arg(args, gboolean); - GList *only_node = va_arg(args, GList *); - GList *only_rsc = va_arg(args, GList *); + GListPtr only_node = va_arg(args, GListPtr); + GListPtr only_rsc = va_arg(args, GListPtr); gboolean print_spacer = va_arg(args, gboolean); - GList *rsc_iter; + GListPtr rsc_iter; int rc = pcmk_rc_no_output; - bool printed_header = false; /* If we already showed active resources by node, and * we're not showing inactive resources, we have nothing to do @@ -1802,14 +1674,21 @@ resource_list(pcmk__output_t *out, va_list args) return rc; } + PCMK__OUTPUT_SPACER_IF(out, print_spacer); + + if (group_by_node) { + /* Active resources have already been printed by node */ + out->begin_list(out, NULL, NULL, "Inactive Resources"); + } else if (inactive_resources) { + out->begin_list(out, NULL, NULL, "Full List of Resources"); + } else { + out->begin_list(out, NULL, NULL, "Active Resources"); + } + /* If we haven't already printed resources grouped by node, * and brief output was requested, print resource summary */ if (brief_output && !group_by_node) { - GList *rscs = pe__filter_rsc_list(data_set->resources, only_rsc); - - PCMK__OUTPUT_SPACER_IF(out, print_spacer); - print_resource_header(out, group_by_node, inactive_resources); - printed_header = true; + GListPtr rscs = pe__filter_rsc_list(data_set->resources, only_rsc); pe__rscs_brief_output(out, rscs, print_opts, inactive_resources); g_list_free(rscs); @@ -1848,12 +1727,6 @@ resource_list(pcmk__output_t *out, va_list args) continue; } - if (!printed_header) { - PCMK__OUTPUT_SPACER_IF(out, print_spacer); - print_resource_header(out, group_by_node, inactive_resources); - printed_header = true; - } - /* Print this resource */ x = out->message(out, crm_map_element_name(rsc->xml), print_opts, rsc, only_node, only_rsc); @@ -1863,12 +1736,6 @@ resource_list(pcmk__output_t *out, va_list args) } if (print_summary && rc != pcmk_rc_ok) { - if (!printed_header) { - PCMK__OUTPUT_SPACER_IF(out, print_spacer); - print_resource_header(out, group_by_node, inactive_resources); - printed_header = true; - } - if (group_by_node) { out->list_item(out, NULL, "No inactive resources"); } else if (inactive_resources) { @@ -1878,16 +1745,13 @@ resource_list(pcmk__output_t *out, va_list args) } } - if (printed_header) { - out->end_list(out); - } - + out->end_list(out); return rc; } PCMK__OUTPUT_ARGS("ticket", "pe_ticket_t *") -static int -ticket_html(pcmk__output_t *out, va_list args) { +int +pe__ticket_html(pcmk__output_t *out, va_list args) { pe_ticket_t *ticket = va_arg(args, pe_ticket_t *); if (ticket->last_granted > -1) { @@ -1913,13 +1777,13 @@ pe__ticket_text(pcmk__output_t *out, va_list args) { if (ticket->last_granted > -1) { char *time = pcmk_format_named_time("last-granted", ticket->last_granted); - out->list_item(out, ticket->id, "%s%s %s", + out->list_item(out, ticket->id, "\t%s%s %s", ticket->granted ? "granted" : "revoked", ticket->standby ? " [standby]" : "", time); free(time); } else { - out->list_item(out, ticket->id, "%s%s", + out->list_item(out, ticket->id, "\t%s%s", ticket->granted ? "granted" : "revoked", ticket->standby ? " [standby]" : ""); } @@ -1928,30 +1792,31 @@ pe__ticket_text(pcmk__output_t *out, va_list args) { } PCMK__OUTPUT_ARGS("ticket", "pe_ticket_t *") -static int -ticket_xml(pcmk__output_t *out, va_list args) { - pe_ticket_t *ticket = va_arg(args, pe_ticket_t *); - +int +pe__ticket_xml(pcmk__output_t *out, va_list args) { xmlNodePtr node = NULL; - node = pcmk__output_create_xml_node(out, "ticket", - "id", ticket->id, - "status", ticket->granted ? "granted" : "revoked", - "standby", pcmk__btoa(ticket->standby), - NULL); + pe_ticket_t *ticket = va_arg(args, pe_ticket_t *); + + node = pcmk__output_create_xml_node(out, "ticket"); + xmlSetProp(node, (pcmkXmlStr) "id", (pcmkXmlStr) ticket->id); + xmlSetProp(node, (pcmkXmlStr) "status", (pcmkXmlStr) (ticket->granted ? "granted" : "revoked")); + xmlSetProp(node, (pcmkXmlStr) "standby", + (pcmkXmlStr) pcmk__btoa(ticket->standby)); if (ticket->last_granted > -1) { - crm_xml_add(node, "last-granted", pcmk__epoch2str(&ticket->last_granted)); + xmlSetProp(node, (pcmkXmlStr) "last-granted", + (pcmkXmlStr) pcmk__epoch2str(&ticket->last_granted)); } return pcmk_rc_ok; } static pcmk__message_entry_t fmt_functions[] = { - { "ban", "html", ban_html }, + { "ban", "html", pe__ban_html }, { "ban", "log", pe__ban_text }, { "ban", "text", pe__ban_text }, - { "ban", "xml", ban_xml }, + { "ban", "xml", pe__ban_xml }, { "bundle", "xml", pe__bundle_xml }, { "bundle", "html", pe__bundle_html }, { "bundle", "text", pe__bundle_text }, @@ -1960,30 +1825,32 @@ static pcmk__message_entry_t fmt_functions[] = { { "clone", "html", pe__clone_html }, { "clone", "text", pe__clone_text }, { "clone", "log", pe__clone_text }, - { "cluster-counts", "html", cluster_counts_html }, + { "cluster-counts", "html", pe__cluster_counts_html }, { "cluster-counts", "log", pe__cluster_counts_text }, { "cluster-counts", "text", pe__cluster_counts_text }, - { "cluster-counts", "xml", cluster_counts_xml }, - { "cluster-dc", "html", cluster_dc_html }, + { "cluster-counts", "xml", pe__cluster_counts_xml }, + { "cluster-dc", "html", pe__cluster_dc_html }, { "cluster-dc", "log", pe__cluster_dc_text }, { "cluster-dc", "text", pe__cluster_dc_text }, - { "cluster-dc", "xml", cluster_dc_xml }, - { "cluster-options", "html", cluster_options_html }, - { "cluster-options", "log", cluster_options_log }, + { "cluster-dc", "xml", pe__cluster_dc_xml }, + { "cluster-options", "html", pe__cluster_options_html }, + { "cluster-options", "log", pe__cluster_options_log }, { "cluster-options", "text", pe__cluster_options_text }, - { "cluster-options", "xml", cluster_options_xml }, + { "cluster-options", "xml", pe__cluster_options_xml }, { "cluster-summary", "default", pe__cluster_summary }, - { "cluster-summary", "html", cluster_summary_html }, - { "cluster-stack", "html", cluster_stack_html }, + { "cluster-summary", "html", pe__cluster_summary_html }, + { "cluster-stack", "html", pe__cluster_stack_html }, { "cluster-stack", "log", pe__cluster_stack_text }, { "cluster-stack", "text", pe__cluster_stack_text }, - { "cluster-stack", "xml", cluster_stack_xml }, - { "cluster-times", "html", cluster_times_html }, + { "cluster-stack", "xml", pe__cluster_stack_xml }, + { "cluster-times", "html", pe__cluster_times_html }, { "cluster-times", "log", pe__cluster_times_text }, { "cluster-times", "text", pe__cluster_times_text }, - { "cluster-times", "xml", cluster_times_xml }, - { "failed-action", "default", pe__failed_action_text }, - { "failed-action", "xml", failed_action_xml }, + { "cluster-times", "xml", pe__cluster_times_xml }, + { "failed-action", "html", pe__failed_action_text }, + { "failed-action", "log", pe__failed_action_text }, + { "failed-action", "text", pe__failed_action_text }, + { "failed-action", "xml", pe__failed_action_xml }, { "group", "xml", pe__group_xml }, { "group", "html", pe__group_html }, { "group", "text", pe__group_text }, @@ -1993,30 +1860,29 @@ static pcmk__message_entry_t fmt_functions[] = { { "node", "log", pe__node_text }, { "node", "text", pe__node_text }, { "node", "xml", pe__node_xml }, - { "node-and-op", "default", node_and_op }, - { "node-and-op", "xml", node_and_op_xml }, - { "node-list", "html", node_list_html }, + { "node-list", "html", pe__node_list_html }, { "node-list", "log", pe__node_list_text }, { "node-list", "text", pe__node_list_text }, - { "node-list", "xml", node_list_xml }, - { "node-attribute", "html", node_attribute_html }, + { "node-list", "xml", pe__node_list_xml }, + { "node-attribute", "html", pe__node_attribute_html }, { "node-attribute", "log", pe__node_attribute_text }, { "node-attribute", "text", pe__node_attribute_text }, - { "node-attribute", "xml", node_attribute_xml }, - { "op-history", "default", pe__op_history_text }, - { "op-history", "xml", op_history_xml }, + { "node-attribute", "xml", pe__node_attribute_xml }, + { "op-history", "html", pe__op_history_text }, + { "op-history", "log", pe__op_history_text }, + { "op-history", "text", pe__op_history_text }, + { "op-history", "xml", pe__op_history_xml }, { "primitive", "xml", pe__resource_xml }, { "primitive", "html", pe__resource_html }, { "primitive", "text", pe__resource_text }, { "primitive", "log", pe__resource_text }, - { "resource-config", "default", resource_config }, { "resource-history", "default", pe__resource_history_text }, - { "resource-history", "xml", resource_history_xml }, - { "resource-list", "default", resource_list }, - { "ticket", "html", ticket_html }, + { "resource-history", "xml", pe__resource_history_xml }, + { "resource-list", "default", pe__resource_list }, + { "ticket", "html", pe__ticket_html }, { "ticket", "log", pe__ticket_text }, { "ticket", "text", pe__ticket_text }, - { "ticket", "xml", ticket_xml }, + { "ticket", "xml", pe__ticket_xml }, { NULL, NULL, NULL } }; diff --git a/lib/pengine/pe_status_private.h b/lib/pengine/pe_status_private.h index 360f280..0f3814f 100644 --- a/lib/pengine/pe_status_private.h +++ b/lib/pengine/pe_status_private.h @@ -65,10 +65,4 @@ gboolean unpack_tags(xmlNode *xml_tags, pe_working_set_t *data_set); G_GNUC_INTERNAL gboolean unpack_status(xmlNode *status, pe_working_set_t *data_set); -G_GNUC_INTERNAL -op_digest_cache_t *pe__compare_fencing_digest(pe_resource_t *rsc, - const char *agent, - pe_node_t *node, - pe_working_set_t *data_set); - #endif // PE_STATUS_PRIVATE__H diff --git a/lib/pengine/rules.c b/lib/pengine/rules.c index d69f449..28562aa 100644 --- a/lib/pengine/rules.c +++ b/lib/pengine/rules.c @@ -1,5 +1,5 @@ /* - * Copyright 2004-2021 the Pacemaker project contributors + * Copyright 2004-2020 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -140,6 +140,37 @@ find_expression_type(xmlNode * expr) return attr_expr; } +gboolean +pe_test_role_expression(xmlNode *expr, enum rsc_role_e role, crm_time_t *now) +{ + pe_rule_eval_data_t rule_data = { + .node_hash = NULL, + .role = role, + .now = now, + .match_data = NULL, + .rsc_data = NULL, + .op_data = NULL + }; + + return pe__eval_role_expr(expr, &rule_data); +} + +gboolean +pe_test_attr_expression(xmlNode *expr, GHashTable *hash, crm_time_t *now, + pe_match_data_t *match_data) +{ + pe_rule_eval_data_t rule_data = { + .node_hash = hash, + .role = RSC_ROLE_UNKNOWN, + .now = now, + .match_data = match_data, + .rsc_data = NULL, + .op_data = NULL + }; + + return pe__eval_attr_expr(expr, &rule_data); +} + /* As per the nethack rules: * * moon period = 29.53058 days ~= 30, year = 365.2422 days @@ -300,6 +331,38 @@ pe_parse_xml_duration(crm_time_t * start, xmlNode * duration_spec) return end; } +/*! + * \internal + * \brief Test a date expression (pass/fail) for a specific time + * + * \param[in] time_expr date_expression XML + * \param[in] now Time for which to evaluate expression + * \param[out] next_change If not NULL, set to when evaluation will change + * + * \return TRUE if date expression is in effect at given time, FALSE otherwise + */ +gboolean +pe_test_date_expression(xmlNode *expr, crm_time_t *now, crm_time_t *next_change) +{ + pe_rule_eval_data_t rule_data = { + .node_hash = NULL, + .role = RSC_ROLE_UNKNOWN, + .now = now, + .match_data = NULL, + .rsc_data = NULL, + .op_data = NULL + }; + + switch (pe__eval_date_expr(expr, &rule_data, next_change)) { + case pcmk_rc_within_range: + case pcmk_rc_ok: + return TRUE; + + default: + return FALSE; + } +} + // Set next_change to t if t is earlier static void crm_time_set_if_earlier(crm_time_t *next_change, crm_time_t *t) @@ -312,6 +375,31 @@ crm_time_set_if_earlier(crm_time_t *next_change, crm_time_t *t) } } +/*! + * \internal + * \brief Evaluate a date expression for a specific time + * + * \param[in] time_expr date_expression XML + * \param[in] now Time for which to evaluate expression + * \param[out] next_change If not NULL, set to when evaluation will change + * + * \return Standard Pacemaker return code + */ +int +pe_eval_date_expression(xmlNode *expr, crm_time_t *now, crm_time_t *next_change) +{ + pe_rule_eval_data_t rule_data = { + .node_hash = NULL, + .role = RSC_ROLE_UNKNOWN, + .now = now, + .match_data = NULL, + .rsc_data = NULL, + .op_data = NULL + }; + + return pe__eval_date_expr(expr, &rule_data, next_change); +} + // Information about a block of nvpair elements typedef struct sorted_set_s { int score; // This block's score for sorting @@ -529,31 +617,31 @@ static GList * make_pairs(xmlNode *top, xmlNode *xml_obj, const char *set_name, const char *always_first) { - GList *unsorted = NULL; + GListPtr unsorted = NULL; + const char *score = NULL; + sorted_set_t *pair = NULL; + xmlNode *attr_set = NULL; if (xml_obj == NULL) { return NULL; } - for (xmlNode *attr_set = pcmk__xe_first_child(xml_obj); attr_set != NULL; + for (attr_set = pcmk__xe_first_child(xml_obj); attr_set != NULL; attr_set = pcmk__xe_next(attr_set)) { - if (pcmk__str_eq(set_name, (const char *) attr_set->name, - pcmk__str_null_matches)) { - const char *score = NULL; - sorted_set_t *pair = NULL; - xmlNode *expanded_attr_set = expand_idref(attr_set, top); - - if (expanded_attr_set == NULL) { - // Schema (if not "none") prevents this + /* Uncertain if set_name == NULL check is strictly necessary here */ + if (pcmk__str_eq(set_name, (const char *)attr_set->name, pcmk__str_null_matches)) { + pair = NULL; + attr_set = expand_idref(attr_set, top); + if (attr_set == NULL) { continue; } pair = calloc(1, sizeof(sorted_set_t)); - pair->name = ID(expanded_attr_set); + pair->name = ID(attr_set); pair->special_name = always_first; - pair->attr_set = expanded_attr_set; + pair->attr_set = attr_set; - score = crm_element_value(expanded_attr_set, XML_RULE_ATTR_SCORE); + score = crm_element_value(attr_set, XML_RULE_ATTR_SCORE); pair->score = char2score(score); unsorted = g_list_prepend(unsorted, pair); @@ -820,16 +908,7 @@ pe_eval_subexpr(xmlNode *expr, pe_rule_eval_data_t *rule_data, crm_time_t *next_ break; case time_expr: - switch (pe__eval_date_expr(expr, rule_data, next_change)) { - case pcmk_rc_within_range: - case pcmk_rc_ok: - accept = TRUE; - break; - - default: - accept = FALSE; - break; - } + accept = pe_test_date_expression(expr, rule_data->now, next_change); break; case role_expr: @@ -1025,54 +1104,12 @@ accept_attr_expr(const char *l_val, const char *r_val, const char *type, return false; // Should never reach this point } -/*! - * \internal - * \brief Get correct value according to value-source - * - * \param[in] value value given in rule expression - * \param[in] value_source value-source given in rule expressions - * \param[in] match_data If not NULL, resource back-references and params - */ -static const char * -expand_value_source(const char *value, const char *value_source, - pe_match_data_t *match_data) -{ - GHashTable *table = NULL; - - if (pcmk__str_empty(value)) { - return NULL; // value_source is irrelevant - - } else if (pcmk__str_eq(value_source, "param", pcmk__str_casei)) { - table = match_data->params; - - } else if (pcmk__str_eq(value_source, "meta", pcmk__str_casei)) { - table = match_data->meta; - - } else { // literal - return value; - } - - if (table == NULL) { - return NULL; - } - return (const char *) g_hash_table_lookup(table, value); -} - -/*! - * \internal - * \brief Evaluate a node attribute expression based on #uname, #id, #kind, - * or a generic node attribute - * - * \param[in] expr XML of rule expression - * \param[in] rule_data The match_data and node_hash members are used - * - * \return TRUE if rule_data satisfies the expression, FALSE otherwise - */ gboolean pe__eval_attr_expr(xmlNodePtr expr, pe_rule_eval_data_t *rule_data) { gboolean attr_allocated = FALSE; const char *h_val = NULL; + GHashTable *table = NULL; const char *op = NULL; const char *type = NULL; @@ -1092,19 +1129,32 @@ pe__eval_attr_expr(xmlNodePtr expr, pe_rule_eval_data_t *rule_data) return FALSE; } - if (rule_data->match_data != NULL) { - // Expand any regular expression submatches (%0-%9) in attribute name - if (rule_data->match_data->re != NULL) { + if (rule_data->match_data) { + if (rule_data->match_data->re) { char *resolved_attr = pe_expand_re_matches(attr, rule_data->match_data->re); - if (resolved_attr != NULL) { + if (resolved_attr) { attr = (const char *) resolved_attr; attr_allocated = TRUE; } } - // Get value appropriate to value-source - value = expand_value_source(value, value_source, rule_data->match_data); + if (pcmk__str_eq(value_source, "param", pcmk__str_casei)) { + table = rule_data->match_data->params; + } else if (pcmk__str_eq(value_source, "meta", pcmk__str_casei)) { + table = rule_data->match_data->meta; + } + } + + if (table) { + const char *param_name = value; + const char *param_value = NULL; + + if (param_name && param_name[0]) { + if ((param_value = (const char *)g_hash_table_lookup(table, param_name))) { + value = param_value; + } + } } if (rule_data->node_hash != NULL) { @@ -1119,16 +1169,8 @@ pe__eval_attr_expr(xmlNodePtr expr, pe_rule_eval_data_t *rule_data) return accept_attr_expr(h_val, value, type, op); } -/*! - * \internal - * \brief Evaluate a date_expression - * - * \param[in] expr XML of rule expression - * \param[in] rule_data Only the now member is used - * \param[out] next_change If not NULL, set to when evaluation will change - * - * \return Standard Pacemaker return code - */ + + int pe__eval_date_expr(xmlNodePtr expr, pe_rule_eval_data_t *rule_data, crm_time_t *next_change) { @@ -1243,15 +1285,6 @@ pe__eval_op_expr(xmlNodePtr expr, pe_rule_eval_data_t *rule_data) { return TRUE; } -/*! - * \internal - * \brief Evaluate a node attribute expression based on #role - * - * \param[in] expr XML of rule expression - * \param[in] rule_data Only the role member is used - * - * \return TRUE if rule_data->role satisfies the expression, FALSE otherwise - */ gboolean pe__eval_role_expr(xmlNodePtr expr, pe_rule_eval_data_t *rule_data) { diff --git a/lib/pengine/unpack.c b/lib/pengine/unpack.c index 281bc88..a9bbf4b 100644 --- a/lib/pengine/unpack.c +++ b/lib/pengine/unpack.c @@ -169,7 +169,7 @@ pe_fence_node(pe_working_set_t * data_set, pe_node_t * node, // nvpair with provides or requires set to unfencing #define XPATH_UNFENCING_NVPAIR XML_CIB_TAG_NVPAIR \ - "[(@" XML_NVPAIR_ATTR_NAME "='" PCMK_STONITH_PROVIDES "'" \ + "[(@" XML_NVPAIR_ATTR_NAME "='" XML_RSC_ATTR_PROVIDES "'" \ "or @" XML_NVPAIR_ATTR_NAME "='" XML_RSC_ATTR_REQUIRES "') " \ "and @" XML_NVPAIR_ATTR_VALUE "='unfencing']" @@ -376,6 +376,22 @@ unpack_config(xmlNode * config, pe_working_set_t * data_set) return TRUE; } +static void +destroy_digest_cache(gpointer ptr) +{ + op_digest_cache_t *data = ptr; + + free_xml(data->params_all); + free_xml(data->params_secure); + free_xml(data->params_restart); + + free(data->digest_all_calc); + free(data->digest_restart_calc); + free(data->digest_secure_calc); + + free(data); +} + pe_node_t * pe_create_node(const char *id, const char *uname, const char *type, const char *score, pe_working_set_t * data_set) @@ -430,7 +446,7 @@ pe_create_node(const char *id, const char *uname, const char *type, new_node->details->digest_cache = g_hash_table_new_full(crm_str_hash, g_str_equal, free, - pe__free_digests); + destroy_digest_cache); data_set->nodes = g_list_insert_sorted(data_set->nodes, new_node, sort_node_uname); return new_node; @@ -3182,7 +3198,7 @@ should_clear_for_param_change(xmlNode *xml_op, const char *task, { if (!strcmp(task, "start") || !strcmp(task, "monitor")) { - if (pe__bundle_needs_remote_name(rsc, data_set)) { + if (pe__bundle_needs_remote_name(rsc)) { /* We haven't allocated resources yet, so we can't reliably * substitute addr parameters for the REMOTE_CONTAINER_HACK. * When that's needed, defer the check until later. diff --git a/lib/pengine/utils.c b/lib/pengine/utils.c index 831f890..bfb67da 100644 --- a/lib/pengine/utils.c +++ b/lib/pengine/utils.c @@ -19,7 +19,6 @@ #include #include -#include "pe_status_private.h" extern xmlNode *get_object_root(const char *object_type, xmlNode * the_root); void print_str_str(gpointer key, gpointer value, gpointer user_data); @@ -995,8 +994,6 @@ unpack_operation(pe_action_t * action, xmlNode * xml_obj, pe_resource_t * contai { int timeout_ms = 0; const char *value = NULL; - bool is_probe = pcmk__str_eq(action->task, RSC_STATUS, pcmk__str_casei) - && (interval_ms == 0); #if ENABLE_VERSIONED_ATTRS pe_rsc_action_details_t *rsc_details = NULL; #endif @@ -1028,7 +1025,8 @@ unpack_operation(pe_action_t * action, xmlNode * xml_obj, pe_resource_t * contai action->meta, NULL, FALSE, data_set); // Determine probe default timeout differently - if (is_probe) { + if (pcmk__str_eq(action->task, RSC_STATUS, pcmk__str_casei) + && (interval_ms == 0)) { xmlNode *min_interval_mon = find_min_interval_mon(action->rsc, FALSE); if (min_interval_mon) { @@ -1099,12 +1097,13 @@ unpack_operation(pe_action_t * action, xmlNode * xml_obj, pe_resource_t * contai */ if (pcmk_is_set(pcmk_get_ra_caps(rsc_rule_data.standard), pcmk_ra_cap_fence_params) - && (pcmk__str_eq(action->task, RSC_START, pcmk__str_casei) - || is_probe)) { + && (pcmk__str_eq(action->task, RSC_START, pcmk__str_casei) + || (pcmk__str_eq(action->task, RSC_STATUS, pcmk__str_casei) + && (interval_ms == 0))) + && action->rsc->parameters) { - GHashTable *params = pe_rsc_params(action->rsc, action->node, data_set); - - value = g_hash_table_lookup(params, "pcmk_monitor_timeout"); + value = g_hash_table_lookup(action->rsc->parameters, + "pcmk_monitor_timeout"); if (value) { crm_trace("\t%s: Setting timeout to pcmk_monitor_timeout '%s', " @@ -1992,6 +1991,341 @@ ticket_new(const char *ticket_id, pe_working_set_t * data_set) return ticket; } +static void +filter_parameters(xmlNode * param_set, const char *param_string, bool need_present) +{ + if (param_set && param_string) { + xmlAttrPtr xIter = param_set->properties; + + while (xIter) { + const char *prop_name = (const char *)xIter->name; + char *name = crm_strdup_printf(" %s ", prop_name); + char *match = strstr(param_string, name); + + free(name); + + // Do now, because current entry might get removed below + xIter = xIter->next; + + if (need_present && match == NULL) { + crm_trace("%s not found in %s", prop_name, param_string); + xml_remove_prop(param_set, prop_name); + + } else if (need_present == FALSE && match) { + crm_trace("%s found in %s", prop_name, param_string); + xml_remove_prop(param_set, prop_name); + } + } + } +} + +#if ENABLE_VERSIONED_ATTRS +static void +append_versioned_params(xmlNode *versioned_params, const char *ra_version, xmlNode *params) +{ + GHashTable *hash = pe_unpack_versioned_parameters(versioned_params, ra_version); + char *key = NULL; + char *value = NULL; + GHashTableIter iter; + + g_hash_table_iter_init(&iter, hash); + while (g_hash_table_iter_next(&iter, (gpointer *) &key, (gpointer *) &value)) { + crm_xml_add(params, key, value); + } + g_hash_table_destroy(hash); +} +#endif + +/*! + * \internal + * \brief Calculate action digests and store in node's digest cache + * + * \param[in] rsc Resource that action was for + * \param[in] task Name of action performed + * \param[in] key Action's task key + * \param[in] node Node action was performed on + * \param[in] xml_op XML of operation in CIB status (if available) + * \param[in] calc_secure Whether to calculate secure digest + * \param[in] data_set Cluster working set + * + * \return Pointer to node's digest cache entry + */ +static op_digest_cache_t * +rsc_action_digest(pe_resource_t *rsc, const char *task, const char *key, + pe_node_t *node, xmlNode *xml_op, bool calc_secure, + pe_working_set_t *data_set) +{ + op_digest_cache_t *data = NULL; + + data = g_hash_table_lookup(node->details->digest_cache, key); + if (data == NULL) { + GHashTable *local_rsc_params = crm_str_table_new(); + pe_action_t *action = custom_action(rsc, strdup(key), task, node, TRUE, FALSE, data_set); +#if ENABLE_VERSIONED_ATTRS + xmlNode *local_versioned_params = create_xml_node(NULL, XML_TAG_RSC_VER_ATTRS); + const char *ra_version = NULL; +#endif + + const char *op_version; + const char *restart_list = NULL; + const char *secure_list = " passwd password "; + + data = calloc(1, sizeof(op_digest_cache_t)); + CRM_ASSERT(data != NULL); + + get_rsc_attributes(local_rsc_params, rsc, node, data_set); +#if ENABLE_VERSIONED_ATTRS + pe_get_versioned_attributes(local_versioned_params, rsc, node, data_set); +#endif + + data->params_all = create_xml_node(NULL, XML_TAG_PARAMS); + + // REMOTE_CONTAINER_HACK: Allow remote nodes that start containers with pacemaker remote inside + if (pe__add_bundle_remote_name(rsc, data->params_all, + XML_RSC_ATTR_REMOTE_RA_ADDR)) { + crm_trace("Set address for bundle connection %s (on %s)", + rsc->id, node->details->uname); + } + + g_hash_table_foreach(local_rsc_params, hash2field, data->params_all); + g_hash_table_foreach(action->extra, hash2field, data->params_all); + g_hash_table_foreach(rsc->parameters, hash2field, data->params_all); + g_hash_table_foreach(action->meta, hash2metafield, data->params_all); + + if(xml_op) { + secure_list = crm_element_value(xml_op, XML_LRM_ATTR_OP_SECURE); + restart_list = crm_element_value(xml_op, XML_LRM_ATTR_OP_RESTART); + + op_version = crm_element_value(xml_op, XML_ATTR_CRM_VERSION); +#if ENABLE_VERSIONED_ATTRS + ra_version = crm_element_value(xml_op, XML_ATTR_RA_VERSION); +#endif + + } else { + op_version = CRM_FEATURE_SET; + } + +#if ENABLE_VERSIONED_ATTRS + append_versioned_params(local_versioned_params, ra_version, data->params_all); + append_versioned_params(rsc->versioned_parameters, ra_version, data->params_all); + + { + pe_rsc_action_details_t *details = pe_rsc_action_details(action); + append_versioned_params(details->versioned_parameters, ra_version, data->params_all); + } +#endif + + pcmk__filter_op_for_digest(data->params_all); + + g_hash_table_destroy(local_rsc_params); + pe_free_action(action); + + data->digest_all_calc = calculate_operation_digest(data->params_all, op_version); + + if (calc_secure) { + data->params_secure = copy_xml(data->params_all); + if(secure_list) { + filter_parameters(data->params_secure, secure_list, FALSE); + } + data->digest_secure_calc = calculate_operation_digest(data->params_secure, op_version); + } + + if(xml_op && crm_element_value(xml_op, XML_LRM_ATTR_RESTART_DIGEST) != NULL) { + data->params_restart = copy_xml(data->params_all); + if (restart_list) { + filter_parameters(data->params_restart, restart_list, TRUE); + } + data->digest_restart_calc = calculate_operation_digest(data->params_restart, op_version); + } + + g_hash_table_insert(node->details->digest_cache, strdup(key), data); + } + + return data; +} + +op_digest_cache_t * +rsc_action_digest_cmp(pe_resource_t * rsc, xmlNode * xml_op, pe_node_t * node, + pe_working_set_t * data_set) +{ + op_digest_cache_t *data = NULL; + + char *key = NULL; + guint interval_ms = 0; + + const char *op_version; + const char *task = crm_element_value(xml_op, XML_LRM_ATTR_TASK); + const char *digest_all; + const char *digest_restart; + + CRM_ASSERT(node != NULL); + + op_version = crm_element_value(xml_op, XML_ATTR_CRM_VERSION); + digest_all = crm_element_value(xml_op, XML_LRM_ATTR_OP_DIGEST); + digest_restart = crm_element_value(xml_op, XML_LRM_ATTR_RESTART_DIGEST); + + crm_element_value_ms(xml_op, XML_LRM_ATTR_INTERVAL_MS, &interval_ms); + key = pcmk__op_key(rsc->id, task, interval_ms); + data = rsc_action_digest(rsc, task, key, node, xml_op, + pcmk_is_set(data_set->flags, pe_flag_sanitized), + data_set); + + data->rc = RSC_DIGEST_MATCH; + if (digest_restart && data->digest_restart_calc && strcmp(data->digest_restart_calc, digest_restart) != 0) { + pe_rsc_info(rsc, "Parameters to %s on %s changed: was %s vs. now %s (restart:%s) %s", + key, node->details->uname, + crm_str(digest_restart), data->digest_restart_calc, + op_version, crm_element_value(xml_op, XML_ATTR_TRANSITION_MAGIC)); + data->rc = RSC_DIGEST_RESTART; + + } else if (digest_all == NULL) { + /* it is unknown what the previous op digest was */ + data->rc = RSC_DIGEST_UNKNOWN; + + } else if (strcmp(digest_all, data->digest_all_calc) != 0) { + pe_rsc_info(rsc, "Parameters to %s on %s changed: was %s vs. now %s (%s:%s) %s", + key, node->details->uname, + crm_str(digest_all), data->digest_all_calc, + (interval_ms > 0)? "reschedule" : "reload", + op_version, crm_element_value(xml_op, XML_ATTR_TRANSITION_MAGIC)); + data->rc = RSC_DIGEST_ALL; + } + + free(key); + return data; +} + +/*! + * \internal + * \brief Create an unfencing summary for use in special node attribute + * + * Create a string combining a fence device's resource ID, agent type, and + * parameter digest (whether for all parameters or just non-private parameters). + * This can be stored in a special node attribute, allowing us to detect changes + * in either the agent type or parameters, to know whether unfencing must be + * redone or can be safely skipped when the device's history is cleaned. + * + * \param[in] rsc_id Fence device resource ID + * \param[in] agent_type Fence device agent + * \param[in] param_digest Fence device parameter digest + * + * \return Newly allocated string with unfencing digest + * \note The caller is responsible for freeing the result. + */ +static inline char * +create_unfencing_summary(const char *rsc_id, const char *agent_type, + const char *param_digest) +{ + return crm_strdup_printf("%s:%s:%s", rsc_id, agent_type, param_digest); +} + +/*! + * \internal + * \brief Check whether a node can skip unfencing + * + * Check whether a fence device's current definition matches a node's + * stored summary of when it was last unfenced by the device. + * + * \param[in] rsc_id Fence device's resource ID + * \param[in] agent Fence device's agent type + * \param[in] digest_calc Fence device's current parameter digest + * \param[in] node_summary Value of node's special unfencing node attribute + * (a comma-separated list of unfencing summaries for + * all devices that have unfenced this node) + * + * \return TRUE if digest matches, FALSE otherwise + */ +static bool +unfencing_digest_matches(const char *rsc_id, const char *agent, + const char *digest_calc, const char *node_summary) +{ + bool matches = FALSE; + + if (rsc_id && agent && digest_calc && node_summary) { + char *search_secure = create_unfencing_summary(rsc_id, agent, + digest_calc); + + /* The digest was calculated including the device ID and agent, + * so there is no risk of collision using strstr(). + */ + matches = (strstr(node_summary, search_secure) != NULL); + crm_trace("Calculated unfencing digest '%s' %sfound in '%s'", + search_secure, matches? "" : "not ", node_summary); + free(search_secure); + } + return matches; +} + +/* Magic string to use as action name for digest cache entries used for + * unfencing checks. This is not a real action name (i.e. "on"), so + * check_action_definition() won't confuse these entries with real actions. + */ +#define STONITH_DIGEST_TASK "stonith-on" + +/*! + * \internal + * \brief Calculate fence device digests and digest comparison result + * + * \param[in] rsc Fence device resource + * \param[in] agent Fence device's agent type + * \param[in] node Node with digest cache to use + * \param[in] data_set Cluster working set + * + * \return Node's digest cache entry + */ +static op_digest_cache_t * +fencing_action_digest_cmp(pe_resource_t *rsc, const char *agent, + pe_node_t *node, pe_working_set_t *data_set) +{ + const char *node_summary = NULL; + + // Calculate device's current parameter digests + char *key = pcmk__op_key(rsc->id, STONITH_DIGEST_TASK, 0); + op_digest_cache_t *data = rsc_action_digest(rsc, STONITH_DIGEST_TASK, key, + node, NULL, TRUE, data_set); + + free(key); + + // Check whether node has special unfencing summary node attribute + node_summary = pe_node_attribute_raw(node, CRM_ATTR_DIGESTS_ALL); + if (node_summary == NULL) { + data->rc = RSC_DIGEST_UNKNOWN; + return data; + } + + // Check whether full parameter digest matches + if (unfencing_digest_matches(rsc->id, agent, data->digest_all_calc, + node_summary)) { + data->rc = RSC_DIGEST_MATCH; + return data; + } + + // Check whether secure parameter digest matches + node_summary = pe_node_attribute_raw(node, CRM_ATTR_DIGESTS_SECURE); + if (unfencing_digest_matches(rsc->id, agent, data->digest_secure_calc, + node_summary)) { + data->rc = RSC_DIGEST_MATCH; + if (pcmk_is_set(data_set->flags, pe_flag_stdout)) { + printf("Only 'private' parameters to %s for unfencing %s changed\n", + rsc->id, node->details->uname); + } + return data; + } + + // Parameters don't match + data->rc = RSC_DIGEST_ALL; + if (pcmk_is_set(data_set->flags, (pe_flag_sanitized|pe_flag_stdout)) + && data->digest_secure_calc) { + char *digest = create_unfencing_summary(rsc->id, agent, + data->digest_secure_calc); + + printf("Parameters to %s for unfencing %s changed, try '%s'\n", + rsc->id, node->details->uname, digest); + free(digest); + } + return data; +} + const char *rsc_printable_id(pe_resource_t *rsc) { if (!pcmk_is_set(rsc->flags, pe_rsc_unique)) { @@ -2010,15 +2344,6 @@ pe__clear_resource_flags_recursive(pe_resource_t *rsc, uint64_t flags) } void -pe__clear_resource_flags_on_all(pe_working_set_t *data_set, uint64_t flag) -{ - for (GList *lpc = data_set->resources; lpc != NULL; lpc = lpc->next) { - pe_resource_t *r = (pe_resource_t *) lpc->data; - pe__clear_resource_flags_recursive(r, flag); - } -} - -void pe__set_resource_flags_recursive(pe_resource_t *rsc, uint64_t flags) { pe__set_resource_flags(rsc, flags); @@ -2032,8 +2357,7 @@ find_unfencing_devices(GListPtr candidates, GListPtr matches) { for (GListPtr gIter = candidates; gIter != NULL; gIter = gIter->next) { pe_resource_t *candidate = gIter->data; - const char *provides = g_hash_table_lookup(candidate->meta, - PCMK_STONITH_PROVIDES); + const char *provides = g_hash_table_lookup(candidate->meta, XML_RSC_ATTR_PROVIDES); const char *requires = g_hash_table_lookup(candidate->meta, XML_RSC_ATTR_REQUIRES); if(candidate->children) { @@ -2160,7 +2484,7 @@ pe_fence_op(pe_node_t * node, const char *op, bool optional, const char *reason, XML_ATTR_TYPE); op_digest_cache_t *data = NULL; - data = pe__compare_fencing_digest(match, agent, node, data_set); + data = fencing_action_digest_cmp(match, agent, node, data_set); if(data->rc == RSC_DIGEST_ALL) { optional = FALSE; crm_notice("Unfencing %s (remote): because the definition of %s changed", node->details->uname, match->id); diff --git a/tools/Makefile.am b/tools/Makefile.am index de64c93..a278fa3 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -69,8 +69,7 @@ MAN8DEPS = crm_attribute crmadmin_SOURCES = crmadmin.c crmadmin_LDADD = $(top_builddir)/lib/pengine/libpe_status.la \ $(top_builddir)/lib/cib/libcib.la \ - $(top_builddir)/lib/common/libcrmcommon.la \ - $(top_builddir)/lib/pacemaker/libpacemaker.la + $(top_builddir)/lib/common/libcrmcommon.la crm_error_SOURCES = crm_error.c crm_error_LDADD = $(top_builddir)/lib/common/libcrmcommon.la diff --git a/tools/crm_mon.h b/tools/crm_mon.h index f746507..143e8d8 100644 --- a/tools/crm_mon.h +++ b/tools/crm_mon.h @@ -109,6 +109,7 @@ int print_html_status(pcmk__output_t *out, pe_working_set_t *data_set, GList *append_attr_list(GList *attr_list, char *name); void blank_screen(void); +void crm_mon_get_parameters(pe_resource_t *rsc, pe_working_set_t *data_set); unsigned int get_resource_display_options(unsigned int mon_ops); void crm_mon_register_messages(pcmk__output_t *out); diff --git a/tools/crm_mon_curses.c b/tools/crm_mon_curses.c index 5c79dd2..2c092df 100644 --- a/tools/crm_mon_curses.c +++ b/tools/crm_mon_curses.c @@ -247,11 +247,6 @@ curses_is_quiet(pcmk__output_t *out) { return out->quiet; } -static void -curses_spacer(pcmk__output_t *out) { - addch('\n'); -} - pcmk__output_t * crm_mon_mk_curses_output(char **argv) { pcmk__output_t *retval = calloc(1, sizeof(pcmk__output_t)); @@ -283,7 +278,6 @@ crm_mon_mk_curses_output(char **argv) { retval->end_list = curses_end_list; retval->is_quiet = curses_is_quiet; - retval->spacer = curses_spacer; return retval; } @@ -365,6 +359,31 @@ stonith_event_console(pcmk__output_t *out, va_list args) { return pcmk_rc_ok; } +PCMK__OUTPUT_ARGS("maint-mode", "unsigned long long") +static int +cluster_maint_mode_console(pcmk__output_t *out, va_list args) { + unsigned long long flags = va_arg(args, unsigned long long); + int rc; + + if (pcmk_is_set(flags, pe_flag_maintenance_mode)) { + printw("\n *** Resource management is DISABLED ***"); + printw("\n The cluster will not attempt to start, stop or recover services"); + printw("\n"); + rc = pcmk_rc_ok; + } else if (pcmk_is_set(flags, pe_flag_stop_everything)) { + printw("\n *** Resource management is DISABLED ***"); + printw("\n The cluster will keep all resources stopped"); + printw("\n"); + rc = pcmk_rc_ok; + } else { + rc = pcmk_rc_no_output; + } + + clrtoeol(); + refresh(); + return rc; +} + static pcmk__message_entry_t fmt_functions[] = { { "ban", "console", pe__ban_text }, { "bundle", "console", pe__bundle_text }, @@ -376,16 +395,16 @@ static pcmk__message_entry_t fmt_functions[] = { { "cluster-summary", "console", pe__cluster_summary }, { "cluster-times", "console", pe__cluster_times_text }, { "failed-action", "console", pe__failed_action_text }, - { "failed-fencing-list", "console", stonith__failed_history }, - { "fencing-list", "console", stonith__history }, - { "full-fencing-list", "console", stonith__full_history }, + { "failed-fencing-history", "console", stonith__failed_history }, + { "fencing-history", "console", stonith__history }, + { "full-fencing-history", "console", stonith__full_history }, { "group", "console", pe__group_text }, - { "maint-mode", "console", pe__cluster_maint_mode_text }, + { "maint-mode", "console", cluster_maint_mode_console }, { "node", "console", pe__node_text }, { "node-attribute", "console", pe__node_attribute_text }, { "node-list", "console", pe__node_list_text }, { "op-history", "console", pe__op_history_text }, - { "pending-fencing-list", "console", stonith__pending_actions }, + { "pending-fencing-actions", "console", stonith__pending_actions }, { "primitive", "console", pe__resource_text }, { "resource-history", "console", pe__resource_history_text }, { "stonith-event", "console", stonith_event_console }, diff --git a/tools/crm_mon_print.c b/tools/crm_mon_print.c index 8ae11bf..1a08563 100644 --- a/tools/crm_mon_print.c +++ b/tools/crm_mon_print.c @@ -38,8 +38,7 @@ static int print_rsc_history(pcmk__output_t *out, pe_working_set_t *data_set, static int print_node_history(pcmk__output_t *out, pe_working_set_t *data_set, pe_node_t *node, xmlNode *node_state, gboolean operations, unsigned int mon_ops, GListPtr only_node, GListPtr only_rsc); -static gboolean add_extra_info(pcmk__output_t *out, pe_node_t *node, - GListPtr rsc_list, pe_working_set_t *data_set, +static gboolean add_extra_info(pcmk__output_t *out, pe_node_t * node, GListPtr rsc_list, const char *attrname, int *expected_score); static void print_node_attribute(gpointer name, gpointer user_data); static int print_node_summary(pcmk__output_t *out, pe_working_set_t * data_set, @@ -331,8 +330,7 @@ print_node_history(pcmk__output_t *out, pe_working_set_t *data_set, */ static gboolean add_extra_info(pcmk__output_t *out, pe_node_t *node, GListPtr rsc_list, - pe_working_set_t *data_set, const char *attrname, - int *expected_score) + const char *attrname, int *expected_score) { GListPtr gIter = NULL; @@ -340,11 +338,9 @@ add_extra_info(pcmk__output_t *out, pe_node_t *node, GListPtr rsc_list, pe_resource_t *rsc = (pe_resource_t *) gIter->data; const char *type = g_hash_table_lookup(rsc->meta, "type"); const char *name = NULL; - GHashTable *params = NULL; if (rsc->children != NULL) { - if (add_extra_info(out, node, rsc->children, data_set, attrname, - expected_score)) { + if (add_extra_info(out, node, rsc->children, attrname, expected_score)) { return TRUE; } } @@ -353,8 +349,7 @@ add_extra_info(pcmk__output_t *out, pe_node_t *node, GListPtr rsc_list, continue; } - params = pe_rsc_params(rsc, node, data_set); - name = g_hash_table_lookup(params, "name"); + name = g_hash_table_lookup(rsc->parameters, "name"); if (name == NULL) { name = "pingd"; @@ -364,8 +359,8 @@ add_extra_info(pcmk__output_t *out, pe_node_t *node, GListPtr rsc_list, if (pcmk__str_eq(name, attrname, pcmk__str_casei)) { int host_list_num = 0; /* int value = crm_parse_int(attrvalue, "0"); */ - const char *hosts = g_hash_table_lookup(params, "host_list"); - const char *multiplier = g_hash_table_lookup(params, "multiplier"); + const char *hosts = g_hash_table_lookup(rsc->parameters, "host_list"); + const char *multiplier = g_hash_table_lookup(rsc->parameters, "multiplier"); if (hosts) { char **host_list = g_strsplit(hosts, " ", 0); @@ -386,7 +381,6 @@ add_extra_info(pcmk__output_t *out, pe_node_t *node, GListPtr rsc_list, struct mon_attr_data { pcmk__output_t *out; pe_node_t *node; - pe_working_set_t *data_set; }; static void @@ -400,7 +394,7 @@ print_node_attribute(gpointer name, gpointer user_data) value = pe_node_attribute_raw(data->node, name); add_extra = add_extra_info(data->out, data->node, data->node->details->running_rsc, - data->data_set, name, &expected_score); + name, &expected_score); /* Print attribute name and value */ data->out->message(data->out, "node-attribute", name, value, add_extra, @@ -553,13 +547,19 @@ print_node_attributes(pcmk__output_t *out, pe_working_set_t *data_set, GListPtr gIter = NULL; int rc = pcmk_rc_no_output; + /* Unpack all resource parameters (it would be more efficient to do this + * only when needed for the first time in add_extra_info()) + */ + for (gIter = data_set->resources; gIter != NULL; gIter = gIter->next) { + crm_mon_get_parameters(gIter->data, data_set); + } + /* Display each node's attributes */ for (gIter = data_set->nodes; gIter != NULL; gIter = gIter->next) { struct mon_attr_data data; data.out = out; data.node = (pe_node_t *) gIter->data; - data.data_set = data_set; if (data.node && data.node->details && data.node->details->online) { GList *attr_list = NULL; @@ -735,7 +735,7 @@ print_status(pcmk__output_t *out, pe_working_set_t *data_set, GINT_TO_POINTER(st_failed)); if (hp) { - CHECK_RC(rc, out->message(out, "failed-fencing-list", stonith_history, unames, + CHECK_RC(rc, out->message(out, "failed-fencing-history", stonith_history, unames, pcmk_is_set(mon_ops, mon_op_fence_full_history), rc == pcmk_rc_ok)); } @@ -759,7 +759,7 @@ print_status(pcmk__output_t *out, pe_working_set_t *data_set, GINT_TO_POINTER(st_failed)); if (hp) { - CHECK_RC(rc, out->message(out, "fencing-list", hp, unames, + CHECK_RC(rc, out->message(out, "fencing-history", hp, unames, pcmk_is_set(mon_ops, mon_op_fence_full_history), rc == pcmk_rc_ok)); } @@ -767,7 +767,7 @@ print_status(pcmk__output_t *out, pe_working_set_t *data_set, stonith_history_t *hp = stonith__first_matching_event(stonith_history, stonith__event_state_pending, NULL); if (hp) { - CHECK_RC(rc, out->message(out, "pending-fencing-list", hp, unames, + CHECK_RC(rc, out->message(out, "pending-fencing-actions", hp, unames, pcmk_is_set(mon_ops, mon_op_fence_full_history), rc == pcmk_rc_ok)); } @@ -853,7 +853,7 @@ print_xml_status(pcmk__output_t *out, pe_working_set_t *data_set, if (pcmk_is_set(show, mon_show_fencing_all) && pcmk_is_set(mon_ops, mon_op_fence_history)) { - out->message(out, "full-fencing-list", history_rc, stonith_history, + out->message(out, "full-fencing-history", history_rc, stonith_history, unames, pcmk_is_set(mon_ops, mon_op_fence_full_history), FALSE); } @@ -954,7 +954,7 @@ print_html_status(pcmk__output_t *out, pe_working_set_t *data_set, GINT_TO_POINTER(st_failed)); if (hp) { - out->message(out, "failed-fencing-list", stonith_history, unames, + out->message(out, "failed-fencing-history", stonith_history, unames, pcmk_is_set(mon_ops, mon_op_fence_full_history), FALSE); } } @@ -966,7 +966,7 @@ print_html_status(pcmk__output_t *out, pe_working_set_t *data_set, GINT_TO_POINTER(st_failed)); if (hp) { - out->message(out, "fencing-list", hp, unames, + out->message(out, "fencing-history", hp, unames, pcmk_is_set(mon_ops, mon_op_fence_full_history), FALSE); } @@ -974,7 +974,7 @@ print_html_status(pcmk__output_t *out, pe_working_set_t *data_set, stonith_history_t *hp = stonith__first_matching_event(stonith_history, stonith__event_state_pending, NULL); if (hp) { - out->message(out, "pending-fencing-list", hp, unames, + out->message(out, "pending-fencing-actions", hp, unames, pcmk_is_set(mon_ops, mon_op_fence_full_history), FALSE); } diff --git a/tools/crm_mon_runtime.c b/tools/crm_mon_runtime.c index 43152ce..ce31559 100644 --- a/tools/crm_mon_runtime.c +++ b/tools/crm_mon_runtime.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2020 the Pacemaker project contributors + * Copyright 2019 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -66,6 +66,19 @@ append_attr_list(GList *attr_list, char *name) return g_list_insert_sorted(attr_list, name, compare_attribute); } +void +crm_mon_get_parameters(pe_resource_t *rsc, pe_working_set_t * data_set) +{ + get_rsc_attributes(rsc->parameters, rsc, NULL, data_set); + if(rsc->children) { + GListPtr gIter = NULL; + + for (gIter = rsc->children; gIter != NULL; gIter = gIter->next) { + crm_mon_get_parameters(gIter->data, data_set); + } + } +} + /*! * \internal * \brief Return resource display options corresponding to command-line choices diff --git a/tools/crm_resource.c b/tools/crm_resource.c index b00ea09..975d1f0 100644 --- a/tools/crm_resource.c +++ b/tools/crm_resource.c @@ -1,5 +1,5 @@ /* - * Copyright 2004-2021 the Pacemaker project contributors + * Copyright 2004-2020 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -8,7 +8,6 @@ */ #include -#include #include #include #include @@ -40,7 +39,6 @@ enum rsc_command { cmd_cts, cmd_delete, cmd_delete_param, - cmd_digests, cmd_execute_agent, cmd_fail, cmd_get_param, @@ -67,47 +65,39 @@ enum rsc_command { }; struct { - enum rsc_command rsc_cmd; // crm_resource command to perform - - // Infrastructure that given command needs to work - gboolean require_cib; // Whether command requires CIB IPC - int cib_options; // Options to use with CIB IPC calls - gboolean require_crmd; // Whether command requires controller IPC - gboolean require_dataset; // Whether command requires populated data set - gboolean require_resource; // Whether command requires resource specified - gboolean require_node; // Whether command requires node specified - int find_flags; // Flags to use when searching for resource - - // Command-line option values - gchar *rsc_id; // Value of --resource - gchar *rsc_type; // Value of --resource-type - gboolean force; // --force was given - gboolean clear_expired; // --expired was given - gboolean recursive; // --recursive was given - gboolean promoted_role_only; // --master was given - gchar *host_uname; // Value of --node - gchar *interval_spec; // Value of --interval - gchar *move_lifetime; // Value of --lifetime - gchar *operation; // Value of --operation - const char *attr_set_type; // Instance, meta, or utilization attribute - gchar *prop_id; // --nvpair (attribute XML ID) - char *prop_name; // Attribute name - gchar *prop_set; // --set-name (attribute block XML ID) - gchar *prop_value; // --parameter-value (attribute value) - int timeout_ms; // Parsed from --timeout value - char *agent_spec; // Standard and/or provider and/or agent - gchar *xml_file; // Value of (deprecated) --xml-file - - // Resource configuration specified via command-line arguments - gboolean cmdline_config; // Resource configuration was via arguments - char *v_agent; // Value of --agent - char *v_class; // Value of --class - char *v_provider; // Value of --provider - GHashTable *cmdline_params; // Resource parameters specified - - // Positional command-line arguments - gchar **remainder; // Positional arguments as given - GHashTable *override_params; // Resource parameter values that override config + enum rsc_command rsc_cmd; // The crm_resource command to perform + const char *attr_set_type; + int cib_options; + gboolean clear_expired; + int find_flags; /* Flags to use when searching for resource */ + gboolean force; + gchar *host_uname; + gchar *interval_spec; + gchar *move_lifetime; + gchar *operation; + GHashTable *override_params; + gchar *prop_id; + char *prop_name; + gchar *prop_set; + gchar *prop_value; + gboolean recursive; + gchar **remainder; + gboolean require_cib; // Whether command requires CIB connection + gboolean require_crmd; /* whether command requires controller connection */ + gboolean require_dataset; /* whether command requires populated dataset instance */ + gboolean require_resource; /* whether command requires that resource be specified */ + int resource_verbose; + gchar *rsc_id; + gchar *rsc_type; + gboolean promoted_role_only; + int timeout_ms; + char *agent_spec; // Standard and/or provider and/or agent + char *v_agent; + char *v_class; + char *v_provider; + gboolean validate_cmdline; /* whether we are just validating based on command line options */ + GHashTable *validate_options; + gchar *xml_file; } options = { .attr_set_type = XML_TAG_ATTR_SETS, .cib_options = cib_sync_call, @@ -159,13 +149,11 @@ gboolean validate_or_force_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError **error); gboolean restart_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError **error); -gboolean digests_cb(const gchar *option_name, const gchar *optarg, - gpointer data, GError **error); gboolean wait_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError **error); gboolean why_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError **error); +bool BE_QUIET = FALSE; static crm_exit_t exit_code = CRM_EX_OK; -static pcmk__output_t *out = NULL; // Things that should be cleaned up on exit static GError *error = NULL; @@ -178,32 +166,15 @@ static pe_working_set_t *data_set = NULL; #define INDENT " " -static pcmk__supported_format_t formats[] = { - PCMK__SUPPORTED_FORMAT_NONE, - PCMK__SUPPORTED_FORMAT_TEXT, - PCMK__SUPPORTED_FORMAT_XML, - { NULL, NULL, NULL } -}; - // Clean up and exit static crm_exit_t bye(crm_exit_t ec) { if (error != NULL) { - if (out != NULL) { - out->err(out, "%s: %s", g_get_prgname(), error->message); - } else { - fprintf(stderr, "%s: %s\n", g_get_prgname(), error->message); - } - + fprintf(stderr, "%s: %s\n", g_get_prgname(), error->message); g_clear_error(&error); } - if (out != NULL) { - out->finish(out, ec, true, NULL); - pcmk__output_free(out); - } - if (cib_conn != NULL) { cib_t *save_cib_conn = cib_conn; @@ -249,7 +220,7 @@ resource_ipc_timeout(gpointer data) } g_set_error(&error, PCMK__EXITC_ERROR, CRM_EX_TIMEOUT, - "Aborting because no messages received in %d seconds", MESSAGE_TIMEOUT_S); + "\nAborting because no messages received in %d seconds", MESSAGE_TIMEOUT_S); quit_main_loop(CRM_EX_TIMEOUT); return FALSE; @@ -269,19 +240,18 @@ controller_event_callback(pcmk_ipc_api_t *api, enum pcmk_ipc_event event_type, case pcmk_ipc_event_reply: if (status != CRM_EX_OK) { - out->err(out, "Error: bad reply from controller: %s", - crm_exit_str(status)); + fprintf(stderr, "\nError: bad reply from controller: %s\n", + crm_exit_str(status)); pcmk_disconnect_ipc(api); quit_main_loop(status); } else { + fprintf(stderr, "."); if ((pcmk_controld_api_replies_expected(api) == 0) && mainloop && g_main_loop_is_running(mainloop)) { - out->info(out, "... got reply (done)"); + fprintf(stderr, " OK\n"); crm_debug("Got all the replies we expected"); pcmk_disconnect_ipc(api); quit_main_loop(CRM_EX_OK); - } else { - out->info(out, "... got reply"); } } break; @@ -297,8 +267,8 @@ start_mainloop(pcmk_ipc_api_t *capi) unsigned int count = pcmk_controld_api_replies_expected(capi); if (count > 0) { - out->info(out, "Waiting for %d %s from the controller", - count, pcmk__plural_alt(count, "reply", "replies")); + fprintf(stderr, "Waiting for %d %s from the controller", + count, pcmk__plural_alt(count, "reply", "replies")); exit_code = CRM_EX_DISCONNECT; // For unexpected disconnects mainloop = g_main_loop_new(NULL, FALSE); g_timeout_add(MESSAGE_TIMEOUT_S * 1000, resource_ipc_timeout, NULL); @@ -510,14 +480,6 @@ static GOptionEntry advanced_entries[] = { { "wait", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, wait_cb, "(Advanced) Wait until the cluster settles into a stable state", NULL }, - { "digests", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, digests_cb, - "(Advanced) Show parameter hashes that Pacemaker uses to detect\n" - INDENT "configuration changes (only accurate if there is resource\n" - INDENT "history on the specified node). Required: --resource, --node.\n" - INDENT "Optional: any NAME=VALUE parameters will be used to override\n" - INDENT "the configuration (to see what the hash would be with those\n" - INDENT "changes).", - NULL }, { "force-demote", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, validate_or_force_cb, "(Advanced) Bypass the cluster and demote a resource on the local\n" @@ -552,6 +514,28 @@ static GOptionEntry advanced_entries[] = { { NULL } }; +static GOptionEntry validate_entries[] = { + { "class", 0, G_OPTION_FLAG_NONE, G_OPTION_ARG_CALLBACK, class_cb, + "The standard the resource agent confirms to (for example, ocf).\n" + INDENT "Use with --agent, --provider, --option, and --validate.", + "CLASS" }, + { "agent", 0, G_OPTION_FLAG_NONE, G_OPTION_ARG_CALLBACK, agent_provider_cb, + "The agent to use (for example, IPaddr). Use with --class,\n" + INDENT "--provider, --option, and --validate.", + "AGENT" }, + { "provider", 0, G_OPTION_FLAG_NONE, G_OPTION_ARG_CALLBACK, agent_provider_cb, + "The vendor that supplies the resource agent (for example,\n" + INDENT "heartbeat). Use with --class, --agent, --option, and --validate.", + "PROVIDER" }, + { "option", 0, G_OPTION_FLAG_NONE, G_OPTION_ARG_CALLBACK, option_cb, + "Specify a device configuration parameter as NAME=VALUE (may be\n" + INDENT "specified multiple times). Use with --validate and without the\n" + INDENT "-r option.", + "PARAM" }, + + { NULL } +}; + static GOptionEntry addl_entries[] = { { "node", 'N', G_OPTION_FLAG_NONE, G_OPTION_ARG_STRING, &options.host_uname, "Node name", @@ -579,23 +563,6 @@ static GOptionEntry addl_entries[] = { { "interval", 'I', G_OPTION_FLAG_NONE, G_OPTION_ARG_STRING, &options.interval_spec, "Interval of operation to clear (default 0) (with -C -r -n)", "N" }, - { "class", 0, G_OPTION_FLAG_NONE, G_OPTION_ARG_CALLBACK, class_cb, - "The standard the resource agent conforms to (for example, ocf).\n" - INDENT "Use with --agent, --provider, --option, and --validate.", - "CLASS" }, - { "agent", 0, G_OPTION_FLAG_NONE, G_OPTION_ARG_CALLBACK, agent_provider_cb, - "The agent to use (for example, IPaddr). Use with --class,\n" - INDENT "--provider, --option, and --validate.", - "AGENT" }, - { "provider", 0, G_OPTION_FLAG_NONE, G_OPTION_ARG_CALLBACK, agent_provider_cb, - "The vendor that supplies the resource agent (for example,\n" - INDENT "heartbeat). Use with --class, --agent, --option, and --validate.", - "PROVIDER" }, - { "option", 0, G_OPTION_FLAG_NONE, G_OPTION_ARG_CALLBACK, option_cb, - "Specify a device configuration parameter as NAME=VALUE (may be\n" - INDENT "specified multiple times). Use with --validate and without the\n" - INDENT "-r option.", - "PARAM" }, { "set-name", 's', G_OPTION_FLAG_NONE, G_OPTION_ARG_STRING, &options.prop_set, "(Advanced) XML ID of attributes element to use (with -p, -d)", "ID" }, @@ -622,7 +589,7 @@ static GOptionEntry addl_entries[] = { gboolean agent_provider_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError **error) { - options.cmdline_config = TRUE; + options.validate_cmdline = TRUE; options.require_resource = FALSE; if (pcmk__str_eq(option_name, "--provider", pcmk__str_casei)) { @@ -654,7 +621,7 @@ attr_set_type_cb(const gchar *option_name, const gchar *optarg, gpointer data, G gboolean class_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError **error) { if (!(pcmk_get_ra_caps(optarg) & pcmk_ra_cap_params)) { - if (!out->is_quiet(out)) { + if (BE_QUIET == FALSE) { g_set_error(error, G_OPTION_ERROR, CRM_EX_INVALID_PARAM, "Standard %s does not support parameters\n", optarg); } @@ -668,7 +635,7 @@ class_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError ** options.v_class = strdup(optarg); } - options.cmdline_config = TRUE; + options.validate_cmdline = TRUE; options.require_resource = FALSE; return TRUE; } @@ -753,7 +720,9 @@ list_alternatives_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError **error) { SET_COMMAND(cmd_list_alternatives); - get_agent_spec(optarg); + options.require_cib = FALSE; + options.require_dataset = FALSE; + options.require_resource = FALSE; return TRUE; } @@ -776,17 +745,16 @@ option_cb(const gchar *option_name, const gchar *optarg, gpointer data, if (pcmk_scan_nvpair(optarg, &name, &value) != 2) { return FALSE; } - if (options.cmdline_params == NULL) { - options.cmdline_params = crm_str_table_new(); + if (options.validate_options == NULL) { + options.validate_options = crm_str_table_new(); } - g_hash_table_replace(options.cmdline_params, name, value); + g_hash_table_replace(options.validate_options, name, value); return TRUE; } gboolean fail_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError **error) { options.require_crmd = TRUE; - options.require_node = TRUE; SET_COMMAND(cmd_fail); return TRUE; } @@ -904,9 +872,7 @@ validate_or_force_cb(const gchar *option_name, const gchar *optarg, } options.operation = g_strdup(option_name + 2); // skip "--" options.find_flags = pe_find_renamed|pe_find_anon; - if (options.override_params == NULL) { - options.override_params = crm_str_table_new(); - } + options.override_params = crm_str_table_new(); return TRUE; } @@ -920,20 +886,6 @@ restart_cb(const gchar *option_name, const gchar *optarg, gpointer data, } gboolean -digests_cb(const gchar *option_name, const gchar *optarg, gpointer data, - GError **error) -{ - SET_COMMAND(cmd_digests); - options.find_flags = pe_find_renamed|pe_find_anon; - if (options.override_params == NULL) { - options.override_params = crm_str_table_new(); - } - options.require_node = TRUE; - options.require_dataset = TRUE; - return TRUE; -} - -gboolean wait_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError **error) { SET_COMMAND(cmd_wait); options.require_resource = FALSE; @@ -950,8 +902,7 @@ why_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError **er } static int -ban_or_move(pcmk__output_t *out, pe_resource_t *rsc, const char *move_lifetime, - crm_exit_t *exit_code) +ban_or_move(pe_resource_t *rsc, const char *move_lifetime, crm_exit_t *exit_code) { int rc = pcmk_rc_ok; pe_node_t *current = NULL; @@ -962,7 +913,7 @@ ban_or_move(pcmk__output_t *out, pe_resource_t *rsc, const char *move_lifetime, current = pe__find_active_requires(rsc, &nactive); if (nactive == 1) { - rc = cli_resource_ban(out, options.rsc_id, current->details->uname, move_lifetime, NULL, + rc = cli_resource_ban(options.rsc_id, current->details->uname, move_lifetime, NULL, cib_conn, options.cib_options, options.promoted_role_only); } else if (pcmk_is_set(rsc->flags, pe_rsc_promotable)) { @@ -981,7 +932,7 @@ ban_or_move(pcmk__output_t *out, pe_resource_t *rsc, const char *move_lifetime, } if(count == 1 && current) { - rc = cli_resource_ban(out, options.rsc_id, current->details->uname, move_lifetime, NULL, + rc = cli_resource_ban(options.rsc_id, current->details->uname, move_lifetime, NULL, cib_conn, options.cib_options, options.promoted_role_only); } else { @@ -1010,7 +961,7 @@ ban_or_move(pcmk__output_t *out, pe_resource_t *rsc, const char *move_lifetime, } static void -cleanup(pcmk__output_t *out, pe_resource_t *rsc) +cleanup(pe_resource_t *rsc) { int rc = pcmk_rc_ok; @@ -1020,12 +971,12 @@ cleanup(pcmk__output_t *out, pe_resource_t *rsc) crm_debug("Erasing failures of %s (%s requested) on %s", rsc->id, options.rsc_id, (options.host_uname? options.host_uname: "all nodes")); - rc = cli_resource_delete(out, controld_api, options.host_uname, rsc, options.operation, + rc = cli_resource_delete(controld_api, options.host_uname, rsc, options.operation, options.interval_spec, TRUE, data_set, options.force); - if ((rc == pcmk_rc_ok) && !out->is_quiet(out)) { + if ((rc == pcmk_rc_ok) && !BE_QUIET) { // Show any reasons why resource might stay stopped - cli_resource_check(out, cib_conn, rsc); + cli_resource_check(cib_conn, rsc); } if (rc == pcmk_rc_ok) { @@ -1034,7 +985,7 @@ cleanup(pcmk__output_t *out, pe_resource_t *rsc) } static int -clear_constraints(pcmk__output_t *out, xmlNodePtr *cib_xml_copy) +clear_constraints(xmlNodePtr *cib_xml_copy) { GListPtr before = NULL; GListPtr after = NULL; @@ -1043,7 +994,7 @@ clear_constraints(pcmk__output_t *out, xmlNodePtr *cib_xml_copy) pe_node_t *dest = NULL; int rc = pcmk_rc_ok; - if (!out->is_quiet(out)) { + if (BE_QUIET == FALSE) { before = build_constraint_list(data_set->input); } @@ -1056,7 +1007,7 @@ clear_constraints(pcmk__output_t *out, xmlNodePtr *cib_xml_copy) dest = pe_find_node(data_set->nodes, options.host_uname); if (dest == NULL) { rc = pcmk_rc_node_unknown; - if (!out->is_quiet(out)) { + if (BE_QUIET == FALSE) { g_list_free(before); } return rc; @@ -1069,7 +1020,7 @@ clear_constraints(pcmk__output_t *out, xmlNodePtr *cib_xml_copy) cib_conn, options.cib_options, TRUE, options.force); } - if (!out->is_quiet(out)) { + if (BE_QUIET == FALSE) { rc = cib_conn->cmds->query(cib_conn, NULL, cib_xml_copy, cib_scope_local | cib_sync_call); rc = pcmk_legacy2rc(rc); @@ -1087,7 +1038,7 @@ clear_constraints(pcmk__output_t *out, xmlNodePtr *cib_xml_copy) remaining = pcmk__subtract_lists(before, after, (GCompareFunc) strcmp); for (ele = remaining; ele != NULL; ele = ele->next) { - out->info(out, "Removing constraint: %s", (char *) ele->data); + printf("Removing constraint: %s\n", (char *) ele->data); } g_list_free(before); @@ -1122,27 +1073,28 @@ delete() } static int -list_agents(pcmk__output_t *out, const char *agent_spec, crm_exit_t *exit_code) +list_agents(const char *agent_spec, crm_exit_t *exit_code) { int rc = pcmk_rc_ok; + lrmd_list_t *list = NULL; + lrmd_list_t *iter = NULL; char *provider = strchr(agent_spec, ':'); lrmd_t *lrmd_conn = lrmd_api_new(); - lrmd_list_t *list = NULL; if (provider) { *provider++ = 0; } - rc = lrmd_conn->cmds->list_agents(lrmd_conn, &list, agent_spec, provider); if (rc > 0) { - rc = out->message(out, "agents-list", list, agent_spec, provider); + for (iter = list; iter != NULL; iter = iter->next) { + printf("%s\n", iter->val); + } + lrmd_list_freeall(list); + rc = pcmk_rc_ok; } else { - rc = pcmk_rc_error; - } - - if (rc != pcmk_rc_ok) { *exit_code = CRM_EX_NOSUCH; + rc = pcmk_rc_error; if (provider == NULL) { g_set_error(&error, PCMK__EXITC_ERROR, *exit_code, "No agents found for standard '%s'", agent_spec); @@ -1158,45 +1110,23 @@ list_agents(pcmk__output_t *out, const char *agent_spec, crm_exit_t *exit_code) } static int -list_providers(pcmk__output_t *out, const char *agent_spec, crm_exit_t *exit_code) +list_providers(const char *agent_spec, crm_exit_t *exit_code) { int rc; const char *text = NULL; - lrmd_t *lrmd_conn = lrmd_api_new(); lrmd_list_t *list = NULL; + lrmd_list_t *iter = NULL; + lrmd_t *lrmd_conn = lrmd_api_new(); switch (options.rsc_cmd) { - case cmd_list_alternatives: - rc = lrmd_conn->cmds->list_ocf_providers(lrmd_conn, agent_spec, &list); - - if (rc > 0) { - rc = out->message(out, "alternatives-list", list, agent_spec); - } else { - rc = pcmk_rc_error; - } - - text = "OCF providers"; - break; case cmd_list_standards: rc = lrmd_conn->cmds->list_standards(lrmd_conn, &list); - - if (rc > 0) { - rc = out->message(out, "standards-list", list); - } else { - rc = pcmk_rc_error; - } - text = "standards"; break; case cmd_list_providers: - rc = lrmd_conn->cmds->list_ocf_providers(lrmd_conn, agent_spec, &list); - - if (rc > 0) { - rc = out->message(out, "providers-list", list, agent_spec); - } else { - rc = pcmk_rc_error; - } - + case cmd_list_alternatives: + rc = lrmd_conn->cmds->list_ocf_providers(lrmd_conn, agent_spec, + &list); text = "OCF providers"; break; default: @@ -1206,19 +1136,24 @@ list_providers(pcmk__output_t *out, const char *agent_spec, crm_exit_t *exit_cod return pcmk_rc_error; } - if (rc != pcmk_rc_ok) { - if (agent_spec != NULL) { - *exit_code = CRM_EX_NOSUCH; - rc = pcmk_rc_error; - g_set_error(&error, PCMK__EXITC_ERROR, *exit_code, - "No %s found for %s", text, agent_spec); - - } else { - *exit_code = CRM_EX_NOSUCH; - rc = pcmk_rc_error; - g_set_error(&error, PCMK__EXITC_ERROR, *exit_code, - "No %s found", text); + if (rc > 0) { + for (iter = list; iter != NULL; iter = iter->next) { + printf("%s\n", iter->val); } + lrmd_list_freeall(list); + rc = pcmk_rc_ok; + + } else if (agent_spec != NULL) { + *exit_code = CRM_EX_NOSUCH; + rc = pcmk_rc_error; + g_set_error(&error, PCMK__EXITC_ERROR, *exit_code, + "No %s found for %s", text, agent_spec); + + } else { + *exit_code = CRM_EX_NOSUCH; + rc = pcmk_rc_error; + g_set_error(&error, PCMK__EXITC_ERROR, *exit_code, + "No %s found", text); } lrmd_api_delete(lrmd_conn); @@ -1226,6 +1161,60 @@ list_providers(pcmk__output_t *out, const char *agent_spec, crm_exit_t *exit_cod } static int +list_raw() +{ + int rc = pcmk_rc_ok; + int found = 0; + GListPtr lpc = NULL; + + for (lpc = data_set->resources; lpc != NULL; lpc = lpc->next) { + pe_resource_t *rsc = (pe_resource_t *) lpc->data; + + found++; + cli_resource_print_raw(rsc); + } + + if (found == 0) { + printf("NO resources configured\n"); + rc = ENXIO; + } + + return rc; +} + +static void +list_stacks_and_constraints(pe_resource_t *rsc, bool recursive) +{ + GListPtr lpc = NULL; + xmlNode *cib_constraints = get_object_root(XML_CIB_TAG_CONSTRAINTS, + data_set->input); + + unpack_constraints(cib_constraints, data_set); + + // Constraints apply to group/clone, not member/instance + rsc = uber_parent(rsc); + + for (lpc = data_set->resources; lpc != NULL; lpc = lpc->next) { + pe_resource_t *r = (pe_resource_t *) lpc->data; + + pe__clear_resource_flags(r, pe_rsc_allocating); + } + + cli_resource_print_colocation(rsc, TRUE, recursive, 1); + + fprintf(stdout, "* %s\n", rsc->id); + cli_resource_print_location(rsc, NULL); + + for (lpc = data_set->resources; lpc != NULL; lpc = lpc->next) { + pe_resource_t *r = (pe_resource_t *) lpc->data; + + pe__clear_resource_flags(r, pe_rsc_allocating); + } + + cli_resource_print_colocation(rsc, FALSE, recursive, 1); +} + +static int populate_working_set(xmlNodePtr *cib_xml_copy) { int rc = pcmk_rc_ok; @@ -1257,7 +1246,7 @@ populate_working_set(xmlNodePtr *cib_xml_copy) } static int -refresh(pcmk__output_t *out) +refresh() { int rc = pcmk_rc_ok; const char *router_node = options.host_uname; @@ -1281,8 +1270,8 @@ refresh(pcmk__output_t *out) } if (controld_api == NULL) { - out->info(out, "Dry run: skipping clean-up of %s due to CIB_file", - options.host_uname? options.host_uname : "all nodes"); + printf("Dry run: skipping clean-up of %s due to CIB_file\n", + options.host_uname? options.host_uname : "all nodes"); rc = pcmk_rc_ok; return rc; } @@ -1302,7 +1291,7 @@ refresh(pcmk__output_t *out) } static void -refresh_resource(pcmk__output_t *out, pe_resource_t *rsc) +refresh_resource(pe_resource_t *rsc) { int rc = pcmk_rc_ok; @@ -1312,12 +1301,12 @@ refresh_resource(pcmk__output_t *out, pe_resource_t *rsc) crm_debug("Re-checking the state of %s (%s requested) on %s", rsc->id, options.rsc_id, (options.host_uname? options.host_uname: "all nodes")); - rc = cli_resource_delete(out, controld_api, options.host_uname, rsc, NULL, - 0, FALSE, data_set, options.force); + rc = cli_resource_delete(controld_api, options.host_uname, rsc, NULL, 0, FALSE, + data_set, options.force); - if ((rc == pcmk_rc_ok) && !out->is_quiet(out)) { + if ((rc == pcmk_rc_ok) && !BE_QUIET) { // Show any reasons why resource might stay stopped - cli_resource_check(out, cib_conn, rsc); + cli_resource_check(cib_conn, rsc); } if (rc == pcmk_rc_ok) { @@ -1359,7 +1348,7 @@ set_property() } static int -show_metadata(pcmk__output_t *out, const char *agent_spec, crm_exit_t *exit_code) +show_metadata(const char *agent_spec, crm_exit_t *exit_code) { int rc = pcmk_rc_ok; char *standard = NULL; @@ -1378,7 +1367,7 @@ show_metadata(pcmk__output_t *out, const char *agent_spec, crm_exit_t *exit_code rc = pcmk_legacy2rc(rc); if (metadata) { - out->output_xml(out, "metadata", metadata); + printf("%s\n", metadata); } else { *exit_code = crm_errno2exit(rc); g_set_error(&error, PCMK__EXITC_ERROR, *exit_code, @@ -1396,18 +1385,17 @@ show_metadata(pcmk__output_t *out, const char *agent_spec, crm_exit_t *exit_code } static void -validate_cmdline_config(void) +validate_cmdline(crm_exit_t *exit_code) { - // Cannot use both --resource and command-line resource configuration + // -r cannot be used with any of --class, --agent, or --provider if (options.rsc_id != NULL) { g_set_error(&error, PCMK__EXITC_ERROR, CRM_EX_USAGE, "--resource cannot be used with --class, --agent, and --provider"); - // Not all commands support command-line resource configuration + // If --class, --agent, or --provider are given, --validate must also be given. } else if (options.rsc_cmd != cmd_execute_agent) { g_set_error(&error, PCMK__EXITC_ERROR, CRM_EX_USAGE, - "--class, --agent, and --provider can only be used with " - "--validate"); + "--class, --agent, and --provider require --validate"); // Not all of --class, --agent, and --provider need to be given. Not all // classes support the concept of a provider. Check that what we were given @@ -1430,20 +1418,19 @@ validate_cmdline_config(void) options.v_agent ? options.v_agent : ""); } - if (error != NULL) { - return; - } - - if (options.cmdline_params == NULL) { - options.cmdline_params = crm_str_table_new(); + if (error == NULL) { + if (options.validate_options == NULL) { + options.validate_options = crm_str_table_new(); + } + *exit_code = cli_resource_execute_from_params("test", options.v_class, options.v_provider, options.v_agent, + "validate-all", options.validate_options, + options.override_params, options.timeout_ms, + options.resource_verbose, options.force); } - options.require_resource = FALSE; - options.require_dataset = FALSE; - options.require_cib = FALSE; } static GOptionContext * -build_arg_context(pcmk__common_args_t *args, GOptionGroup **group) { +build_arg_context(pcmk__common_args_t *args) { GOptionContext *context = NULL; GOptionEntry extra_prog_entries[] = { @@ -1486,7 +1473,7 @@ build_arg_context(pcmk__common_args_t *args, GOptionGroup **group) { "had failed permanently and has been repaired by an administrator):\n\n" "\t# crm_resource --resource myResource --cleanup --node aNode\n\n"; - context = pcmk__build_arg_context(args, "text (default), xml", group, NULL); + context = pcmk__build_arg_context(args, NULL, NULL, NULL); g_option_context_set_description(context, description); /* Add the -Q option, which cannot be part of the globally supported options @@ -1500,6 +1487,8 @@ build_arg_context(pcmk__common_args_t *args, GOptionGroup **group) { "Show command help", command_entries); pcmk__add_arg_group(context, "locations", "Locations:", "Show location help", location_entries); + pcmk__add_arg_group(context, "validate", "Validate:", + "Show validate help", validate_entries); pcmk__add_arg_group(context, "advanced", "Advanced:", "Show advanced option help", advanced_entries); pcmk__add_arg_group(context, "additional", "Additional Options:", @@ -1512,20 +1501,14 @@ main(int argc, char **argv) { xmlNode *cib_xml_copy = NULL; pe_resource_t *rsc = NULL; - pe_node_t *node = NULL; - int rc = pcmk_rc_ok; - /* - * Parse command line arguments - */ + int rc = pcmk_rc_ok; pcmk__common_args_t *args = pcmk__new_common_args(SUMMARY); GOptionContext *context = NULL; - GOptionGroup *output_group = NULL; gchar **processed_args = NULL; - context = build_arg_context(args, &output_group); - pcmk__register_formats(output_group, formats); + context = build_arg_context(args); crm_log_cli_init("crm_resource"); processed_args = pcmk__cmdline_preproc(argv, "GINSTdginpstuv"); @@ -1535,29 +1518,18 @@ main(int argc, char **argv) goto done; } - /* - * Set verbosity - */ - for (int i = 0; i < args->verbosity; i++) { crm_bump_log_level(argc, argv); } - rc = pcmk__output_new(&out, args->output_ty, args->output_dest, argv); - if (rc != pcmk_rc_ok) { - fprintf(stderr, "Error creating output format %s: %s\n", - args->output_ty, pcmk_rc_str(rc)); - exit_code = CRM_EX_ERROR; - goto done; - } - - out->quiet = args->quiet; + options.resource_verbose = args->verbosity; + BE_QUIET = args->quiet; crm_log_args(argc, argv); - /* - * Validate option combinations - */ + if (options.host_uname) { + crm_trace("Option host => %s", options.host_uname); + } // If the user didn't explicitly specify a command, list resources if (options.rsc_cmd == cmd_none) { @@ -1623,40 +1595,9 @@ main(int argc, char **argv) goto done; } - if (pcmk__str_eq(args->output_ty, "xml", pcmk__str_none)) { - /* Kind of a hack to display XML lists using a real tag instead of . This just - * saves from having to write custom messages to build the lists around all these things - */ - switch (options.rsc_cmd) { - case cmd_list_resources: - case cmd_query_xml: - case cmd_query_raw_xml: - case cmd_list_active_ops: - case cmd_list_all_ops: - case cmd_colocations: - case cmd_colocations_deep: - pcmk__force_args(context, &error, "%s --xml-simple-list --xml-substitute", g_get_prgname()); - break; - - default: - pcmk__force_args(context, &error, "%s --xml-substitute", g_get_prgname()); - break; - } - } else if (pcmk__str_eq(args->output_ty, "text", pcmk__str_null_matches)) { - if (options.rsc_cmd == cmd_colocations || options.rsc_cmd == cmd_colocations_deep || - options.rsc_cmd == cmd_list_resources) { - pcmk__force_args(context, &error, "%s --text-fancy", g_get_prgname()); - } - } - - pe__register_messages(out); - crm_resource_register_messages(out); - lrmd__register_messages(out); - pcmk__register_lib_messages(out); - if (args->version) { - out->version(out, false); - goto done; + /* FIXME: When crm_resource is converted to use formatted output, this can go. */ + pcmk__cli_help('v', CRM_EX_USAGE); } if (optind > argc) { @@ -1666,47 +1607,35 @@ main(int argc, char **argv) goto done; } - if (options.cmdline_config) { - /* A resource configuration was given on the command line. Sanity-check - * the values and set error if they don't make sense. - */ - validate_cmdline_config(); - if (error != NULL) { - exit_code = CRM_EX_USAGE; - goto done; - } - - } else if (options.cmdline_params != NULL) { + // Sanity check validating from command line parameters. If everything checks out, + // go ahead and run the validation. This way we don't need a CIB connection. + if (options.validate_cmdline) { + validate_cmdline(&exit_code); + goto done; + } else if (options.validate_options != NULL) { // @COMPAT @TODO error out here when we can break backward compatibility - g_hash_table_destroy(options.cmdline_params); - options.cmdline_params = NULL; + g_hash_table_destroy(options.validate_options); + options.validate_options = NULL; } - if (options.require_resource && (options.rsc_id == NULL)) { - rc = ENXIO; - exit_code = CRM_EX_USAGE; - g_set_error(&error, PCMK__EXITC_ERROR, exit_code, - "Must supply a resource id with -r"); - goto done; - } - if (options.require_node && (options.host_uname == NULL)) { - rc = ENXIO; + if (error != NULL) { exit_code = CRM_EX_USAGE; - g_set_error(&error, PCMK__EXITC_ERROR, exit_code, - "Must supply a node name with -N"); goto done; } - /* - * Set up necessary connections - */ - if (options.force) { crm_debug("Forcing..."); cib__set_call_options(options.cib_options, crm_system_name, cib_quorum_override); } + if (options.require_resource && !options.rsc_id) { + rc = ENXIO; + g_set_error(&error, PCMK__EXITC_ERROR, CRM_EX_USAGE, + "Must supply a resource id with -r"); + goto done; + } + if (options.find_flags && options.rsc_id) { options.require_dataset = TRUE; } @@ -1749,17 +1678,11 @@ main(int argc, char **argv) } } - // If user supplied a node name, check whether it exists - if ((options.host_uname != NULL) && (data_set != NULL)) { - node = pe_find_node(data_set->nodes, options.host_uname); - } - // Establish a connection to the controller if needed if (options.require_crmd) { rc = pcmk_new_ipc_api(&controld_api, pcmk_ipc_controld); if (rc != pcmk_rc_ok) { - g_set_error(&error, PCMK__RC_ERROR, rc, - "Error connecting to the controller: %s", pcmk_rc_str(rc)); + CMD_ERR("Error connecting to the controller: %s", pcmk_rc_str(rc)); goto done; } pcmk_register_ipc_callback(controld_api, controller_event_callback, @@ -1772,46 +1695,28 @@ main(int argc, char **argv) } } - /* - * Handle requested command - */ - switch (options.rsc_cmd) { - case cmd_list_resources: { - GListPtr all = NULL; - all = g_list_prepend(all, strdup("*")); - rc = out->message(out, "resource-list", data_set, - pe_print_rsconly | pe_print_pending, - FALSE, TRUE, FALSE, TRUE, all, all, FALSE); - g_list_free_full(all, free); - - if (rc == pcmk_rc_no_output) { - rc = ENXIO; - } + case cmd_list_resources: + rc = pcmk_rc_ok; + cli_resource_print_list(data_set, FALSE); break; - } case cmd_list_instances: - rc = out->message(out, "resource-names-list", data_set->resources); - - if (rc != pcmk_rc_ok) { - rc = ENXIO; - } - + rc = list_raw(); break; case cmd_list_standards: case cmd_list_providers: case cmd_list_alternatives: - rc = list_providers(out, options.agent_spec, &exit_code); + rc = list_providers(options.agent_spec, &exit_code); break; case cmd_list_agents: - rc = list_agents(out, options.agent_spec, &exit_code); + rc = list_agents(options.agent_spec, &exit_code); break; case cmd_metadata: - rc = show_metadata(out, options.agent_spec, &exit_code); + rc = show_metadata(options.agent_spec, &exit_code); break; case cmd_restart: @@ -1820,7 +1725,7 @@ main(int argc, char **argv) * update the working set multiple times, so it needs to use its own * copy. */ - rc = cli_resource_restart(out, rsc, options.host_uname, + rc = cli_resource_restart(rsc, options.host_uname, options.move_lifetime, options.timeout_ms, cib_conn, options.cib_options, options.promoted_role_only, @@ -1828,57 +1733,39 @@ main(int argc, char **argv) break; case cmd_wait: - rc = wait_till_stable(out, options.timeout_ms, cib_conn); + rc = wait_till_stable(options.timeout_ms, cib_conn); break; case cmd_execute_agent: - if (options.cmdline_config) { - exit_code = cli_resource_execute_from_params(out, "test", - options.v_class, options.v_provider, options.v_agent, - "validate-all", options.cmdline_params, - options.override_params, options.timeout_ms, - args->verbosity, options.force); - } else { - exit_code = cli_resource_execute(out, rsc, options.rsc_id, - options.operation, options.override_params, - options.timeout_ms, cib_conn, data_set, - args->verbosity, options.force); - } - break; - - case cmd_digests: - node = pe_find_node(data_set->nodes, options.host_uname); - if (node == NULL) { - rc = pcmk_rc_node_unknown; - } else { - rc = pcmk__resource_digests(out, rsc, node, - options.override_params, data_set); - } + exit_code = cli_resource_execute(rsc, options.rsc_id, + options.operation, + options.override_params, + options.timeout_ms, cib_conn, + data_set, options.resource_verbose, + options.force); break; case cmd_colocations: - rc = out->message(out, "stacks-constraints", rsc, data_set, false); + list_stacks_and_constraints(rsc, false); break; case cmd_colocations_deep: - rc = out->message(out, "stacks-constraints", rsc, data_set, true); + list_stacks_and_constraints(rsc, true); break; case cmd_cts: rc = pcmk_rc_ok; - for (GList *lpc = data_set->resources; lpc != NULL; lpc = lpc->next) { rsc = (pe_resource_t *) lpc->data; - cli_resource_print_cts(out, rsc); + cli_resource_print_cts(rsc); } - - cli_resource_print_cts_constraints(out, data_set); + cli_resource_print_cts_constraints(data_set); break; case cmd_fail: - rc = cli_resource_fail(out, controld_api, options.host_uname, + rc = cli_resource_fail(controld_api, options.host_uname, options.rsc_id, data_set); if (rc == pcmk_rc_ok) { start_mainloop(controld_api); @@ -1886,49 +1773,55 @@ main(int argc, char **argv) break; case cmd_list_active_ops: - rc = cli_resource_print_operations(out, options.rsc_id, + rc = cli_resource_print_operations(options.rsc_id, options.host_uname, TRUE, data_set); break; case cmd_list_all_ops: - rc = cli_resource_print_operations(out, options.rsc_id, + rc = cli_resource_print_operations(options.rsc_id, options.host_uname, FALSE, data_set); break; - case cmd_locate: { - GListPtr resources = cli_resource_search(out, rsc, options.rsc_id, data_set); - rc = out->message(out, "resource-search-list", resources, rsc, options.rsc_id); + case cmd_locate: + cli_resource_search(rsc, options.rsc_id, data_set); + rc = pcmk_rc_ok; break; - } case cmd_query_xml: - rc = cli_resource_print(out, rsc, data_set, TRUE); + rc = cli_resource_print(rsc, data_set, TRUE); break; case cmd_query_raw_xml: - rc = cli_resource_print(out, rsc, data_set, FALSE); + rc = cli_resource_print(rsc, data_set, FALSE); break; case cmd_why: - if ((options.host_uname != NULL) && (node == NULL)) { - rc = pcmk_rc_node_unknown; - } else { - rc = out->message(out, "resource-reasons-list", cib_conn, - data_set->resources, rsc, node); + { + pe_node_t *dest = NULL; + + if (options.host_uname) { + dest = pe_find_node(data_set->nodes, options.host_uname); + if (dest == NULL) { + rc = pcmk_rc_node_unknown; + goto done; + } + } + cli_resource_why(cib_conn, data_set->resources, rsc, dest); + rc = pcmk_rc_ok; } break; case cmd_clear: - rc = clear_constraints(out, &cib_xml_copy); + rc = clear_constraints(&cib_xml_copy); break; case cmd_move: if (options.host_uname == NULL) { - rc = ban_or_move(out, rsc, options.move_lifetime, &exit_code); + rc = ban_or_move(rsc, options.move_lifetime, &exit_code); } else { - rc = cli_resource_move(out, rsc, options.rsc_id, options.host_uname, + rc = cli_resource_move(rsc, options.rsc_id, options.host_uname, options.move_lifetime, cib_conn, options.cib_options, data_set, options.promoted_role_only, @@ -1938,11 +1831,16 @@ main(int argc, char **argv) case cmd_ban: if (options.host_uname == NULL) { - rc = ban_or_move(out, rsc, options.move_lifetime, &exit_code); - } else if (node == NULL) { - rc = pcmk_rc_node_unknown; + rc = ban_or_move(rsc, options.move_lifetime, &exit_code); } else { - rc = cli_resource_ban(out, options.rsc_id, node->details->uname, + pe_node_t *dest = pe_find_node(data_set->nodes, + options.host_uname); + + if (dest == NULL) { + rc = pcmk_rc_node_unknown; + goto done; + } + rc = cli_resource_ban(options.rsc_id, dest->details->uname, options.move_lifetime, NULL, cib_conn, options.cib_options, options.promoted_role_only); @@ -1950,51 +1848,17 @@ main(int argc, char **argv) break; case cmd_get_property: - rc = out->message(out, "property-list", rsc, options.prop_name); - if (rc == pcmk_rc_no_output) { - rc = ENXIO; - } - + rc = cli_resource_print_property(rsc, options.prop_name, data_set); break; case cmd_set_property: rc = set_property(); break; - case cmd_get_param: { - unsigned int count = 0; - GHashTable *params = NULL; - pe_node_t *current = pe__find_active_on(rsc, &count, NULL); - bool free_params = true; - - if (count > 1) { - out->err(out, "%s is active on more than one node," - " returning the default value for %s", rsc->id, crm_str(options.prop_name)); - current = NULL; - } - - crm_debug("Looking up %s in %s", options.prop_name, rsc->id); - - if (pcmk__str_eq(options.attr_set_type, XML_TAG_ATTR_SETS, pcmk__str_casei)) { - params = pe_rsc_params(rsc, current, data_set); - free_params = false; - - } else if (pcmk__str_eq(options.attr_set_type, XML_TAG_META_SETS, pcmk__str_casei)) { - params = crm_str_table_new(); - get_meta_attributes(params, rsc, current, data_set); - - } else { - params = crm_str_table_new(); - pe__unpack_dataset_nvpairs(rsc->xml, XML_TAG_UTILIZATION, NULL, params, - NULL, FALSE, data_set); - } - - rc = out->message(out, "attribute-list", rsc, options.prop_name, params); - if (free_params) { - g_hash_table_destroy(params); - } + case cmd_get_param: + rc = cli_resource_print_attribute(rsc, options.prop_name, + options.attr_set_type, data_set); break; - } case cmd_set_param: if (pcmk__str_empty(options.prop_value)) { @@ -2005,7 +1869,7 @@ main(int argc, char **argv) } /* coverity[var_deref_model] False positive */ - rc = cli_resource_update_attribute(out, rsc, options.rsc_id, + rc = cli_resource_update_attribute(rsc, options.rsc_id, options.prop_set, options.attr_set_type, options.prop_id, @@ -2018,7 +1882,7 @@ main(int argc, char **argv) case cmd_delete_param: /* coverity[var_deref_model] False positive */ - rc = cli_resource_delete_attribute(out, rsc, options.rsc_id, + rc = cli_resource_delete_attribute(rsc, options.rsc_id, options.prop_set, options.attr_set_type, options.prop_id, @@ -2029,22 +1893,22 @@ main(int argc, char **argv) case cmd_cleanup: if (rsc == NULL) { - rc = cli_cleanup_all(out, controld_api, options.host_uname, + rc = cli_cleanup_all(controld_api, options.host_uname, options.operation, options.interval_spec, data_set); if (rc == pcmk_rc_ok) { start_mainloop(controld_api); } } else { - cleanup(out, rsc); + cleanup(rsc); } break; case cmd_refresh: if (rsc == NULL) { - rc = refresh(out); + rc = refresh(); } else { - refresh_resource(out, rsc); + refresh_resource(rsc); } break; @@ -2058,10 +1922,6 @@ main(int argc, char **argv) break; } - /* - * Clean up and exit - */ - done: if (rc != pcmk_rc_ok) { if (rc == pcmk_rc_no_quorum) { @@ -2105,7 +1965,7 @@ done: g_hash_table_destroy(options.override_params); } - /* options.cmdline_params does not need to be destroyed here. See the + /* options.validate_options does not need to be destroyed here. See the * comments in cli_resource_execute_from_params. */ diff --git a/tools/crm_resource.h b/tools/crm_resource.h index 5bfadb7..e979ef8 100644 --- a/tools/crm_resource.h +++ b/tools/crm_resource.h @@ -14,7 +14,6 @@ #include #include #include -#include #include #include @@ -23,92 +22,78 @@ #include #include -enum resource_check_flags { - rsc_remain_stopped = (1 << 0), - rsc_unpromotable = (1 << 1), - rsc_unmanaged = (1 << 2) -}; - -typedef struct resource_checks_s { - pe_resource_t *rsc; - unsigned int flags; - const char *lock_node; -} resource_checks_t; - -resource_checks_t *cli_check_resource(pe_resource_t *rsc, char *role_s, char *managed); +extern bool BE_QUIET; /* ban */ -int cli_resource_prefer(pcmk__output_t *out, const char *rsc_id, const char *host, - const char *move_lifetime, cib_t * cib_conn, int cib_options, - gboolean promoted_role_only); -int cli_resource_ban(pcmk__output_t *out, const char *rsc_id, const char *host, - const char *move_lifetime, GListPtr allnodes, cib_t * cib_conn, - int cib_options, gboolean promoted_role_only); +int cli_resource_prefer(const char *rsc_id, const char *host, const char *move_lifetime, + cib_t * cib_conn, int cib_options, gboolean promoted_role_only); +int cli_resource_ban(const char *rsc_id, const char *host, const char *move_lifetime, + GListPtr allnodes, cib_t * cib_conn, int cib_options, + gboolean promoted_role_only); int cli_resource_clear(const char *rsc_id, const char *host, GListPtr allnodes, cib_t * cib_conn, int cib_options, bool clear_ban_constraints, gboolean force); int cli_resource_clear_all_expired(xmlNode *root, cib_t *cib_conn, int cib_options, const char *rsc, const char *node, gboolean promoted_role_only); /* print */ -void cli_resource_print_cts(pcmk__output_t *out, pe_resource_t * rsc); -void cli_resource_print_raw(pcmk__output_t *out, pe_resource_t * rsc); -void cli_resource_print_cts_constraints(pcmk__output_t *out, pe_working_set_t * data_set); +void cli_resource_print_cts(pe_resource_t * rsc); +void cli_resource_print_raw(pe_resource_t * rsc); +void cli_resource_print_cts_constraints(pe_working_set_t * data_set); +void cli_resource_print_location(pe_resource_t * rsc, const char *prefix); +void cli_resource_print_colocation(pe_resource_t * rsc, bool dependents, bool recursive, int offset); -int cli_resource_print(pcmk__output_t *out, pe_resource_t *rsc, pe_working_set_t *data_set, +int cli_resource_print(pe_resource_t *rsc, pe_working_set_t *data_set, bool expanded); -int cli_resource_print_operations(pcmk__output_t *out, const char *rsc_id, - const char *host_uname, bool active, - pe_working_set_t * data_set); +int cli_resource_print_list(pe_working_set_t * data_set, bool raw); +int cli_resource_print_attribute(pe_resource_t *rsc, const char *attr, const char *attr_set_type, + pe_working_set_t *data_set); +int cli_resource_print_property(pe_resource_t *rsc, const char *attr, + pe_working_set_t *data_set); +int cli_resource_print_operations(const char *rsc_id, const char *host_uname, bool active, pe_working_set_t * data_set); /* runtime */ -int cli_resource_check(pcmk__output_t *out, cib_t * cib, pe_resource_t *rsc); -int cli_resource_fail(pcmk__output_t *out, pcmk_ipc_api_t *controld_api, +void cli_resource_check(cib_t * cib, pe_resource_t *rsc); +int cli_resource_fail(pcmk_ipc_api_t *controld_api, const char *host_uname, const char *rsc_id, pe_working_set_t *data_set); -GListPtr cli_resource_search(pcmk__output_t *out, pe_resource_t *rsc, - const char *requested_name, pe_working_set_t *data_set); -int cli_resource_delete(pcmk__output_t *out, pcmk_ipc_api_t *controld_api, +int cli_resource_search(pe_resource_t *rsc, const char *requested_name, + pe_working_set_t *data_set); +int cli_resource_delete(pcmk_ipc_api_t *controld_api, const char *host_uname, pe_resource_t *rsc, const char *operation, const char *interval_spec, bool just_failures, pe_working_set_t *data_set, gboolean force); -int cli_cleanup_all(pcmk__output_t *out, pcmk_ipc_api_t *controld_api, - const char *node_name, const char *operation, - const char *interval_spec, pe_working_set_t *data_set); -int cli_resource_restart(pcmk__output_t *out, pe_resource_t *rsc, const char *host, - const char *move_lifetime, int timeout_ms, cib_t *cib, - int cib_options, gboolean promoted_role_only, gboolean force); -int cli_resource_move(pcmk__output_t *out, pe_resource_t *rsc, const char *rsc_id, - const char *host_name, const char *move_lifetime, cib_t *cib, - int cib_options, pe_working_set_t *data_set, +int cli_cleanup_all(pcmk_ipc_api_t *controld_api, const char *node_name, + const char *operation, const char *interval_spec, + pe_working_set_t *data_set); +int cli_resource_restart(pe_resource_t *rsc, const char *host, const char *move_lifetime, + int timeout_ms, cib_t *cib, int cib_options, + gboolean promoted_role_only, gboolean force); +int cli_resource_move(pe_resource_t *rsc, const char *rsc_id, + const char *host_name, const char *move_lifetime, + cib_t *cib, int cib_options, pe_working_set_t *data_set, gboolean promoted_role_only, gboolean force); -crm_exit_t cli_resource_execute_from_params(pcmk__output_t *out, const char *rsc_name, - const char *rsc_class, const char *rsc_prov, - const char *rsc_type, const char *rsc_action, - GHashTable *params, GHashTable *override_hash, - int timeout_ms, int resource_verbose, - gboolean force); -crm_exit_t cli_resource_execute(pcmk__output_t *out, pe_resource_t *rsc, - const char *requested_name, const char *rsc_action, - GHashTable *override_hash, int timeout_ms, cib_t *cib, - pe_working_set_t *data_set, int resource_verbose, - gboolean force); +crm_exit_t cli_resource_execute_from_params(const char *rsc_name, const char *rsc_class, + const char *rsc_prov, const char *rsc_type, + const char *rsc_action, GHashTable *params, + GHashTable *override_hash, int timeout_ms, + int resource_verbose, gboolean force); +crm_exit_t cli_resource_execute(pe_resource_t *rsc, const char *requested_name, + const char *rsc_action, GHashTable *override_hash, + int timeout_ms, cib_t *cib, pe_working_set_t *data_set, + int resource_verbose, gboolean force); -int cli_resource_update_attribute(pcmk__output_t *out, pe_resource_t *rsc, - const char *requested_name, const char *attr_set, - const char *attr_set_type, const char *attr_id, - const char *attr_name, const char *attr_value, - gboolean recursive, cib_t *cib, int cib_options, - pe_working_set_t *data_set, gboolean force); -int cli_resource_delete_attribute(pcmk__output_t *out, pe_resource_t *rsc, - const char *requested_name, const char *attr_set, - const char *attr_set_type, const char *attr_id, - const char *attr_name, cib_t *cib, int cib_options, - pe_working_set_t *data_set, gboolean force); +int cli_resource_update_attribute(pe_resource_t *rsc, const char *requested_name, + const char *attr_set, const char *attr_set_type, + const char *attr_id, const char *attr_name, + const char *attr_value, gboolean recursive, cib_t *cib, + int cib_options, pe_working_set_t *data_set, gboolean force); +int cli_resource_delete_attribute(pe_resource_t *rsc, const char *requested_name, + const char *attr_set, const char *attr_set_type, + const char *attr_id, const char *attr_name, cib_t *cib, + int cib_options, pe_working_set_t *data_set, gboolean force); int update_working_set_xml(pe_working_set_t *data_set, xmlNode **xml); -int wait_till_stable(pcmk__output_t *out, int timeout_ms, cib_t * cib); - -bool resource_is_running_on(pe_resource_t *rsc, const char *host); - -void crm_resource_register_messages(pcmk__output_t *out); +int wait_till_stable(int timeout_ms, cib_t * cib); +void cli_resource_why(cib_t *cib_conn, GListPtr resources, pe_resource_t *rsc, + pe_node_t *node); diff --git a/tools/crm_resource_ban.c b/tools/crm_resource_ban.c index 4e3ab8b..e055797 100644 --- a/tools/crm_resource_ban.c +++ b/tools/crm_resource_ban.c @@ -12,7 +12,7 @@ #define XPATH_MAX 1024 static char * -parse_cli_lifetime(pcmk__output_t *out, const char *move_lifetime) +parse_cli_lifetime(const char *move_lifetime) { char *later_s = NULL; crm_time_t *now = NULL; @@ -25,18 +25,18 @@ parse_cli_lifetime(pcmk__output_t *out, const char *move_lifetime) duration = crm_time_parse_duration(move_lifetime); if (duration == NULL) { - out->err(out, "Invalid duration specified: %s\n" - "Please refer to https://en.wikipedia.org/wiki/ISO_8601#Durations " - "for examples of valid durations", move_lifetime); + CMD_ERR("Invalid duration specified: %s", move_lifetime); + CMD_ERR("Please refer to" + " https://en.wikipedia.org/wiki/ISO_8601#Durations" + " for examples of valid durations"); return NULL; } now = crm_time_new(NULL); later = crm_time_add(now, duration); if (later == NULL) { - out->err(out, "Unable to add %s to current time\n" - "Please report to " PACKAGE_BUGREPORT " as possible bug", - move_lifetime); + CMD_ERR("Unable to add %s to current time", move_lifetime); + CMD_ERR("Please report to " PACKAGE_BUGREPORT " as possible bug"); crm_time_free(now); crm_time_free(duration); return NULL; @@ -48,7 +48,7 @@ parse_cli_lifetime(pcmk__output_t *out, const char *move_lifetime) crm_time_log_date | crm_time_log_timeofday | crm_time_log_with_timezone); crm_time_log(LOG_INFO, "duration", duration, crm_time_log_date | crm_time_log_timeofday); later_s = crm_time_as_string(later, crm_time_log_date | crm_time_log_timeofday | crm_time_log_with_timezone); - out->info(out, "Migration will take effect until: %s", later_s); + printf("Migration will take effect until: %s\n", later_s); crm_time_free(duration); crm_time_free(later); @@ -58,9 +58,9 @@ parse_cli_lifetime(pcmk__output_t *out, const char *move_lifetime) // \return Standard Pacemaker return code int -cli_resource_ban(pcmk__output_t *out, const char *rsc_id, const char *host, - const char *move_lifetime, GListPtr allnodes, cib_t * cib_conn, - int cib_options, gboolean promoted_role_only) +cli_resource_ban(const char *rsc_id, const char *host, const char *move_lifetime, + GListPtr allnodes, cib_t * cib_conn, int cib_options, + gboolean promoted_role_only) { char *later_s = NULL; int rc = pcmk_rc_ok; @@ -72,13 +72,13 @@ cli_resource_ban(pcmk__output_t *out, const char *rsc_id, const char *host, for(; n && rc == pcmk_rc_ok; n = n->next) { pe_node_t *target = n->data; - rc = cli_resource_ban(out, rsc_id, target->details->uname, move_lifetime, + rc = cli_resource_ban(rsc_id, target->details->uname, move_lifetime, NULL, cib_conn, cib_options, promoted_role_only); } return rc; } - later_s = parse_cli_lifetime(out, move_lifetime); + later_s = parse_cli_lifetime(move_lifetime); if(move_lifetime && later_s == NULL) { return EINVAL; } @@ -88,16 +88,16 @@ cli_resource_ban(pcmk__output_t *out, const char *rsc_id, const char *host, location = create_xml_node(fragment, XML_CONS_TAG_RSC_LOCATION); crm_xml_set_id(location, "cli-ban-%s-on-%s", rsc_id, host); - if (!out->is_quiet(out)) { - out->info(out, "WARNING: Creating rsc_location constraint '%s' with a " - "score of -INFINITY for resource %s on %s.\n\tThis will " - "prevent %s from %s on %s until the constraint is removed " - "using the clear option or by editing the CIB with an " - "appropriate tool\n\tThis will be the case even if %s " - "is the last node in the cluster", - ID(location), rsc_id, host, rsc_id, - (promoted_role_only? "being promoted" : "running"), - host, host); + if (BE_QUIET == FALSE) { + CMD_ERR("WARNING: Creating rsc_location constraint '%s'" + " with a score of -INFINITY for resource %s" + " on %s.", ID(location), rsc_id, host); + CMD_ERR("\tThis will prevent %s from %s on %s until the constraint " + "is removed using the clear option or by editing the CIB " + "with an appropriate tool", + rsc_id, (promoted_role_only? "being promoted" : "running"), host); + CMD_ERR("\tThis will be the case even if %s is" + " the last node in the cluster", host); } crm_xml_add(location, XML_LOC_ATTR_SOURCE, rsc_id); @@ -143,11 +143,10 @@ cli_resource_ban(pcmk__output_t *out, const char *rsc_id, const char *host, // \return Standard Pacemaker return code int -cli_resource_prefer(pcmk__output_t *out,const char *rsc_id, const char *host, - const char *move_lifetime, cib_t * cib_conn, int cib_options, - gboolean promoted_role_only) +cli_resource_prefer(const char *rsc_id, const char *host, const char *move_lifetime, + cib_t * cib_conn, int cib_options, gboolean promoted_role_only) { - char *later_s = parse_cli_lifetime(out, move_lifetime); + char *later_s = parse_cli_lifetime(move_lifetime); int rc = pcmk_rc_ok; xmlNode *location = NULL; xmlNode *fragment = NULL; diff --git a/tools/crm_resource_print.c b/tools/crm_resource_print.c index 398fef0..1dbc2e2 100644 --- a/tools/crm_resource_print.c +++ b/tools/crm_resource_print.c @@ -8,13 +8,11 @@ */ #include -#include #include -#include #define cons_string(x) x?x:"NA" void -cli_resource_print_cts_constraints(pcmk__output_t *out, pe_working_set_t * data_set) +cli_resource_print_cts_constraints(pe_working_set_t * data_set) { xmlNode *xml_obj = NULL; xmlNode *lifetime = NULL; @@ -34,23 +32,24 @@ cli_resource_print_cts_constraints(pcmk__output_t *out, pe_working_set_t * data_ continue; } - if (!pcmk__str_eq(XML_CONS_TAG_RSC_DEPEND, crm_element_name(xml_obj), pcmk__str_casei)) { - continue; + if (pcmk__str_eq(XML_CONS_TAG_RSC_DEPEND, crm_element_name(xml_obj), pcmk__str_casei)) { + printf("Constraint %s %s %s %s %s %s %s\n", + crm_element_name(xml_obj), + cons_string(crm_element_value(xml_obj, XML_ATTR_ID)), + cons_string(crm_element_value(xml_obj, XML_COLOC_ATTR_SOURCE)), + cons_string(crm_element_value(xml_obj, XML_COLOC_ATTR_TARGET)), + cons_string(crm_element_value(xml_obj, XML_RULE_ATTR_SCORE)), + cons_string(crm_element_value(xml_obj, XML_COLOC_ATTR_SOURCE_ROLE)), + cons_string(crm_element_value(xml_obj, XML_COLOC_ATTR_TARGET_ROLE))); + + } else if (pcmk__str_eq(XML_CONS_TAG_RSC_LOCATION, crm_element_name(xml_obj), pcmk__str_casei)) { + /* unpack_location(xml_obj, data_set); */ } - - out->info(out, "Constraint %s %s %s %s %s %s %s", - crm_element_name(xml_obj), - cons_string(crm_element_value(xml_obj, XML_ATTR_ID)), - cons_string(crm_element_value(xml_obj, XML_COLOC_ATTR_SOURCE)), - cons_string(crm_element_value(xml_obj, XML_COLOC_ATTR_TARGET)), - cons_string(crm_element_value(xml_obj, XML_RULE_ATTR_SCORE)), - cons_string(crm_element_value(xml_obj, XML_COLOC_ATTR_SOURCE_ROLE)), - cons_string(crm_element_value(xml_obj, XML_COLOC_ATTR_TARGET_ROLE))); } } void -cli_resource_print_cts(pcmk__output_t *out, pe_resource_t * rsc) +cli_resource_print_cts(pe_resource_t * rsc) { GListPtr lpc = NULL; const char *host = NULL; @@ -70,511 +69,268 @@ cli_resource_print_cts(pcmk__output_t *out, pe_resource_t * rsc) host = node->details->uname; } - out->info(out, "Resource: %s %s %s %s %s %s %s %s %d %lld 0x%.16llx", - crm_element_name(rsc->xml), rsc->id, - rsc->clone_name ? rsc->clone_name : rsc->id, rsc->parent ? rsc->parent->id : "NA", - rprov ? rprov : "NA", rclass, rtype, host ? host : "NA", needs_quorum, rsc->flags, - rsc->flags); + printf("Resource: %s %s %s %s %s %s %s %s %d %lld 0x%.16llx\n", + crm_element_name(rsc->xml), rsc->id, + rsc->clone_name ? rsc->clone_name : rsc->id, rsc->parent ? rsc->parent->id : "NA", + rprov ? rprov : "NA", rclass, rtype, host ? host : "NA", needs_quorum, rsc->flags, + rsc->flags); for (lpc = rsc->children; lpc != NULL; lpc = lpc->next) { pe_resource_t *child = (pe_resource_t *) lpc->data; - cli_resource_print_cts(out, child); + cli_resource_print_cts(child); } } -// \return Standard Pacemaker return code -int -cli_resource_print_operations(pcmk__output_t *out, const char *rsc_id, - const char *host_uname, bool active, - pe_working_set_t * data_set) + +void +cli_resource_print_raw(pe_resource_t * rsc) { - int rc = pcmk_rc_no_output; - GListPtr ops = find_operations(rsc_id, host_uname, active, data_set); + GListPtr lpc = NULL; + GListPtr children = rsc->children; - if (!ops) { - return rc; + if (children == NULL) { + printf("%s\n", rsc->id); } - out->begin_list(out, NULL, NULL, "Resource Operations"); - rc = pcmk_rc_ok; + for (lpc = children; lpc != NULL; lpc = lpc->next) { + pe_resource_t *child = (pe_resource_t *) lpc->data; - for (GListPtr lpc = ops; lpc != NULL; lpc = lpc->next) { - xmlNode *xml_op = (xmlNode *) lpc->data; - out->message(out, "node-and-op", data_set, xml_op); + cli_resource_print_raw(child); } - - out->end_list(out); - return rc; } // \return Standard Pacemaker return code int -cli_resource_print(pcmk__output_t *out, pe_resource_t *rsc, - pe_working_set_t *data_set, bool expanded) +cli_resource_print_list(pe_working_set_t * data_set, bool raw) { - unsigned int opts = pe_print_pending; - GListPtr all = NULL; - - all = g_list_prepend(all, strdup("*")); - - out->begin_list(out, NULL, NULL, "Resource Config"); - out->message(out, crm_map_element_name(rsc->xml), opts, rsc, all, all); - out->message(out, "resource-config", rsc, !expanded); - out->end_list(out); - - g_list_free_full(all, free); - return pcmk_rc_ok; -} + int found = 0; -PCMK__OUTPUT_ARGS("attribute-list", "pe_resource_t *", "char *", "GHashTable *") -static int -attribute_list_default(pcmk__output_t *out, va_list args) { - pe_resource_t *rsc = va_arg(args, pe_resource_t *); - char *attr = va_arg(args, char *); - GHashTable *params = va_arg(args, GHashTable *); + GListPtr lpc = NULL; + int opts = pe_print_printf | pe_print_rsconly | pe_print_pending; - const char *value = NULL; + for (lpc = data_set->resources; lpc != NULL; lpc = lpc->next) { + pe_resource_t *rsc = (pe_resource_t *) lpc->data; - if (params != NULL) { - value = g_hash_table_lookup(params, attr); - } - if (value != NULL) { - out->begin_list(out, NULL, NULL, "Attributes"); - out->list_item(out, attr, "%s", value); - out->end_list(out); - } else { - out->err(out, "Attribute '%s' not found for '%s'", attr, rsc->id); + if (pcmk_is_set(rsc->flags, pe_rsc_orphan) + && rsc->fns->active(rsc, TRUE) == FALSE) { + continue; + } + rsc->fns->print(rsc, NULL, opts, stdout); + found++; } - return pcmk_rc_ok; -} - -PCMK__OUTPUT_ARGS("attribute-list", "pe_resource_t *", "char *", "GHashTable *") -static int -attribute_list_text(pcmk__output_t *out, va_list args) { - pe_resource_t *rsc = va_arg(args, pe_resource_t *); - char *attr = va_arg(args, char *); - GHashTable *params = va_arg(args, GHashTable *); - - const char *value = NULL; - - if (params != NULL) { - value = g_hash_table_lookup(params, attr); - } - if (value != NULL) { - out->info(out, "%s", value); - } else { - out->err(out, "Attribute '%s' not found for '%s'", attr, rsc->id); + if (found == 0) { + printf("NO resources configured\n"); + return ENXIO; } return pcmk_rc_ok; } -PCMK__OUTPUT_ARGS("property-list", "pe_resource_t *", "char *") -static int -property_list_default(pcmk__output_t *out, va_list args) { - pe_resource_t *rsc = va_arg(args, pe_resource_t *); - char *attr = va_arg(args, char *); - - const char *value = crm_element_value(rsc->xml, attr); - - if (value != NULL) { - out->begin_list(out, NULL, NULL, "Properties"); - out->list_item(out, attr, "%s", value); - out->end_list(out); - } +// \return Standard Pacemaker return code +int +cli_resource_print_operations(const char *rsc_id, const char *host_uname, bool active, + pe_working_set_t * data_set) +{ + pe_resource_t *rsc = NULL; + int opts = pe_print_printf | pe_print_rsconly | pe_print_suppres_nl | pe_print_pending; + GListPtr ops = find_operations(rsc_id, host_uname, active, data_set); + GListPtr lpc = NULL; - return pcmk_rc_ok; -} + for (lpc = ops; lpc != NULL; lpc = lpc->next) { + xmlNode *xml_op = (xmlNode *) lpc->data; -PCMK__OUTPUT_ARGS("property-list", "pe_resource_t *", "char *") -static int -property_list_text(pcmk__output_t *out, va_list args) { - pe_resource_t *rsc = va_arg(args, pe_resource_t *); - char *attr = va_arg(args, char *); + const char *op_rsc = crm_element_value(xml_op, "resource"); + const char *status_s = crm_element_value(xml_op, XML_LRM_ATTR_OPSTATUS); + const char *op_key = crm_element_value(xml_op, XML_LRM_ATTR_TASK_KEY); + int status = crm_parse_int(status_s, "0"); + time_t last_change = 0; - const char *value = crm_element_value(rsc->xml, attr); + rsc = pe_find_resource(data_set->resources, op_rsc); + if(rsc) { + rsc->fns->print(rsc, "", opts, stdout); + } else { + fprintf(stdout, "Unknown resource %s", op_rsc); + } - if (value != NULL) { - out->info(out, "%s", value); + fprintf(stdout, ": %s (node=%s, call=%s, rc=%s", + op_key ? op_key : ID(xml_op), + crm_element_value(xml_op, XML_ATTR_UNAME), + crm_element_value(xml_op, XML_LRM_ATTR_CALLID), + crm_element_value(xml_op, XML_LRM_ATTR_RC)); + + if (crm_element_value_epoch(xml_op, XML_RSC_OP_LAST_CHANGE, + &last_change) == pcmk_ok) { + fprintf(stdout, ", " XML_RSC_OP_LAST_CHANGE "=%s, exec=%sms", + crm_strip_trailing_newline(ctime(&last_change)), + crm_element_value(xml_op, XML_RSC_OP_T_EXEC)); + } + fprintf(stdout, "): %s\n", services_lrm_status_str(status)); } - return pcmk_rc_ok; } -PCMK__OUTPUT_ARGS("resource-check-list", "resource_checks_t *") -static int -resource_check_list_default(pcmk__output_t *out, va_list args) { - resource_checks_t *checks = va_arg(args, resource_checks_t *); - - pe_resource_t *parent = uber_parent(checks->rsc); - int rc = pcmk_rc_no_output; - bool printed = false; - - if (checks->flags != 0 || checks->lock_node != NULL) { - printed = true; - out->begin_list(out, NULL, NULL, "Resource Checks"); - } - - if (pcmk_is_set(checks->flags, rsc_remain_stopped)) { - out->list_item(out, "check", "Configuration specifies '%s' should remain stopped", - parent->id); - } - - if (pcmk_is_set(checks->flags, rsc_unpromotable)) { - out->list_item(out, "check", "Configuration specifies '%s' should not be promoted", - parent->id); - } - - if (pcmk_is_set(checks->flags, rsc_unmanaged)) { - out->list_item(out, "check", "Configuration prevents cluster from stopping or starting unmanaged '%s'", - parent->id); - } - - if (checks->lock_node) { - out->list_item(out, "check", "'%s' is locked to node %s due to shutdown", - parent->id, checks->lock_node); - } - - if (printed) { - out->end_list(out); - rc = pcmk_rc_ok; - } - - return rc; -} - -PCMK__OUTPUT_ARGS("resource-check-list", "resource_checks_t *") -static int -resource_check_list_xml(pcmk__output_t *out, va_list args) { - resource_checks_t *checks = va_arg(args, resource_checks_t *); - - pe_resource_t *parent = uber_parent(checks->rsc); - int rc = pcmk_rc_no_output; - - xmlNodePtr node = pcmk__output_create_xml_node(out, "check", - "id", parent->id, - NULL); - - if (pcmk_is_set(checks->flags, rsc_remain_stopped)) { - crm_xml_add(node, "remain_stopped", "true"); - } - - if (pcmk_is_set(checks->flags, rsc_unpromotable)) { - crm_xml_add(node, "promotable", "false"); - } - - if (pcmk_is_set(checks->flags, rsc_unmanaged)) { - crm_xml_add(node, "unmanaged", "true"); - } - - if (checks->lock_node) { - crm_xml_add(node, "locked-to", checks->lock_node); - } - - return rc; -} - -PCMK__OUTPUT_ARGS("resource-search-list", "GList *", "pe_resource_t *", "gchar *") -static int -resource_search_list_default(pcmk__output_t *out, va_list args) +void +cli_resource_print_location(pe_resource_t * rsc, const char *prefix) { - GList *nodes = va_arg(args, GList *); - pe_resource_t *rsc = va_arg(args, pe_resource_t *); - gchar *requested_name = va_arg(args, gchar *); - - bool printed = false; - int rc = pcmk_rc_no_output; + GListPtr lpc = NULL; + GListPtr list = rsc->rsc_location; + int offset = 0; - if (!out->is_quiet(out) && nodes == NULL) { - out->err(out, "resource %s is NOT running", requested_name); - return rc; + if (prefix) { + offset = strlen(prefix) - 2; } - for (GList *lpc = nodes; lpc != NULL; lpc = lpc->next) { - pe_node_t *node = (pe_node_t *) lpc->data; + for (lpc = list; lpc != NULL; lpc = lpc->next) { + pe__location_t *cons = lpc->data; - if (!printed) { - out->begin_list(out, NULL, NULL, "Nodes"); - printed = true; - rc = pcmk_rc_ok; - } + GListPtr lpc2 = NULL; - if (out->is_quiet(out)) { - out->list_item(out, "node", "%s", node->details->uname); - } else { - const char *state = ""; + for (lpc2 = cons->node_list_rh; lpc2 != NULL; lpc2 = lpc2->next) { + pe_node_t *node = (pe_node_t *) lpc2->data; + char *score = score2char(node->weight); - if (!pe_rsc_is_clone(rsc) && rsc->fns->state(rsc, TRUE) == RSC_ROLE_MASTER) { - state = " Master"; - } - out->list_item(out, "node", "resource %s is running on: %s%s", - requested_name, node->details->uname, state); + fprintf(stdout, "%s: Node %-*s (score=%s, id=%s)\n", + prefix ? prefix : " ", 71 - offset, node->details->uname, score, cons->id); + free(score); } } - - if (printed) { - out->end_list(out); - } - - return rc; } -PCMK__OUTPUT_ARGS("resource-search-list", "GList *", "pe_resource_t *", "gchar *") -static int -resource_search_list_xml(pcmk__output_t *out, va_list args) +void +cli_resource_print_colocation(pe_resource_t * rsc, bool dependents, bool recursive, int offset) { - GList *nodes = va_arg(args, GList *); - pe_resource_t *rsc = va_arg(args, pe_resource_t *); - gchar *requested_name = va_arg(args, gchar *); - - pcmk__output_xml_create_parent(out, "nodes", - "resource", requested_name, - NULL); + char *prefix = NULL; + GListPtr lpc = NULL; + GListPtr list = rsc->rsc_cons; - for (GList *lpc = nodes; lpc != NULL; lpc = lpc->next) { - pe_node_t *node = (pe_node_t *) lpc->data; - xmlNodePtr sub_node = pcmk__output_create_xml_text_node(out, "node", node->details->uname); + prefix = calloc(1, (offset * 4) + 1); + memset(prefix, ' ', offset * 4); - if (!pe_rsc_is_clone(rsc) && rsc->fns->state(rsc, TRUE) == RSC_ROLE_MASTER) { - crm_xml_add(sub_node, "state", "promoted"); - } + if (dependents) { + list = rsc->rsc_cons_lhs; } - return pcmk_rc_ok; -} - -PCMK__OUTPUT_ARGS("resource-reasons-list", "cib_t *", "GList *", "pe_resource_t *", - "pe_node_t *") -static int -resource_reasons_list_default(pcmk__output_t *out, va_list args) -{ - cib_t *cib_conn = va_arg(args, cib_t *); - GList *resources = va_arg(args, GList *); - pe_resource_t *rsc = va_arg(args, pe_resource_t *); - pe_node_t *node = va_arg(args, pe_node_t *); - - const char *host_uname = (node == NULL)? NULL : node->details->uname; + if (pcmk_is_set(rsc->flags, pe_rsc_allocating)) { + /* Break colocation loops */ + printf("loop %s\n", rsc->id); + free(prefix); + return; + } - out->begin_list(out, NULL, NULL, "Resource Reasons"); + pe__set_resource_flags(rsc, pe_rsc_allocating); + for (lpc = list; lpc != NULL; lpc = lpc->next) { + rsc_colocation_t *cons = (rsc_colocation_t *) lpc->data; - if ((rsc == NULL) && (host_uname == NULL)) { - GList *lpc = NULL; - GList *hosts = NULL; + char *score = NULL; + pe_resource_t *peer = cons->rsc_rh; - for (lpc = resources; lpc != NULL; lpc = lpc->next) { - pe_resource_t *rsc = (pe_resource_t *) lpc->data; - rsc->fns->location(rsc, &hosts, TRUE); + if (dependents) { + peer = cons->rsc_lh; + } - if (hosts == NULL) { - out->list_item(out, "reason", "Resource %s is not running", rsc->id); - } else { - out->list_item(out, "reason", "Resource %s is running", rsc->id); + if (pcmk_is_set(peer->flags, pe_rsc_allocating)) { + if (dependents == FALSE) { + fprintf(stdout, "%s%-*s (id=%s - loop)\n", prefix, 80 - (4 * offset), peer->id, + cons->id); } - - cli_resource_check(out, cib_conn, rsc); - g_list_free(hosts); - hosts = NULL; + continue; } - } else if ((rsc != NULL) && (host_uname != NULL)) { - if (resource_is_running_on(rsc, host_uname)) { - out->list_item(out, "reason", "Resource %s is running on host %s", - rsc->id, host_uname); - } else { - out->list_item(out, "reason", "Resource %s is not running on host %s", - rsc->id, host_uname); + if (dependents && recursive) { + cli_resource_print_colocation(peer, dependents, recursive, offset + 1); } - cli_resource_check(out, cib_conn, rsc); - - } else if ((rsc == NULL) && (host_uname != NULL)) { - const char* host_uname = node->details->uname; - GList *allResources = node->details->allocated_rsc; - GList *activeResources = node->details->running_rsc; - GList *unactiveResources = pcmk__subtract_lists(allResources, activeResources, (GCompareFunc) strcmp); - GList *lpc = NULL; - - for (lpc = activeResources; lpc != NULL; lpc = lpc->next) { - pe_resource_t *rsc = (pe_resource_t *) lpc->data; - out->list_item(out, "reason", "Resource %s is running on host %s", - rsc->id, host_uname); - cli_resource_check(out, cib_conn, rsc); + score = score2char(cons->score); + if (cons->role_rh > RSC_ROLE_STARTED) { + fprintf(stdout, "%s%-*s (score=%s, %s role=%s, id=%s)\n", prefix, 80 - (4 * offset), + peer->id, score, dependents ? "needs" : "with", role2text(cons->role_rh), + cons->id); + } else { + fprintf(stdout, "%s%-*s (score=%s, id=%s)\n", prefix, 80 - (4 * offset), + peer->id, score, cons->id); } + cli_resource_print_location(peer, prefix); + free(score); - for(lpc = unactiveResources; lpc != NULL; lpc = lpc->next) { - pe_resource_t *rsc = (pe_resource_t *) lpc->data; - out->list_item(out, "reason", "Resource %s is assigned to host %s but not running", - rsc->id, host_uname); - cli_resource_check(out, cib_conn, rsc); + if (!dependents && recursive) { + cli_resource_print_colocation(peer, dependents, recursive, offset + 1); } - - g_list_free(allResources); - g_list_free(activeResources); - g_list_free(unactiveResources); - - } else if ((rsc != NULL) && (host_uname == NULL)) { - GList *hosts = NULL; - - rsc->fns->location(rsc, &hosts, TRUE); - out->list_item(out, "reason", "Resource %s is %srunning", - rsc->id, (hosts? "" : "not ")); - cli_resource_check(out, cib_conn, rsc); - g_list_free(hosts); } - - out->end_list(out); - return pcmk_rc_ok; + free(prefix); } -PCMK__OUTPUT_ARGS("resource-reasons-list", "cib_t *", "GList *", "pe_resource_t *", - "pe_node_t *") -static int -resource_reasons_list_xml(pcmk__output_t *out, va_list args) +// \return Standard Pacemaker return code +int +cli_resource_print(pe_resource_t *rsc, pe_working_set_t *data_set, bool expanded) { - cib_t *cib_conn = va_arg(args, cib_t *); - GList *resources = va_arg(args, GList *); - pe_resource_t *rsc = va_arg(args, pe_resource_t *); - pe_node_t *node = va_arg(args, pe_node_t *); - - const char *host_uname = (node == NULL)? NULL : node->details->uname; - - xmlNodePtr xml_node = pcmk__output_xml_create_parent(out, "reason", NULL); + char *rsc_xml = NULL; + int opts = pe_print_printf | pe_print_pending; - if ((rsc == NULL) && (host_uname == NULL)) { - GList *lpc = NULL; - GList *hosts = NULL; + rsc->fns->print(rsc, NULL, opts, stdout); - pcmk__output_xml_create_parent(out, "resources", NULL); - - for (lpc = resources; lpc != NULL; lpc = lpc->next) { - pe_resource_t *rsc = (pe_resource_t *) lpc->data; - - rsc->fns->location(rsc, &hosts, TRUE); - - pcmk__output_xml_create_parent(out, "resource", - "id", rsc->id, - "running", pcmk__btoa(hosts != NULL), - NULL); - - cli_resource_check(out, cib_conn, rsc); - pcmk__output_xml_pop_parent(out); - g_list_free(hosts); - hosts = NULL; - } - - pcmk__output_xml_pop_parent(out); - - } else if ((rsc != NULL) && (host_uname != NULL)) { - if (resource_is_running_on(rsc, host_uname)) { - crm_xml_add(xml_node, "running_on", host_uname); - } - - cli_resource_check(out, cib_conn, rsc); - - } else if ((rsc == NULL) && (host_uname != NULL)) { - const char* host_uname = node->details->uname; - GList *allResources = node->details->allocated_rsc; - GList *activeResources = node->details->running_rsc; - GList *unactiveResources = pcmk__subtract_lists(allResources, activeResources, (GCompareFunc) strcmp); - GList *lpc = NULL; - - pcmk__output_xml_create_parent(out, "resources", NULL); - - for (lpc = activeResources; lpc != NULL; lpc = lpc->next) { - pe_resource_t *rsc = (pe_resource_t *) lpc->data; - - pcmk__output_xml_create_parent(out, "resource", - "id", rsc->id, - "running", "true", - "host", host_uname, - NULL); - - cli_resource_check(out, cib_conn, rsc); - pcmk__output_xml_pop_parent(out); - } - - for(lpc = unactiveResources; lpc != NULL; lpc = lpc->next) { - pe_resource_t *rsc = (pe_resource_t *) lpc->data; - - pcmk__output_xml_create_parent(out, "resource", - "id", rsc->id, - "running", "false", - "host", host_uname, - NULL); - - cli_resource_check(out, cib_conn, rsc); - pcmk__output_xml_pop_parent(out); - } - - pcmk__output_xml_pop_parent(out); - g_list_free(allResources); - g_list_free(activeResources); - g_list_free(unactiveResources); + rsc_xml = dump_xml_formatted((!expanded && rsc->orig_xml)? + rsc->orig_xml : rsc->xml); + fprintf(stdout, "%sxml:\n%s\n", expanded ? "" : "raw ", rsc_xml); + free(rsc_xml); + return pcmk_rc_ok; +} - } else if ((rsc != NULL) && (host_uname == NULL)) { - GList *hosts = NULL; +// \return Standard Pacemaker return code +int +cli_resource_print_attribute(pe_resource_t *rsc, const char *attr, const char *attr_set_type, + pe_working_set_t * data_set) +{ + int rc = ENXIO; + unsigned int count = 0; + GHashTable *params = NULL; + const char *value = NULL; + pe_node_t *current = pe__find_active_on(rsc, &count, NULL); - rsc->fns->location(rsc, &hosts, TRUE); - crm_xml_add(xml_node, "running", pcmk__btoa(hosts != NULL)); - cli_resource_check(out, cib_conn, rsc); - g_list_free(hosts); + if (count > 1) { + CMD_ERR("%s is active on more than one node," + " returning the default value for %s", rsc->id, crm_str(attr)); + current = NULL; } - return pcmk_rc_ok; -} + params = crm_str_table_new(); -static void -add_resource_name(pcmk__output_t *out, pe_resource_t *rsc) { - if (rsc->children == NULL) { - out->list_item(out, "resource", "%s", rsc->id); - } else { - for (GListPtr lpc = rsc->children; lpc != NULL; lpc = lpc->next) { - pe_resource_t *child = (pe_resource_t *) lpc->data; - add_resource_name(out, child); - } - } -} + if (pcmk__str_eq(attr_set_type, XML_TAG_ATTR_SETS, pcmk__str_casei)) { + get_rsc_attributes(params, rsc, current, data_set); -PCMK__OUTPUT_ARGS("resource-names-list", "GList *") -static int -resource_names(pcmk__output_t *out, va_list args) { - GList *resources = va_arg(args, GList *); + } else if (pcmk__str_eq(attr_set_type, XML_TAG_META_SETS, pcmk__str_casei)) { + /* No need to redirect to the parent */ + get_meta_attributes(params, rsc, current, data_set); - if (resources == NULL) { - out->err(out, "NO resources configured\n"); - return pcmk_rc_no_output; + } else { + pe__unpack_dataset_nvpairs(rsc->xml, XML_TAG_UTILIZATION, NULL, params, + NULL, FALSE, data_set); } - out->begin_list(out, NULL, NULL, "Resource Names"); + crm_debug("Looking up %s in %s", attr, rsc->id); + value = g_hash_table_lookup(params, attr); + if (value != NULL) { + fprintf(stdout, "%s\n", value); + rc = pcmk_rc_ok; - for (GList *lpc = resources; lpc != NULL; lpc = lpc->next) { - pe_resource_t *rsc = (pe_resource_t *) lpc->data; - add_resource_name(out, rsc); + } else { + CMD_ERR("Attribute '%s' not found for '%s'", attr, rsc->id); } - out->end_list(out); - return pcmk_rc_ok; + g_hash_table_destroy(params); + return rc; } -static pcmk__message_entry_t fmt_functions[] = { - { "attribute-list", "default", attribute_list_default }, - { "attribute-list", "text", attribute_list_text }, - { "property-list", "default", property_list_default }, - { "property-list", "text", property_list_text }, - { "resource-check-list", "default", resource_check_list_default }, - { "resource-check-list", "xml", resource_check_list_xml }, - { "resource-search-list", "default", resource_search_list_default }, - { "resource-search-list", "xml", resource_search_list_xml }, - { "resource-reasons-list", "default", resource_reasons_list_default }, - { "resource-reasons-list", "xml", resource_reasons_list_xml }, - { "resource-names-list", "default", resource_names }, - - { NULL, NULL, NULL } -}; +// \return Standard Pacemaker return code +int +cli_resource_print_property(pe_resource_t *rsc, const char *attr, pe_working_set_t * data_set) +{ + const char *value = crm_element_value(rsc->xml, attr); -void -crm_resource_register_messages(pcmk__output_t *out) { - pcmk__register_messages(out, fmt_functions); + if (value != NULL) { + fprintf(stdout, "%s\n", value); + return pcmk_rc_ok; + } + return ENXIO; } diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c index 3e69dc7..d133219 100644 --- a/tools/crm_resource_runtime.c +++ b/tools/crm_resource_runtime.c @@ -1,5 +1,5 @@ /* - * Copyright 2004-2021 the Pacemaker project contributors + * Copyright 2004-2020 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -12,48 +12,46 @@ #include #include -resource_checks_t * -cli_check_resource(pe_resource_t *rsc, char *role_s, char *managed) +static int +do_find_resource(const char *rsc, pe_resource_t * the_rsc, pe_working_set_t * data_set) { - pe_resource_t *parent = uber_parent(rsc); - resource_checks_t *rc = calloc(1, sizeof(resource_checks_t)); + int found = 0; + GListPtr lpc = NULL; - if (role_s) { - enum rsc_role_e role = text2role(role_s); + for (lpc = the_rsc->running_on; lpc != NULL; lpc = lpc->next) { + pe_node_t *node = (pe_node_t *) lpc->data; - if (role == RSC_ROLE_STOPPED) { - rc->flags |= rsc_remain_stopped; - } else if (pcmk_is_set(parent->flags, pe_rsc_promotable) && - role == RSC_ROLE_SLAVE) { - rc->flags |= rsc_unpromotable; + if (BE_QUIET) { + fprintf(stdout, "%s\n", node->details->uname); + } else { + const char *state = ""; + + if (!pe_rsc_is_clone(the_rsc) && the_rsc->fns->state(the_rsc, TRUE) == RSC_ROLE_MASTER) { + state = "Master"; + } + fprintf(stdout, "resource %s is running on: %s %s\n", rsc, node->details->uname, state); } - } - if (managed && !crm_is_true(managed)) { - rc->flags |= rsc_unmanaged; + found++; } - if (rsc->lock_node) { - rc->lock_node = rsc->lock_node->details->uname; + if (BE_QUIET == FALSE && found == 0) { + fprintf(stderr, "resource %s is NOT running\n", rsc); } - rc->rsc = rsc; - return rc; + return found; } -GListPtr -cli_resource_search(pcmk__output_t *out, pe_resource_t *rsc, const char *requested_name, +int +cli_resource_search(pe_resource_t *rsc, const char *requested_name, pe_working_set_t *data_set) { - GListPtr found = NULL; + int found = 0; pe_resource_t *parent = uber_parent(rsc); if (pe_rsc_is_clone(rsc)) { for (GListPtr iter = rsc->children; iter != NULL; iter = iter->next) { - GListPtr extra = ((pe_resource_t *) iter->data)->running_on; - if (extra != NULL) { - found = g_list_concat(found, extra); - } + found += do_find_resource(requested_name, iter->data, data_set); } /* The anonymous clone children's common ID is supplied */ @@ -64,14 +62,11 @@ cli_resource_search(pcmk__output_t *out, pe_resource_t *rsc, const char *request && !pcmk__str_eq(requested_name, rsc->id, pcmk__str_casei)) { for (GListPtr iter = parent->children; iter; iter = iter->next) { - GListPtr extra = ((pe_resource_t *) iter->data)->running_on; - if (extra != NULL) { - found = g_list_concat(found, extra); - } + found += do_find_resource(requested_name, iter->data, data_set); } - } else if (rsc->running_on != NULL) { - found = g_list_concat(found, rsc->running_on); + } else { + found += do_find_resource(requested_name, rsc, data_set); } return found; @@ -81,9 +76,8 @@ cli_resource_search(pcmk__output_t *out, pe_resource_t *rsc, const char *request // \return Standard Pacemaker return code static int -find_resource_attr(pcmk__output_t *out, cib_t * the_cib, const char *attr, - const char *rsc, const char *attr_set_type, const char *set_name, - const char *attr_id, const char *attr_name, char **value) +find_resource_attr(cib_t * the_cib, const char *attr, const char *rsc, const char *attr_set_type, + const char *set_name, const char *attr_id, const char *attr_name, char **value) { int offset = 0; int rc = pcmk_rc_ok; @@ -138,16 +132,14 @@ find_resource_attr(pcmk__output_t *out, cib_t * the_cib, const char *attr, xmlNode *child = NULL; rc = EINVAL; - out->info(out, "Multiple attributes match name=%s", attr_name); + printf("Multiple attributes match name=%s\n", attr_name); for (child = pcmk__xml_first_child(xml_search); child != NULL; child = pcmk__xml_next(child)) { - out->info(out, " Value: %s \t(id=%s)", - crm_element_value(child, XML_NVPAIR_ATTR_VALUE), ID(child)); + printf(" Value: %s \t(id=%s)\n", + crm_element_value(child, XML_NVPAIR_ATTR_VALUE), ID(child)); } - out->spacer(out); - } else if(value) { const char *tmp = crm_element_value(xml_search, attr); @@ -164,11 +156,9 @@ find_resource_attr(pcmk__output_t *out, cib_t * the_cib, const char *attr, /* PRIVATE. Use the find_matching_attr_resources instead. */ static void -find_matching_attr_resources_recursive(pcmk__output_t *out, GList/* */ ** result, - pe_resource_t * rsc, const char * rsc_id, - const char * attr_set, const char * attr_set_type, - const char * attr_id, const char * attr_name, - cib_t * cib, const char * cmd, int depth) +find_matching_attr_resources_recursive(GList/* */ ** result, pe_resource_t * rsc, const char * rsc_id, + const char * attr_set, const char * attr_set_type, const char * attr_id, + const char * attr_name, cib_t * cib, const char * cmd, int depth) { int rc = pcmk_rc_ok; char *lookup_id = clone_strip(rsc->id); @@ -176,7 +166,7 @@ find_matching_attr_resources_recursive(pcmk__output_t *out, GList/* children; gIter; gIter = gIter->next) { - find_matching_attr_resources_recursive(out, result, (pe_resource_t*)gIter->data, + find_matching_attr_resources_recursive(result, (pe_resource_t*)gIter->data, rsc_id, attr_set, attr_set_type, attr_id, attr_name, cib, cmd, depth+1); /* do it only once for clones */ @@ -185,8 +175,7 @@ find_matching_attr_resources_recursive(pcmk__output_t *out, GList/* */ * -find_matching_attr_resources(pcmk__output_t *out, pe_resource_t * rsc, - const char * rsc_id, const char * attr_set, +find_matching_attr_resources(pe_resource_t * rsc, const char * rsc_id, const char * attr_set, const char * attr_set_type, const char * attr_id, - const char * attr_name, cib_t * cib, const char * cmd, - gboolean force) + const char * attr_name, cib_t * cib, const char * cmd, gboolean force) { int rc = pcmk_rc_ok; char *lookup_id = NULL; @@ -220,15 +207,13 @@ find_matching_attr_resources(pcmk__output_t *out, pe_resource_t * rsc, if(rsc->parent && pe_clone == rsc->parent->variant) { int rc = pcmk_rc_ok; char *local_attr_id = NULL; - rc = find_resource_attr(out, cib, XML_ATTR_ID, rsc_id, attr_set_type, - attr_set, attr_id, attr_name, &local_attr_id); + rc = find_resource_attr(cib, XML_ATTR_ID, rsc_id, attr_set_type, attr_set, attr_id, attr_name, &local_attr_id); free(local_attr_id); if(rc != pcmk_rc_ok) { rsc = rsc->parent; - if (!out->is_quiet(out)) { - out->info(out, "Performing %s of '%s' on '%s', the parent of '%s'", - cmd, attr_name, rsc->id, rsc_id); + if (BE_QUIET == FALSE) { + printf("Performing %s of '%s' on '%s', the parent of '%s'\n", cmd, attr_name, rsc->id, rsc_id); } } return g_list_append(result, rsc); @@ -237,14 +222,12 @@ find_matching_attr_resources(pcmk__output_t *out, pe_resource_t * rsc, if(child->variant == pe_native) { lookup_id = clone_strip(child->id); /* Could be a cloned group! */ - rc = find_resource_attr(out, cib, XML_ATTR_ID, lookup_id, attr_set_type, - attr_set, attr_id, attr_name, &local_attr_id); + rc = find_resource_attr(cib, XML_ATTR_ID, lookup_id, attr_set_type, attr_set, attr_id, attr_name, &local_attr_id); if(rc == pcmk_rc_ok) { rsc = child; - if (!out->is_quiet(out)) { - out->info(out, "A value for '%s' already exists in child '%s', performing %s on that instead of '%s'", - attr_name, lookup_id, cmd, rsc_id); + if (BE_QUIET == FALSE) { + printf("A value for '%s' already exists in child '%s', performing %s on that instead of '%s'\n", attr_name, lookup_id, cmd, rsc_id); } } @@ -254,7 +237,7 @@ find_matching_attr_resources(pcmk__output_t *out, pe_resource_t * rsc, return g_list_append(result, rsc); } /* If the resource is a group ==> children inherit the attribute if defined. */ - find_matching_attr_resources_recursive(out, &result, rsc, rsc_id, attr_set, + find_matching_attr_resources_recursive(&result, rsc, rsc_id, attr_set, attr_set_type, attr_id, attr_name, cib, cmd, 0); return result; @@ -262,12 +245,11 @@ find_matching_attr_resources(pcmk__output_t *out, pe_resource_t * rsc, // \return Standard Pacemaker return code int -cli_resource_update_attribute(pcmk__output_t *out, pe_resource_t *rsc, - const char *requested_name, const char *attr_set, - const char *attr_set_type, const char *attr_id, - const char *attr_name, const char *attr_value, - gboolean recursive, cib_t *cib, int cib_options, - pe_working_set_t *data_set, gboolean force) +cli_resource_update_attribute(pe_resource_t *rsc, const char *requested_name, + const char *attr_set, const char *attr_set_type, + const char *attr_id, const char *attr_name, + const char *attr_value, gboolean recursive, cib_t *cib, + int cib_options, pe_working_set_t *data_set, gboolean force) { int rc = pcmk_rc_ok; static bool need_init = TRUE; @@ -278,21 +260,23 @@ cli_resource_update_attribute(pcmk__output_t *out, pe_resource_t *rsc, GList/**/ *resources = NULL; const char *common_attr_id = attr_id; - if (attr_id == NULL && force == FALSE) { - find_resource_attr (out, cib, XML_ATTR_ID, uber_parent(rsc)->id, NULL, - NULL, NULL, attr_name, NULL); + if(attr_id == NULL + && force == FALSE + && find_resource_attr( + cib, XML_ATTR_ID, uber_parent(rsc)->id, NULL, NULL, NULL, attr_name, NULL) == EINVAL) { + printf("\n"); } if (pcmk__str_eq(attr_set_type, XML_TAG_ATTR_SETS, pcmk__str_casei)) { if (force == FALSE) { - rc = find_resource_attr(out, cib, XML_ATTR_ID, uber_parent(rsc)->id, + rc = find_resource_attr(cib, XML_ATTR_ID, uber_parent(rsc)->id, XML_TAG_META_SETS, attr_set, attr_id, attr_name, &local_attr_id); - if (rc == pcmk_rc_ok && !out->is_quiet(out)) { - out->err(out, "WARNING: There is already a meta attribute for '%s' called '%s' (id=%s)", - uber_parent(rsc)->id, attr_name, local_attr_id); - out->err(out, " Delete '%s' first or use the force option to override", - local_attr_id); + if (rc == pcmk_rc_ok && BE_QUIET == FALSE) { + printf("WARNING: There is already a meta attribute for '%s' called '%s' (id=%s)\n", + uber_parent(rsc)->id, attr_name, local_attr_id); + printf(" Delete '%s' first or use the force option to override\n", + local_attr_id); } free(local_attr_id); if (rc == pcmk_rc_ok) { @@ -302,7 +286,7 @@ cli_resource_update_attribute(pcmk__output_t *out, pe_resource_t *rsc, resources = g_list_append(resources, rsc); } else { - resources = find_matching_attr_resources(out, rsc, requested_name, attr_set, attr_set_type, + resources = find_matching_attr_resources(rsc, requested_name, attr_set, attr_set_type, attr_id, attr_name, cib, "update", force); } @@ -322,8 +306,8 @@ cli_resource_update_attribute(pcmk__output_t *out, pe_resource_t *rsc, attr_id = common_attr_id; lookup_id = clone_strip(rsc->id); /* Could be a cloned group! */ - rc = find_resource_attr(out, cib, XML_ATTR_ID, lookup_id, attr_set_type, - attr_set, attr_id, attr_name, &local_attr_id); + rc = find_resource_attr(cib, XML_ATTR_ID, lookup_id, attr_set_type, attr_set, attr_id, attr_name, + &local_attr_id); if (rc == pcmk_rc_ok) { crm_debug("Found a match for name=%s: id=%s", attr_name, local_attr_id); @@ -365,10 +349,10 @@ cli_resource_update_attribute(pcmk__output_t *out, pe_resource_t *rsc, rc = cib->cmds->modify(cib, XML_CIB_TAG_RESOURCES, xml_top, cib_options); rc = pcmk_legacy2rc(rc); - if (rc == pcmk_rc_ok && !out->is_quiet(out)) { - out->info(out, "Set '%s' option: id=%s%s%s%s%s value=%s", lookup_id, local_attr_id, - attr_set ? " set=" : "", attr_set ? attr_set : "", - attr_name ? " name=" : "", attr_name ? attr_name : "", attr_value); + if (rc == pcmk_rc_ok && BE_QUIET == FALSE) { + printf("Set '%s' option: id=%s%s%s%s%s value=%s\n", lookup_id, local_attr_id, + attr_set ? " set=" : "", attr_set ? attr_set : "", + attr_name ? " name=" : "", attr_name ? attr_name : "", attr_value); } free_xml(xml_top); @@ -386,20 +370,24 @@ cli_resource_update_attribute(pcmk__output_t *out, pe_resource_t *rsc, need_init = FALSE; unpack_constraints(cib_constraints, data_set); - pe__clear_resource_flags_on_all(data_set, pe_rsc_allocating); + for (lpc = data_set->resources; lpc != NULL; lpc = lpc->next) { + pe_resource_t *r = (pe_resource_t *) lpc->data; + + pe__clear_resource_flags(r, pe_rsc_allocating); + } } crm_debug("Looking for dependencies %p", rsc->rsc_cons_lhs); pe__set_resource_flags(rsc, pe_rsc_allocating); for (lpc = rsc->rsc_cons_lhs; lpc != NULL; lpc = lpc->next) { - pcmk__colocation_t *cons = (pcmk__colocation_t *) lpc->data; + rsc_colocation_t *cons = (rsc_colocation_t *) lpc->data; pe_resource_t *peer = cons->rsc_lh; crm_debug("Checking %s %d", cons->id, cons->score); if (cons->score > 0 && !pcmk_is_set(peer->flags, pe_rsc_allocating)) { /* Don't get into colocation loops */ crm_debug("Setting %s=%s for dependent resource %s", attr_name, attr_value, peer->id); - cli_resource_update_attribute(out, peer, peer->id, NULL, attr_set_type, + cli_resource_update_attribute(peer, peer->id, NULL, attr_set_type, NULL, attr_name, attr_value, recursive, cib, cib_options, data_set, force); } @@ -412,22 +400,23 @@ cli_resource_update_attribute(pcmk__output_t *out, pe_resource_t *rsc, // \return Standard Pacemaker return code int -cli_resource_delete_attribute(pcmk__output_t *out, pe_resource_t *rsc, - const char *requested_name, const char *attr_set, - const char *attr_set_type, const char *attr_id, - const char *attr_name, cib_t *cib, int cib_options, - pe_working_set_t *data_set, gboolean force) +cli_resource_delete_attribute(pe_resource_t *rsc, const char *requested_name, + const char *attr_set, const char *attr_set_type, + const char *attr_id, const char *attr_name, cib_t *cib, + int cib_options, pe_working_set_t *data_set, gboolean force) { int rc = pcmk_rc_ok; GList/**/ *resources = NULL; - if (attr_id == NULL && force == FALSE) { - find_resource_attr(out, cib, XML_ATTR_ID, uber_parent(rsc)->id, NULL, - NULL, NULL, attr_name, NULL); + if(attr_id == NULL + && force == FALSE + && find_resource_attr( + cib, XML_ATTR_ID, uber_parent(rsc)->id, NULL, NULL, NULL, attr_name, NULL) == EINVAL) { + printf("\n"); } if(pcmk__str_eq(attr_set_type, XML_TAG_META_SETS, pcmk__str_casei)) { - resources = find_matching_attr_resources(out, rsc, requested_name, attr_set, attr_set_type, + resources = find_matching_attr_resources(rsc, requested_name, attr_set, attr_set_type, attr_id, attr_name, cib, "delete", force); } else { resources = g_list_append(resources, rsc); @@ -441,8 +430,8 @@ cli_resource_delete_attribute(pcmk__output_t *out, pe_resource_t *rsc, rsc = (pe_resource_t*)gIter->data; lookup_id = clone_strip(rsc->id); - rc = find_resource_attr(out, cib, XML_ATTR_ID, lookup_id, attr_set_type, - attr_set, attr_id, attr_name, &local_attr_id); + rc = find_resource_attr(cib, XML_ATTR_ID, lookup_id, attr_set_type, attr_set, attr_id, attr_name, + &local_attr_id); if (rc == ENXIO) { free(lookup_id); @@ -466,10 +455,10 @@ cli_resource_delete_attribute(pcmk__output_t *out, pe_resource_t *rsc, rc = cib->cmds->remove(cib, XML_CIB_TAG_RESOURCES, xml_obj, cib_options); rc = pcmk_legacy2rc(rc); - if (rc == pcmk_rc_ok && !out->is_quiet(out)) { - out->info(out, "Deleted '%s' option: id=%s%s%s%s%s", lookup_id, local_attr_id, - attr_set ? " set=" : "", attr_set ? attr_set : "", - attr_name ? " name=" : "", attr_name ? attr_name : ""); + if (rc == pcmk_rc_ok && BE_QUIET == FALSE) { + printf("Deleted '%s' option: id=%s%s%s%s%s\n", lookup_id, local_attr_id, + attr_set ? " set=" : "", attr_set ? attr_set : "", + attr_name ? " name=" : "", attr_name ? attr_name : ""); } free(lookup_id); @@ -482,8 +471,9 @@ cli_resource_delete_attribute(pcmk__output_t *out, pe_resource_t *rsc, // \return Standard Pacemaker return code static int -send_lrm_rsc_op(pcmk__output_t *out, pcmk_ipc_api_t *controld_api, bool do_fail_resource, - const char *host_uname, const char *rsc_id, pe_working_set_t *data_set) +send_lrm_rsc_op(pcmk_ipc_api_t *controld_api, bool do_fail_resource, + const char *host_uname, const char *rsc_id, + pe_working_set_t *data_set) { const char *router_node = host_uname; const char *rsc_api_id = NULL; @@ -495,11 +485,11 @@ send_lrm_rsc_op(pcmk__output_t *out, pcmk_ipc_api_t *controld_api, bool do_fail_ pe_resource_t *rsc = pe_find_resource(data_set->resources, rsc_id); if (rsc == NULL) { - out->err(out, "Resource %s not found", rsc_id); + CMD_ERR("Resource %s not found", rsc_id); return ENXIO; } else if (rsc->variant != pe_native) { - out->err(out, "We can only process primitive resources, not %s", rsc_id); + CMD_ERR("We can only process primitive resources, not %s", rsc_id); return EINVAL; } @@ -507,21 +497,25 @@ send_lrm_rsc_op(pcmk__output_t *out, pcmk_ipc_api_t *controld_api, bool do_fail_ rsc_provider = crm_element_value(rsc->xml, XML_AGENT_ATTR_PROVIDER), rsc_type = crm_element_value(rsc->xml, XML_ATTR_TYPE); if ((rsc_class == NULL) || (rsc_type == NULL)) { - out->err(out, "Resource %s does not have a class and type", rsc_id); + CMD_ERR("Resource %s does not have a class and type", rsc_id); return EINVAL; } - { + if (host_uname == NULL) { + CMD_ERR("Please specify a node name"); + return EINVAL; + + } else { pe_node_t *node = pe_find_node(data_set->nodes, host_uname); if (node == NULL) { - out->err(out, "Node %s not found", host_uname); + CMD_ERR("Node %s not found", host_uname); return pcmk_rc_node_unknown; } if (!(node->details->online)) { if (do_fail_resource) { - out->err(out, "Node %s is not online", host_uname); + CMD_ERR("Node %s is not online", host_uname); return ENOTCONN; } else { cib_only = true; @@ -530,8 +524,8 @@ send_lrm_rsc_op(pcmk__output_t *out, pcmk_ipc_api_t *controld_api, bool do_fail_ if (!cib_only && pe__is_guest_or_remote_node(node)) { node = pe__current_node(node->details->remote_rsc); if (node == NULL) { - out->err(out, "No cluster connection to Pacemaker Remote node %s detected", - host_uname); + CMD_ERR("No cluster connection to Pacemaker Remote node %s detected", + host_uname); return ENOTCONN; } router_node = node->details->uname; @@ -574,9 +568,8 @@ rsc_fail_name(pe_resource_t *rsc) // \return Standard Pacemaker return code static int -clear_rsc_history(pcmk__output_t *out, pcmk_ipc_api_t *controld_api, - const char *host_uname, const char *rsc_id, - pe_working_set_t *data_set) +clear_rsc_history(pcmk_ipc_api_t *controld_api, const char *host_uname, + const char *rsc_id, pe_working_set_t *data_set) { int rc = pcmk_rc_ok; @@ -585,7 +578,7 @@ clear_rsc_history(pcmk__output_t *out, pcmk_ipc_api_t *controld_api, * single operation, we might wind up with a wrong idea of the current * resource state, and we might not re-probe the resource. */ - rc = send_lrm_rsc_op(out, controld_api, false, host_uname, rsc_id, data_set); + rc = send_lrm_rsc_op(controld_api, false, host_uname, rsc_id, data_set); if (rc != pcmk_rc_ok) { return rc; } @@ -601,8 +594,8 @@ clear_rsc_history(pcmk__output_t *out, pcmk_ipc_api_t *controld_api, // \return Standard Pacemaker return code static int -clear_rsc_failures(pcmk__output_t *out, pcmk_ipc_api_t *controld_api, - const char *node_name, const char *rsc_id, const char *operation, +clear_rsc_failures(pcmk_ipc_api_t *controld_api, const char *node_name, + const char *rsc_id, const char *operation, const char *interval_spec, pe_working_set_t *data_set) { int rc = pcmk_rc_ok; @@ -674,7 +667,7 @@ clear_rsc_failures(pcmk__output_t *out, pcmk_ipc_api_t *controld_api, g_hash_table_iter_init(&iter, rscs); while (g_hash_table_iter_next(&iter, (gpointer *) &failed_id, NULL)) { crm_debug("Erasing failures of %s on %s", failed_id, node_name); - rc = clear_rsc_history(out, controld_api, node_name, failed_id, data_set); + rc = clear_rsc_history(controld_api, node_name, failed_id, data_set); if (rc != pcmk_rc_ok) { return rc; } @@ -704,8 +697,8 @@ clear_rsc_fail_attrs(pe_resource_t *rsc, const char *operation, // \return Standard Pacemaker return code int -cli_resource_delete(pcmk__output_t *out, pcmk_ipc_api_t *controld_api, - const char *host_uname, pe_resource_t *rsc, const char *operation, +cli_resource_delete(pcmk_ipc_api_t *controld_api, const char *host_uname, + pe_resource_t *rsc, const char *operation, const char *interval_spec, bool just_failures, pe_working_set_t *data_set, gboolean force) { @@ -721,7 +714,7 @@ cli_resource_delete(pcmk__output_t *out, pcmk_ipc_api_t *controld_api, for (lpc = rsc->children; lpc != NULL; lpc = lpc->next) { pe_resource_t *child = (pe_resource_t *) lpc->data; - rc = cli_resource_delete(out, controld_api, host_uname, child, operation, + rc = cli_resource_delete(controld_api, host_uname, child, operation, interval_spec, just_failures, data_set, force); if (rc != pcmk_rc_ok) { @@ -756,7 +749,7 @@ cli_resource_delete(pcmk__output_t *out, pcmk_ipc_api_t *controld_api, node = (pe_node_t *) lpc->data; if (node->details->online) { - rc = cli_resource_delete(out, controld_api, node->details->uname, + rc = cli_resource_delete(controld_api, node->details->uname, rsc, operation, interval_spec, just_failures, data_set, force); } @@ -773,58 +766,58 @@ cli_resource_delete(pcmk__output_t *out, pcmk_ipc_api_t *controld_api, node = pe_find_node(data_set->nodes, host_uname); if (node == NULL) { - out->err(out, "Unable to clean up %s because node %s not found", - rsc->id, host_uname); + printf("Unable to clean up %s because node %s not found\n", + rsc->id, host_uname); return ENODEV; } if (!node->details->rsc_discovery_enabled) { - out->err(out, "Unable to clean up %s because resource discovery disabled on %s", - rsc->id, host_uname); + printf("Unable to clean up %s because resource discovery disabled on %s\n", + rsc->id, host_uname); return EOPNOTSUPP; } if (controld_api == NULL) { - out->err(out, "Dry run: skipping clean-up of %s on %s due to CIB_file", - rsc->id, host_uname); + printf("Dry run: skipping clean-up of %s on %s due to CIB_file\n", + rsc->id, host_uname); return pcmk_rc_ok; } rc = clear_rsc_fail_attrs(rsc, operation, interval_spec, node); if (rc != pcmk_rc_ok) { - out->err(out, "Unable to clean up %s failures on %s: %s", - rsc->id, host_uname, pcmk_rc_str(rc)); + printf("Unable to clean up %s failures on %s: %s\n", + rsc->id, host_uname, pcmk_rc_str(rc)); return rc; } if (just_failures) { - rc = clear_rsc_failures(out, controld_api, host_uname, rsc->id, operation, + rc = clear_rsc_failures(controld_api, host_uname, rsc->id, operation, interval_spec, data_set); } else { - rc = clear_rsc_history(out, controld_api, host_uname, rsc->id, data_set); + rc = clear_rsc_history(controld_api, host_uname, rsc->id, data_set); } if (rc != pcmk_rc_ok) { - out->err(out, "Cleaned %s failures on %s, but unable to clean history: %s", - rsc->id, host_uname, pcmk_strerror(rc)); + printf("Cleaned %s failures on %s, but unable to clean history: %s\n", + rsc->id, host_uname, pcmk_strerror(rc)); } else { - out->info(out, "Cleaned up %s on %s", rsc->id, host_uname); + printf("Cleaned up %s on %s\n", rsc->id, host_uname); } return rc; } // \return Standard Pacemaker return code int -cli_cleanup_all(pcmk__output_t *out, pcmk_ipc_api_t *controld_api, - const char *node_name, const char *operation, - const char *interval_spec, pe_working_set_t *data_set) +cli_cleanup_all(pcmk_ipc_api_t *controld_api, const char *node_name, + const char *operation, const char *interval_spec, + pe_working_set_t *data_set) { int rc = pcmk_rc_ok; int attr_options = pcmk__node_attr_none; const char *display_name = node_name? node_name : "all nodes"; if (controld_api == NULL) { - out->info(out, "Dry run: skipping clean-up of %s due to CIB_file", - display_name); + printf("Dry run: skipping clean-up of %s due to CIB_file\n", + display_name); return rc; } @@ -832,7 +825,7 @@ cli_cleanup_all(pcmk__output_t *out, pcmk_ipc_api_t *controld_api, pe_node_t *node = pe_find_node(data_set->nodes, node_name); if (node == NULL) { - out->err(out, "Unknown node: %s", node_name); + CMD_ERR("Unknown node: %s", node_name); return ENXIO; } if (pe__is_guest_or_remote_node(node)) { @@ -843,98 +836,132 @@ cli_cleanup_all(pcmk__output_t *out, pcmk_ipc_api_t *controld_api, rc = pcmk__node_attr_request_clear(NULL, node_name, NULL, operation, interval_spec, NULL, attr_options); if (rc != pcmk_rc_ok) { - out->err(out, "Unable to clean up all failures on %s: %s", - display_name, pcmk_rc_str(rc)); + printf("Unable to clean up all failures on %s: %s\n", + display_name, pcmk_rc_str(rc)); return rc; } if (node_name) { - rc = clear_rsc_failures(out, controld_api, node_name, NULL, + rc = clear_rsc_failures(controld_api, node_name, NULL, operation, interval_spec, data_set); if (rc != pcmk_rc_ok) { - out->err(out, "Cleaned all resource failures on %s, but unable to clean history: %s", - node_name, pcmk_strerror(rc)); + printf("Cleaned all resource failures on %s, but unable to clean history: %s\n", + node_name, pcmk_strerror(rc)); return rc; } } else { for (GList *iter = data_set->nodes; iter; iter = iter->next) { pe_node_t *node = (pe_node_t *) iter->data; - rc = clear_rsc_failures(out, controld_api, node->details->uname, NULL, + rc = clear_rsc_failures(controld_api, node->details->uname, NULL, operation, interval_spec, data_set); if (rc != pcmk_rc_ok) { - out->err(out, "Cleaned all resource failures on all nodes, but unable to clean history: %s", - pcmk_strerror(rc)); + printf("Cleaned all resource failures on all nodes, but unable to clean history: %s\n", + pcmk_strerror(rc)); return rc; } } } - out->info(out, "Cleaned up all resources on %s", display_name); + printf("Cleaned up all resources on %s\n", display_name); return rc; } -int -cli_resource_check(pcmk__output_t *out, cib_t * cib_conn, pe_resource_t *rsc) +void +cli_resource_check(cib_t * cib_conn, pe_resource_t *rsc) { + bool printed = false; char *role_s = NULL; char *managed = NULL; pe_resource_t *parent = uber_parent(rsc); - int rc = pcmk_rc_no_output; - resource_checks_t *checks = NULL; - find_resource_attr(out, cib_conn, XML_NVPAIR_ATTR_VALUE, parent->id, + find_resource_attr(cib_conn, XML_NVPAIR_ATTR_VALUE, parent->id, NULL, NULL, NULL, XML_RSC_ATTR_MANAGED, &managed); - find_resource_attr(out, cib_conn, XML_NVPAIR_ATTR_VALUE, parent->id, + find_resource_attr(cib_conn, XML_NVPAIR_ATTR_VALUE, parent->id, NULL, NULL, NULL, XML_RSC_ATTR_TARGET_ROLE, &role_s); - checks = cli_check_resource(rsc, role_s, managed); + if(role_s) { + enum rsc_role_e role = text2role(role_s); + + free(role_s); + if(role == RSC_ROLE_UNKNOWN) { + // Treated as if unset + + } else if(role == RSC_ROLE_STOPPED) { + printf("\n * Configuration specifies '%s' should remain stopped\n", + parent->id); + printed = true; - if (checks->flags != 0 || checks->lock_node != NULL) { - rc = out->message(out, "resource-check-list", checks); + } else if (pcmk_is_set(parent->flags, pe_rsc_promotable) + && (role == RSC_ROLE_SLAVE)) { + printf("\n * Configuration specifies '%s' should not be promoted\n", + parent->id); + printed = true; + } } - free(role_s); + if (managed && !crm_is_true(managed)) { + printf("%s * Configuration prevents cluster from stopping or starting unmanaged '%s'\n", + (printed? "" : "\n"), parent->id); + printed = true; + } free(managed); - free(checks); - return rc; + + if (rsc->lock_node) { + printf("%s * '%s' is locked to node %s due to shutdown\n", + (printed? "" : "\n"), parent->id, rsc->lock_node->details->uname); + } + + if (printed) { + printf("\n"); + } } // \return Standard Pacemaker return code int -cli_resource_fail(pcmk__output_t *out, pcmk_ipc_api_t *controld_api, - const char *host_uname, const char *rsc_id, - pe_working_set_t *data_set) +cli_resource_fail(pcmk_ipc_api_t *controld_api, const char *host_uname, + const char *rsc_id, pe_working_set_t *data_set) { crm_notice("Failing %s on %s", rsc_id, host_uname); - return send_lrm_rsc_op(out, controld_api, true, host_uname, rsc_id, data_set); + return send_lrm_rsc_op(controld_api, true, host_uname, rsc_id, data_set); } static GHashTable * -generate_resource_params(pe_resource_t *rsc, pe_node_t *node, - pe_working_set_t *data_set) +generate_resource_params(pe_resource_t * rsc, pe_working_set_t * data_set) { GHashTable *params = NULL; GHashTable *meta = NULL; GHashTable *combined = NULL; GHashTableIter iter; - char *key = NULL; - char *value = NULL; + if (!rsc) { + crm_err("Resource does not exist in config"); + return NULL; + } + + params = crm_str_table_new(); + meta = crm_str_table_new(); combined = crm_str_table_new(); - params = pe_rsc_params(rsc, node, data_set); - if (params != NULL) { + get_rsc_attributes(params, rsc, NULL /* TODO: Pass in local node */ , data_set); + get_meta_attributes(meta, rsc, NULL /* TODO: Pass in local node */ , data_set); + + if (params) { + char *key = NULL; + char *value = NULL; + g_hash_table_iter_init(&iter, params); while (g_hash_table_iter_next(&iter, (gpointer *) & key, (gpointer *) & value)) { g_hash_table_insert(combined, strdup(key), strdup(value)); } + g_hash_table_destroy(params); } - meta = crm_str_table_new(); - get_meta_attributes(meta, rsc, node, data_set); - if (meta != NULL) { + if (meta) { + char *key = NULL; + char *value = NULL; + g_hash_table_iter_init(&iter, meta); while (g_hash_table_iter_next(&iter, (gpointer *) & key, (gpointer *) & value)) { char *crm_name = crm_meta_name(key); @@ -947,7 +974,7 @@ generate_resource_params(pe_resource_t *rsc, pe_node_t *node, return combined; } -bool resource_is_running_on(pe_resource_t *rsc, const char *host) +static bool resource_is_running_on(pe_resource_t *rsc, const char *host) { bool found = TRUE; GListPtr hIter = NULL; @@ -1028,12 +1055,12 @@ static void dump_list(GList *items, const char *tag) } } -static void display_list(pcmk__output_t *out, GList *items, const char *tag) +static void display_list(GList *items, const char *tag) { GList *item = NULL; for (item = items; item != NULL; item = item->next) { - out->info(out, "%s%s", tag, (const char *)item->data); + fprintf(stdout, "%s%s\n", tag, (const char *)item->data); } } @@ -1076,8 +1103,7 @@ update_working_set_xml(pe_working_set_t *data_set, xmlNode **xml) * data_set->input and data_set->now. */ static int -update_working_set_from_cib(pcmk__output_t *out, pe_working_set_t * data_set, - cib_t *cib) +update_working_set_from_cib(pe_working_set_t * data_set, cib_t *cib) { xmlNode *cib_xml_copy = NULL; int rc = pcmk_rc_ok; @@ -1086,12 +1112,12 @@ update_working_set_from_cib(pcmk__output_t *out, pe_working_set_t * data_set, rc = pcmk_legacy2rc(rc); if (rc != pcmk_rc_ok) { - out->err(out, "Could not obtain the current CIB: %s (%d)", pcmk_strerror(rc), rc); + fprintf(stderr, "Could not obtain the current CIB: %s (%d)\n", pcmk_strerror(rc), rc); return rc; } rc = update_working_set_xml(data_set, &cib_xml_copy); if (rc != pcmk_rc_ok) { - out->err(out, "Could not upgrade the current CIB XML"); + fprintf(stderr, "Could not upgrade the current CIB XML\n"); free_xml(cib_xml_copy); return rc; } @@ -1101,8 +1127,7 @@ update_working_set_from_cib(pcmk__output_t *out, pe_working_set_t * data_set, // \return Standard Pacemaker return code static int -update_dataset(pcmk__output_t *out, cib_t *cib, pe_working_set_t * data_set, - bool simulate) +update_dataset(cib_t *cib, pe_working_set_t * data_set, bool simulate) { char *pid = NULL; char *shadow_file = NULL; @@ -1110,7 +1135,7 @@ update_dataset(pcmk__output_t *out, cib_t *cib, pe_working_set_t * data_set, int rc = pcmk_rc_ok; pe_reset_working_set(data_set); - rc = update_working_set_from_cib(out, data_set, cib); + rc = update_working_set_from_cib(data_set, cib); if (rc != pcmk_rc_ok) { return rc; } @@ -1121,7 +1146,7 @@ update_dataset(pcmk__output_t *out, cib_t *cib, pe_working_set_t * data_set, shadow_file = get_shadow_file(pid); if (shadow_cib == NULL) { - out->err(out, "Could not create shadow cib: '%s'", pid); + fprintf(stderr, "Could not create shadow cib: '%s'\n", pid); rc = ENXIO; goto cleanup; } @@ -1129,7 +1154,7 @@ update_dataset(pcmk__output_t *out, cib_t *cib, pe_working_set_t * data_set, rc = write_xml_file(data_set->input, shadow_file, FALSE); if (rc < 0) { - out->err(out, "Could not populate shadow cib: %s (%d)", pcmk_strerror(rc), rc); + fprintf(stderr, "Could not populate shadow cib: %s (%d)\n", pcmk_strerror(rc), rc); goto cleanup; } @@ -1137,13 +1162,13 @@ update_dataset(pcmk__output_t *out, cib_t *cib, pe_working_set_t * data_set, rc = pcmk_legacy2rc(rc); if (rc != pcmk_rc_ok) { - out->err(out, "Could not connect to shadow cib: %s (%d)", pcmk_strerror(rc), rc); + fprintf(stderr, "Could not connect to shadow cib: %s (%d)\n", pcmk_strerror(rc), rc); goto cleanup; } pcmk__schedule_actions(data_set, data_set->input, NULL); run_simulation(data_set, shadow_cib, NULL, TRUE); - rc = update_dataset(out, shadow_cib, data_set, FALSE); + rc = update_dataset(shadow_cib, data_set, FALSE); } else { cluster_status(data_set); @@ -1235,9 +1260,9 @@ max_delay_in(pe_working_set_t * data_set, GList *resources) * \return Standard Pacemaker return code (exits on certain failures) */ int -cli_resource_restart(pcmk__output_t *out, pe_resource_t *rsc, const char *host, - const char *move_lifetime, int timeout_ms, cib_t *cib, - int cib_options, gboolean promoted_role_only, gboolean force) +cli_resource_restart(pe_resource_t *rsc, const char *host, const char *move_lifetime, + int timeout_ms, cib_t *cib, int cib_options, + gboolean promoted_role_only, gboolean force) { int rc = pcmk_rc_ok; int lpc = 0; @@ -1260,9 +1285,9 @@ cli_resource_restart(pcmk__output_t *out, pe_resource_t *rsc, const char *host, if(resource_is_running_on(rsc, host) == FALSE) { const char *id = rsc->clone_name?rsc->clone_name:rsc->id; if(host) { - out->err(out, "%s is not running on %s and so cannot be restarted", id, host); + printf("%s is not running on %s and so cannot be restarted\n", id, host); } else { - out->err(out, "%s is not running anywhere and so cannot be restarted", id); + printf("%s is not running anywhere and so cannot be restarted\n", id); } return ENXIO; } @@ -1297,9 +1322,9 @@ cli_resource_restart(pcmk__output_t *out, pe_resource_t *rsc, const char *host, goto done; } pe__set_working_set_flags(data_set, pe_flag_no_counts|pe_flag_no_compat); - rc = update_dataset(out, cib, data_set, FALSE); + rc = update_dataset(cib, data_set, FALSE); if(rc != pcmk_rc_ok) { - out->err(out, "Could not get new resource list: %s (%d)", pcmk_strerror(rc), rc); + fprintf(stdout, "Could not get new resource list: %s (%d)\n", pcmk_strerror(rc), rc); goto done; } @@ -1310,8 +1335,8 @@ cli_resource_restart(pcmk__output_t *out, pe_resource_t *rsc, const char *host, if (stop_via_ban) { /* Stop the clone or bundle instance by banning it from the host */ - out->quiet = true; - rc = cli_resource_ban(out, rsc_id, host, move_lifetime, NULL, cib, + BE_QUIET = TRUE; + rc = cli_resource_ban(rsc_id, host, move_lifetime, NULL, cib, cib_options, promoted_role_only); } else { @@ -1321,16 +1346,16 @@ cli_resource_restart(pcmk__output_t *out, pe_resource_t *rsc, const char *host, */ char *lookup_id = clone_strip(rsc->id); - find_resource_attr(out, cib, XML_NVPAIR_ATTR_VALUE, lookup_id, NULL, NULL, + find_resource_attr(cib, XML_NVPAIR_ATTR_VALUE, lookup_id, NULL, NULL, NULL, XML_RSC_ATTR_TARGET_ROLE, &orig_target_role); free(lookup_id); - rc = cli_resource_update_attribute(out, rsc, rsc_id, NULL, XML_TAG_META_SETS, - NULL, XML_RSC_ATTR_TARGET_ROLE, + rc = cli_resource_update_attribute(rsc, rsc_id, NULL, XML_TAG_META_SETS, NULL, + XML_RSC_ATTR_TARGET_ROLE, RSC_STOPPED, FALSE, cib, cib_options, data_set, force); } if(rc != pcmk_rc_ok) { - out->err(out, "Could not set target-role for %s: %s (%d)", rsc_id, pcmk_strerror(rc), rc); + fprintf(stderr, "Could not set target-role for %s: %s (%d)\n", rsc_id, pcmk_strerror(rc), rc); if (current_active) { g_list_free_full(current_active, free); } @@ -1340,9 +1365,9 @@ cli_resource_restart(pcmk__output_t *out, pe_resource_t *rsc, const char *host, goto done; } - rc = update_dataset(out, cib, data_set, TRUE); + rc = update_dataset(cib, data_set, TRUE); if(rc != pcmk_rc_ok) { - out->err(out, "Could not determine which resources would be stopped"); + fprintf(stderr, "Could not determine which resources would be stopped\n"); goto failure; } @@ -1350,8 +1375,8 @@ cli_resource_restart(pcmk__output_t *out, pe_resource_t *rsc, const char *host, dump_list(target_active, "Target"); list_delta = pcmk__subtract_lists(current_active, target_active, (GCompareFunc) strcmp); - out->info(out, "Waiting for %d resources to stop:", g_list_length(list_delta)); - display_list(out, list_delta, " * "); + fprintf(stdout, "Waiting for %d resources to stop:\n", g_list_length(list_delta)); + display_list(list_delta, " * "); step_timeout_s = timeout / sleep_interval; while (list_delta != NULL) { @@ -1367,9 +1392,9 @@ cli_resource_restart(pcmk__output_t *out, pe_resource_t *rsc, const char *host, timeout -= sleep_interval; crm_trace("%ds remaining", timeout); } - rc = update_dataset(out, cib, data_set, FALSE); + rc = update_dataset(cib, data_set, FALSE); if(rc != pcmk_rc_ok) { - out->err(out, "Could not determine which resources were stopped"); + fprintf(stderr, "Could not determine which resources were stopped\n"); goto failure; } @@ -1386,8 +1411,8 @@ cli_resource_restart(pcmk__output_t *out, pe_resource_t *rsc, const char *host, crm_trace("%d (was %d) resources remaining", g_list_length(list_delta), before); if(before == g_list_length(list_delta)) { /* aborted during stop phase, print the contents of list_delta */ - out->info(out, "Could not complete shutdown of %s, %d resources remaining", rsc_id, g_list_length(list_delta)); - display_list(out, list_delta, " * "); + fprintf(stderr, "Could not complete shutdown of %s, %d resources remaining\n", rsc_id, g_list_length(list_delta)); + display_list(list_delta, " * "); rc = ETIME; goto failure; } @@ -1398,20 +1423,20 @@ cli_resource_restart(pcmk__output_t *out, pe_resource_t *rsc, const char *host, rc = cli_resource_clear(rsc_id, host, NULL, cib, cib_options, TRUE, force); } else if (orig_target_role) { - rc = cli_resource_update_attribute(out, rsc, rsc_id, NULL, XML_TAG_META_SETS, + rc = cli_resource_update_attribute(rsc, rsc_id, NULL, XML_TAG_META_SETS, NULL, XML_RSC_ATTR_TARGET_ROLE, orig_target_role, FALSE, cib, cib_options, data_set, force); free(orig_target_role); orig_target_role = NULL; } else { - rc = cli_resource_delete_attribute(out, rsc, rsc_id, NULL, XML_TAG_META_SETS, - NULL, XML_RSC_ATTR_TARGET_ROLE, cib, + rc = cli_resource_delete_attribute(rsc, rsc_id, NULL, XML_TAG_META_SETS, NULL, + XML_RSC_ATTR_TARGET_ROLE, cib, cib_options, data_set, force); } if(rc != pcmk_rc_ok) { - out->err(out, "Could not unset target-role for %s: %s (%d)", rsc_id, pcmk_strerror(rc), rc); + fprintf(stderr, "Could not unset target-role for %s: %s (%d)\n", rsc_id, pcmk_strerror(rc), rc); goto done; } @@ -1420,8 +1445,8 @@ cli_resource_restart(pcmk__output_t *out, pe_resource_t *rsc, const char *host, } target_active = restart_target_active; list_delta = pcmk__subtract_lists(target_active, current_active, (GCompareFunc) strcmp); - out->info(out, "Waiting for %d resources to start again:", g_list_length(list_delta)); - display_list(out, list_delta, " * "); + fprintf(stdout, "Waiting for %d resources to start again:\n", g_list_length(list_delta)); + display_list(list_delta, " * "); step_timeout_s = timeout / sleep_interval; while (waiting_for_starts(list_delta, rsc, host)) { @@ -1439,9 +1464,9 @@ cli_resource_restart(pcmk__output_t *out, pe_resource_t *rsc, const char *host, crm_trace("%ds remaining", timeout); } - rc = update_dataset(out, cib, data_set, FALSE); + rc = update_dataset(cib, data_set, FALSE); if(rc != pcmk_rc_ok) { - out->err(out, "Could not determine which resources were started"); + fprintf(stderr, "Could not determine which resources were started\n"); goto failure; } @@ -1461,8 +1486,8 @@ cli_resource_restart(pcmk__output_t *out, pe_resource_t *rsc, const char *host, if(before == g_list_length(list_delta)) { /* aborted during start phase, print the contents of list_delta */ - out->info(out, "Could not complete restart of %s, %d resources remaining", rsc_id, g_list_length(list_delta)); - display_list(out, list_delta, " * "); + fprintf(stdout, "Could not complete restart of %s, %d resources remaining\n", rsc_id, g_list_length(list_delta)); + display_list(list_delta, " * "); rc = ETIME; goto failure; } @@ -1476,12 +1501,12 @@ cli_resource_restart(pcmk__output_t *out, pe_resource_t *rsc, const char *host, if (stop_via_ban) { cli_resource_clear(rsc_id, host, NULL, cib, cib_options, TRUE, force); } else if (orig_target_role) { - cli_resource_update_attribute(out, rsc, rsc_id, NULL, XML_TAG_META_SETS, NULL, + cli_resource_update_attribute(rsc, rsc_id, NULL, XML_TAG_META_SETS, NULL, XML_RSC_ATTR_TARGET_ROLE, orig_target_role, FALSE, cib, cib_options, data_set, force); free(orig_target_role); } else { - cli_resource_delete_attribute(out, rsc, rsc_id, NULL, XML_TAG_META_SETS, NULL, + cli_resource_delete_attribute(rsc, rsc_id, NULL, XML_TAG_META_SETS, NULL, XML_RSC_ATTR_TARGET_ROLE, cib, cib_options, data_set, force); } @@ -1537,23 +1562,29 @@ actions_are_pending(GListPtr actions) return FALSE; } +/*! + * \internal + * \brief Print pending actions to stderr + * + * \param[in] actions List of actions to check + * + * \return void + */ static void -print_pending_actions(pcmk__output_t *out, GListPtr actions) +print_pending_actions(GListPtr actions) { GListPtr action; - out->info(out, "Pending actions:"); + fprintf(stderr, "Pending actions:\n"); for (action = actions; action != NULL; action = action->next) { pe_action_t *a = (pe_action_t *) action->data; - if (!action_is_pending(a)) { - continue; - } - - if (a->node) { - out->info(out, "\tAction %d: %s\ton %s", a->id, a->uuid, a->node->details->uname); - } else { - out->info(out, "\tAction %d: %s", a->id, a->uuid); + if (action_is_pending(a)) { + fprintf(stderr, "\tAction %d: %s", a->id, a->uuid); + if (a->node) { + fprintf(stderr, "\ton %s", a->node->details->uname); + } + fprintf(stderr, "\n"); } } } @@ -1579,14 +1610,14 @@ print_pending_actions(pcmk__output_t *out, GListPtr actions) * \return Standard Pacemaker return code */ int -wait_till_stable(pcmk__output_t *out, int timeout_ms, cib_t * cib) +wait_till_stable(int timeout_ms, cib_t * cib) { pe_working_set_t *data_set = NULL; int rc = pcmk_rc_ok; int timeout_s = timeout_ms? ((timeout_ms + 999) / 1000) : WAIT_DEFAULT_TIMEOUT_S; time_t expire_time = time(NULL) + timeout_s; time_t time_diff; - bool printed_version_warning = out->is_quiet(out); // i.e. don't print if quiet + bool printed_version_warning = BE_QUIET; // i.e. don't print if quiet data_set = pe_new_working_set(); if (data_set == NULL) { @@ -1601,7 +1632,7 @@ wait_till_stable(pcmk__output_t *out, int timeout_ms, cib_t * cib) if (time_diff > 0) { crm_info("Waiting up to %ld seconds for cluster actions to complete", time_diff); } else { - print_pending_actions(out, data_set->actions); + print_pending_actions(data_set->actions); pe_free_working_set(data_set); return ETIME; } @@ -1611,7 +1642,7 @@ wait_till_stable(pcmk__output_t *out, int timeout_ms, cib_t * cib) /* Get latest transition graph */ pe_reset_working_set(data_set); - rc = update_working_set_from_cib(out, data_set, cib); + rc = update_working_set_from_cib(data_set, cib); if (rc != pcmk_rc_ok) { pe_free_working_set(data_set); return rc; @@ -1631,8 +1662,8 @@ wait_till_stable(pcmk__output_t *out, int timeout_ms, cib_t * cib) "dc-version"); if (!pcmk__str_eq(dc_version, PACEMAKER_VERSION "-" BUILD_VERSION, pcmk__str_casei)) { - out->info(out, "warning: wait option may not work properly in " - "mixed-version cluster"); + printf("warning: wait option may not work properly in " + "mixed-version cluster\n"); printed_version_warning = TRUE; } } @@ -1644,19 +1675,19 @@ wait_till_stable(pcmk__output_t *out, int timeout_ms, cib_t * cib) } crm_exit_t -cli_resource_execute_from_params(pcmk__output_t *out, const char *rsc_name, - const char *rsc_class, const char *rsc_prov, - const char *rsc_type, const char *action, - GHashTable *params, GHashTable *override_hash, - int timeout_ms, int resource_verbose, gboolean force) +cli_resource_execute_from_params(const char *rsc_name, const char *rsc_class, + const char *rsc_prov, const char *rsc_type, + const char *action, GHashTable *params, + GHashTable *override_hash, int timeout_ms, + int resource_verbose, gboolean force) { GHashTable *params_copy = NULL; crm_exit_t exit_code = CRM_EX_OK; svc_action_t *op = NULL; if (pcmk__str_eq(rsc_class, PCMK_RESOURCE_CLASS_STONITH, pcmk__str_casei)) { - out->err(out, "Sorry, the %s option doesn't support %s resources yet", - action, rsc_class); + CMD_ERR("Sorry, the %s option doesn't support %s resources yet", + action, rsc_class); crm_exit(CRM_EX_UNIMPLEMENT_FEATURE); } @@ -1718,31 +1749,59 @@ cli_resource_execute_from_params(pcmk__output_t *out, const char *rsc_name, g_hash_table_iter_init(&iter, override_hash); while (g_hash_table_iter_next(&iter, (gpointer *) & name, (gpointer *) & value)) { - out->info(out, "Overriding the cluster configuration for '%s' with '%s' = '%s'", - rsc_name, name, value); + printf("Overriding the cluster configuration for '%s' with '%s' = '%s'\n", + rsc_name, name, value); g_hash_table_replace(op->params, strdup(name), strdup(value)); } } if (services_action_sync(op)) { + int more, lpc, last; + char *local_copy = NULL; + exit_code = op->rc; if (op->status == PCMK_LRM_OP_DONE) { - out->info(out, "Operation %s for %s (%s:%s:%s) returned: '%s' (%d)", - action, rsc_name, rsc_class, rsc_prov ? rsc_prov : "", rsc_type, - services_ocf_exitcode_str(op->rc), op->rc); + printf("Operation %s for %s (%s:%s:%s) returned: '%s' (%d)\n", + action, rsc_name, rsc_class, rsc_prov ? rsc_prov : "", rsc_type, + services_ocf_exitcode_str(op->rc), op->rc); } else { - out->info(out, "Operation %s for %s (%s:%s:%s) failed: '%s' (%d)", - action, rsc_name, rsc_class, rsc_prov ? rsc_prov : "", rsc_type, - services_lrm_status_str(op->status), op->status); + printf("Operation %s for %s (%s:%s:%s) failed: '%s' (%d)\n", + action, rsc_name, rsc_class, rsc_prov ? rsc_prov : "", rsc_type, + services_lrm_status_str(op->status), op->status); } /* hide output for validate-all if not in verbose */ if (resource_verbose == 0 && pcmk__str_eq(action, "validate-all", pcmk__str_casei)) goto done; - if (op->stdout_data || op->stderr_data) { - out->subprocess_output(out, op->rc, op->stdout_data, op->stderr_data); + if (op->stdout_data) { + local_copy = strdup(op->stdout_data); + more = strlen(local_copy); + last = 0; + + for (lpc = 0; lpc < more; lpc++) { + if (local_copy[lpc] == '\n' || local_copy[lpc] == 0) { + local_copy[lpc] = 0; + printf(" > stdout: %s\n", local_copy + last); + last = lpc + 1; + } + } + free(local_copy); + } + if (op->stderr_data) { + local_copy = strdup(op->stderr_data); + more = strlen(local_copy); + last = 0; + + for (lpc = 0; lpc < more; lpc++) { + if (local_copy[lpc] == '\n' || local_copy[lpc] == 0) { + local_copy[lpc] = 0; + printf(" > stderr: %s\n", local_copy + last); + last = lpc + 1; + } + } + free(local_copy); } } else { exit_code = op->rc == 0 ? CRM_EX_ERROR : op->rc; @@ -1756,10 +1815,9 @@ done: } crm_exit_t -cli_resource_execute(pcmk__output_t *out, pe_resource_t *rsc, - const char *requested_name, const char *rsc_action, - GHashTable *override_hash, int timeout_ms, - cib_t * cib, pe_working_set_t *data_set, +cli_resource_execute(pe_resource_t *rsc, const char *requested_name, + const char *rsc_action, GHashTable *override_hash, + int timeout_ms, cib_t * cib, pe_working_set_t *data_set, int resource_verbose, gboolean force) { crm_exit_t exit_code = CRM_EX_OK; @@ -1784,13 +1842,13 @@ cli_resource_execute(pcmk__output_t *out, pe_resource_t *rsc, action = rsc_action+6; if(pe_rsc_is_clone(rsc)) { - GListPtr rscs = cli_resource_search(out, rsc, requested_name, data_set); - if(rscs != NULL && force == FALSE) { - out->err(out, "It is not safe to %s %s here: the cluster claims it is already active", - action, rsc->id); - out->err(out, "Try setting target-role=Stopped first or specifying " - "the force option"); - return CRM_EX_UNSAFE; + int rc = cli_resource_search(rsc, requested_name, data_set); + if(rc > 0 && force == FALSE) { + CMD_ERR("It is not safe to %s %s here: the cluster claims it is already active", + action, rsc->id); + CMD_ERR("Try setting target-role=Stopped first or specifying " + "the force option"); + crm_exit(CRM_EX_UNSAFE); } } @@ -1804,16 +1862,16 @@ cli_resource_execute(pcmk__output_t *out, pe_resource_t *rsc, } if(rsc->variant == pe_group) { - out->err(out, "Sorry, the %s option doesn't support group resources", rsc_action); - return CRM_EX_UNIMPLEMENT_FEATURE; + CMD_ERR("Sorry, the %s option doesn't support group resources", + rsc_action); + crm_exit(CRM_EX_UNIMPLEMENT_FEATURE); } rclass = crm_element_value(rsc->xml, XML_AGENT_ATTR_CLASS); rprov = crm_element_value(rsc->xml, XML_AGENT_ATTR_PROVIDER); rtype = crm_element_value(rsc->xml, XML_ATTR_TYPE); - params = generate_resource_params(rsc, NULL /* @TODO use local node */, - data_set); + params = generate_resource_params(rsc, data_set); if (timeout_ms == 0) { timeout_ms = pe_get_configured_timeout(rsc, action, data_set); @@ -1821,7 +1879,7 @@ cli_resource_execute(pcmk__output_t *out, pe_resource_t *rsc, rid = pe_rsc_is_anon_clone(rsc->parent)? requested_name : rsc->id; - exit_code = cli_resource_execute_from_params(out, rid, rclass, rprov, rtype, action, + exit_code = cli_resource_execute_from_params(rid, rclass, rprov, rtype, action, params, override_hash, timeout_ms, resource_verbose, force); return exit_code; @@ -1829,10 +1887,10 @@ cli_resource_execute(pcmk__output_t *out, pe_resource_t *rsc, // \return Standard Pacemaker return code int -cli_resource_move(pcmk__output_t *out, pe_resource_t *rsc, const char *rsc_id, - const char *host_name, const char *move_lifetime, cib_t *cib, - int cib_options, pe_working_set_t *data_set, - gboolean promoted_role_only, gboolean force) +cli_resource_move(pe_resource_t *rsc, const char *rsc_id, const char *host_name, + const char *move_lifetime, cib_t *cib, int cib_options, + pe_working_set_t *data_set, gboolean promoted_role_only, + gboolean force) { int rc = pcmk_rc_ok; unsigned int count = 0; @@ -1848,12 +1906,12 @@ cli_resource_move(pcmk__output_t *out, pe_resource_t *rsc, const char *rsc_id, pe_resource_t *p = uber_parent(rsc); if (pcmk_is_set(p->flags, pe_rsc_promotable)) { - out->info(out, "Using parent '%s' for move instead of '%s'.", rsc->id, rsc_id); + CMD_ERR("Using parent '%s' for move instead of '%s'.", rsc->id, rsc_id); rsc_id = p->id; rsc = p; } else { - out->info(out, "Ignoring master option: %s is not promotable", rsc_id); + CMD_ERR("Ignoring master option: %s is not promotable", rsc_id); promoted_role_only = FALSE; } } @@ -1908,7 +1966,7 @@ cli_resource_move(pcmk__output_t *out, pe_resource_t *rsc, const char *rsc_id, cib_options, TRUE, force); /* Record an explicit preference for 'dest' */ - rc = cli_resource_prefer(out, rsc_id, dest->details->uname, move_lifetime, + rc = cli_resource_prefer(rsc_id, dest->details->uname, move_lifetime, cib, cib_options, promoted_role_only); crm_trace("%s%s now prefers node %s%s", @@ -1920,17 +1978,17 @@ cli_resource_move(pcmk__output_t *out, pe_resource_t *rsc, const char *rsc_id, if(force && (cur_is_dest == FALSE)) { /* Ban the original location if possible */ if(current) { - (void)cli_resource_ban(out, rsc_id, current->details->uname, move_lifetime, + (void)cli_resource_ban(rsc_id, current->details->uname, move_lifetime, NULL, cib, cib_options, promoted_role_only); } else if(count > 1) { - out->info(out, "Resource '%s' is currently %s in %d locations. " - "One may now move to %s", - rsc_id, (promoted_role_only? "promoted" : "active"), - count, dest->details->uname); - out->info(out, "To prevent '%s' from being %s at a specific location, " - "specify a node.", - rsc_id, (promoted_role_only? "promoted" : "active")); + CMD_ERR("Resource '%s' is currently %s in %d locations. " + "One may now move to %s", + rsc_id, (promoted_role_only? "promoted" : "active"), + count, dest->details->uname); + CMD_ERR("To prevent '%s' from being %s at a specific location, " + "specify a node.", + rsc_id, (promoted_role_only? "promoted" : "active")); } else { crm_trace("Not banning %s from its current location: not active", rsc_id); @@ -1939,3 +1997,97 @@ cli_resource_move(pcmk__output_t *out, pe_resource_t *rsc, const char *rsc_id, return rc; } + +static void +cli_resource_why_without_rsc_and_host(cib_t *cib_conn,GListPtr resources) +{ + GListPtr lpc = NULL; + GListPtr hosts = NULL; + + for (lpc = resources; lpc != NULL; lpc = lpc->next) { + pe_resource_t *rsc = (pe_resource_t *) lpc->data; + rsc->fns->location(rsc, &hosts, TRUE); + + if (hosts == NULL) { + printf("Resource %s is not running\n", rsc->id); + } else { + printf("Resource %s is running\n", rsc->id); + } + + cli_resource_check(cib_conn, rsc); + g_list_free(hosts); + hosts = NULL; + } + +} + +static void +cli_resource_why_with_rsc_and_host(cib_t *cib_conn, GListPtr resources, + pe_resource_t *rsc, const char *host_uname) +{ + if (resource_is_running_on(rsc, host_uname)) { + printf("Resource %s is running on host %s\n",rsc->id,host_uname); + } else { + printf("Resource %s is not running on host %s\n", rsc->id, host_uname); + } + cli_resource_check(cib_conn, rsc); +} + +static void +cli_resource_why_without_rsc_with_host(cib_t *cib_conn,GListPtr resources,pe_node_t *node) +{ + const char* host_uname = node->details->uname; + GListPtr allResources = node->details->allocated_rsc; + GListPtr activeResources = node->details->running_rsc; + GListPtr unactiveResources = pcmk__subtract_lists(allResources,activeResources,(GCompareFunc) strcmp); + GListPtr lpc = NULL; + + for (lpc = activeResources; lpc != NULL; lpc = lpc->next) { + pe_resource_t *rsc = (pe_resource_t *) lpc->data; + printf("Resource %s is running on host %s\n",rsc->id,host_uname); + cli_resource_check(cib_conn,rsc); + } + + for(lpc = unactiveResources; lpc != NULL; lpc = lpc->next) { + pe_resource_t *rsc = (pe_resource_t *) lpc->data; + printf("Resource %s is assigned to host %s but not running\n", + rsc->id, host_uname); + cli_resource_check(cib_conn,rsc); + } + + g_list_free(allResources); + g_list_free(activeResources); + g_list_free(unactiveResources); +} + +static void +cli_resource_why_with_rsc_without_host(cib_t *cib_conn, GListPtr resources, + pe_resource_t *rsc) +{ + GListPtr hosts = NULL; + + rsc->fns->location(rsc, &hosts, TRUE); + printf("Resource %s is %srunning\n", rsc->id, (hosts? "" : "not ")); + cli_resource_check(cib_conn, rsc); + g_list_free(hosts); +} + +void cli_resource_why(cib_t *cib_conn, GListPtr resources, pe_resource_t *rsc, + pe_node_t *node) +{ + const char *host_uname = (node == NULL)? NULL : node->details->uname; + + if ((rsc == NULL) && (host_uname == NULL)) { + cli_resource_why_without_rsc_and_host(cib_conn, resources); + + } else if ((rsc != NULL) && (host_uname != NULL)) { + cli_resource_why_with_rsc_and_host(cib_conn, resources, rsc, + host_uname); + + } else if ((rsc == NULL) && (host_uname != NULL)) { + cli_resource_why_without_rsc_with_host(cib_conn, resources, node); + + } else if ((rsc != NULL) && (host_uname == NULL)) { + cli_resource_why_with_rsc_without_host(cib_conn, resources, rsc); + } +} diff --git a/tools/crm_rule.c b/tools/crm_rule.c index 2871f3d..0e44828 100644 --- a/tools/crm_rule.c +++ b/tools/crm_rule.c @@ -75,31 +75,6 @@ mode_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError **e return TRUE; } -/*! - * \internal - * \brief Evaluate a date expression for a specific time - * - * \param[in] time_expr date_expression XML - * \param[in] now Time for which to evaluate expression - * \param[out] next_change If not NULL, set to when evaluation will change - * - * \return Standard Pacemaker return code - */ -static int -eval_date_expression(xmlNode *expr, crm_time_t *now, crm_time_t *next_change) -{ - pe_rule_eval_data_t rule_data = { - .node_hash = NULL, - .role = RSC_ROLE_UNKNOWN, - .now = now, - .match_data = NULL, - .rsc_data = NULL, - .op_data = NULL - }; - - return pe__eval_date_expr(expr, &rule_data, next_change); -} - static int crm_rule_check(pe_working_set_t *data_set, const char *rule_id, crm_time_t *effective_date) { @@ -181,7 +156,7 @@ crm_rule_check(pe_working_set_t *data_set, const char *rule_id, crm_time_t *effe CRM_ASSERT(match != NULL); CRM_ASSERT(find_expression_type(match) == time_expr); - rc = eval_date_expression(match, effective_date, NULL); + rc = pe_eval_date_expression(match, effective_date, NULL); if (rc == pcmk_rc_within_range) { printf("Rule %s is still in effect\n", rule_id); diff --git a/tools/crmadmin.c b/tools/crmadmin.c index 2d9d663..0b87d01 100644 --- a/tools/crmadmin.c +++ b/tools/crmadmin.c @@ -16,13 +16,33 @@ #include // gboolean, GMainLoop, etc. #include // xmlNode -#include - +#include +#include +#include #include -#include +#include +#include +#include +#include +#include #define SUMMARY "query and manage the Pacemaker controller" +#define DEFAULT_MESSAGE_TIMEOUT_MS 30000 + +static guint message_timer_id = 0; +static guint message_timeout_ms = DEFAULT_MESSAGE_TIMEOUT_MS; +static GMainLoop *mainloop = NULL; + +bool need_controld_api = true; +bool need_pacemakerd_api = false; + +bool do_work(pcmk_ipc_api_t *api); +void do_find_node_list(xmlNode *xml_node); +static char *ipc_name = NULL; + +gboolean admin_message_timeout(gpointer data); + static enum { cmd_none, cmd_shutdown, @@ -33,17 +53,18 @@ static enum { cmd_pacemakerd_health, } command = cmd_none; +static gboolean BE_VERBOSE = FALSE; +static gboolean BASH_EXPORT = FALSE; +static gboolean BE_SILENT = FALSE; +static char *dest_node = NULL; +static crm_exit_t exit_code = CRM_EX_OK; + + struct { + gboolean quiet; gboolean health; gint timeout; - char *dest_node; - char *ipc_name; - gboolean BASH_EXPORT; -} options = { - .dest_node = NULL, - .ipc_name = NULL, - .BASH_EXPORT = FALSE -}; +} options; gboolean command_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError **error); @@ -93,11 +114,11 @@ static GOptionEntry additional_options[] = { "\n operation failed", NULL }, - { "bash-export", 'B', 0, G_OPTION_ARG_NONE, &options.BASH_EXPORT, + { "bash-export", 'B', 0, G_OPTION_ARG_NONE, &BASH_EXPORT, "Display nodes as shell commands of the form 'export uname=uuid'" "\n (valid with -N/--nodes)", }, - { "ipc-name", 'i', 0, G_OPTION_ARG_STRING, &options.ipc_name, + { "ipc-name", 'i', 0, G_OPTION_ARG_STRING, &ipc_name, "Name to use for ipc instead of 'crmadmin' (with -P/--pacemakerd).", NULL }, @@ -115,6 +136,8 @@ command_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError if (!strcmp(option_name, "--pacemakerd") || !strcmp(option_name, "-P")) { command = cmd_pacemakerd_health; + need_pacemakerd_api = true; + need_controld_api = false; } if (!strcmp(option_name, "--dc_lookup") || !strcmp(option_name, "-D")) { @@ -123,6 +146,7 @@ command_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError if (!strcmp(option_name, "--nodes") || !strcmp(option_name, "-N")) { command = cmd_list_nodes; + need_controld_api = false; } if (!strcmp(option_name, "--election") || !strcmp(option_name, "-E")) { @@ -135,36 +159,223 @@ command_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError } if (optarg) { - if (options.dest_node != NULL) { - free(options.dest_node); + if (dest_node != NULL) { + free(dest_node); } - options.dest_node = strdup(optarg); + dest_node = strdup(optarg); } return TRUE; } -static pcmk__supported_format_t formats[] = { - PCMK__SUPPORTED_FORMAT_TEXT, - PCMK__SUPPORTED_FORMAT_XML, - { NULL, NULL, NULL } -}; +static void +quit_main_loop(crm_exit_t ec) +{ + exit_code = ec; + if (mainloop != NULL) { + GMainLoop *mloop = mainloop; + + mainloop = NULL; // Don't re-enter this block + pcmk_quit_main_loop(mloop, 10); + g_main_loop_unref(mloop); + } +} + +static void +controller_event_cb(pcmk_ipc_api_t *controld_api, + enum pcmk_ipc_event event_type, crm_exit_t status, + void *event_data, void *user_data) +{ + pcmk_controld_api_reply_t *reply = event_data; + + switch (event_type) { + case pcmk_ipc_event_disconnect: + if (exit_code == CRM_EX_DISCONNECT) { // Unexpected + fprintf(stderr, "error: Lost connection to controller\n"); + } + goto done; + break; + + case pcmk_ipc_event_reply: + break; + + default: + return; + } + + if (message_timer_id != 0) { + g_source_remove(message_timer_id); + message_timer_id = 0; + } + + if (status != CRM_EX_OK) { + fprintf(stderr, "error: Bad reply from controller: %s", + crm_exit_str(status)); + exit_code = status; + goto done; + } + + if (reply->reply_type != pcmk_controld_reply_ping) { + fprintf(stderr, "error: Unknown reply type %d from controller\n", + reply->reply_type); + goto done; + } + + // Parse desired information from reply + switch (command) { + case cmd_health: + printf("Status of %s@%s: %s (%s)\n", + reply->data.ping.sys_from, + reply->host_from, + reply->data.ping.fsa_state, + reply->data.ping.result); + if (BE_SILENT && (reply->data.ping.fsa_state != NULL)) { + fprintf(stderr, "%s\n", reply->data.ping.fsa_state); + } + exit_code = CRM_EX_OK; + break; + + case cmd_whois_dc: + printf("Designated Controller is: %s\n", reply->host_from); + if (BE_SILENT && (reply->host_from != NULL)) { + fprintf(stderr, "%s\n", reply->host_from); + } + exit_code = CRM_EX_OK; + break; + + default: // Not really possible here + exit_code = CRM_EX_SOFTWARE; + break; + } + +done: + pcmk_disconnect_ipc(controld_api); + quit_main_loop(exit_code); +} + +static void +pacemakerd_event_cb(pcmk_ipc_api_t *pacemakerd_api, + enum pcmk_ipc_event event_type, crm_exit_t status, + void *event_data, void *user_data) +{ + pcmk_pacemakerd_api_reply_t *reply = event_data; + + switch (event_type) { + case pcmk_ipc_event_disconnect: + if (exit_code == CRM_EX_DISCONNECT) { // Unexpected + fprintf(stderr, "error: Lost connection to pacemakerd\n"); + } + goto done; + break; + + case pcmk_ipc_event_reply: + break; + + default: + return; + } + + if (message_timer_id != 0) { + g_source_remove(message_timer_id); + message_timer_id = 0; + } + + if (status != CRM_EX_OK) { + fprintf(stderr, "error: Bad reply from pacemakerd: %s", + crm_exit_str(status)); + exit_code = status; + goto done; + } + + if (reply->reply_type != pcmk_pacemakerd_reply_ping) { + fprintf(stderr, "error: Unknown reply type %d from pacemakerd\n", + reply->reply_type); + goto done; + } + + // Parse desired information from reply + switch (command) { + case cmd_pacemakerd_health: + { + crm_time_t *crm_when = crm_time_new(NULL); + char *pinged_buf = NULL; + + crm_time_set_timet(crm_when, &reply->data.ping.last_good); + pinged_buf = crm_time_as_string(crm_when, + crm_time_log_date | crm_time_log_timeofday | + crm_time_log_with_timezone); + + printf("Status of %s: '%s' %s %s\n", + reply->data.ping.sys_from, + (reply->data.ping.status == pcmk_rc_ok)? + pcmk_pacemakerd_api_daemon_state_enum2text( + reply->data.ping.state):"query failed", + (reply->data.ping.status == pcmk_rc_ok)?"last updated":"", + (reply->data.ping.status == pcmk_rc_ok)?pinged_buf:""); + if (BE_SILENT && + (reply->data.ping.state != pcmk_pacemakerd_state_invalid)) { + fprintf(stderr, "%s\n", + (reply->data.ping.status == pcmk_rc_ok)? + pcmk_pacemakerd_api_daemon_state_enum2text( + reply->data.ping.state): + "query failed"); + } + exit_code = CRM_EX_OK; + free(pinged_buf); + } + break; + + default: // Not really possible here + exit_code = CRM_EX_SOFTWARE; + break; + } + +done: + pcmk_disconnect_ipc(pacemakerd_api); + quit_main_loop(exit_code); +} + +// \return Standard Pacemaker return code +static int +list_nodes() +{ + cib_t *the_cib = cib_new(); + xmlNode *output = NULL; + int rc; + + if (the_cib == NULL) { + return ENOMEM; + } + rc = the_cib->cmds->signon(the_cib, crm_system_name, cib_command); + if (rc != pcmk_ok) { + return pcmk_legacy2rc(rc); + } + + rc = the_cib->cmds->query(the_cib, NULL, &output, + cib_scope_local | cib_sync_call); + if (rc == pcmk_ok) { + do_find_node_list(output); + free_xml(output); + } + the_cib->cmds->signoff(the_cib); + return pcmk_legacy2rc(rc); +} static GOptionContext * -build_arg_context(pcmk__common_args_t *args, GOptionGroup **group) { +build_arg_context(pcmk__common_args_t *args) { GOptionContext *context = NULL; const char *description = "Report bugs to users@clusterlabs.org"; GOptionEntry extra_prog_entries[] = { - { "quiet", 'q', 0, G_OPTION_ARG_NONE, &(args->quiet), + { "quiet", 'q', 0, G_OPTION_ARG_NONE, &options.quiet, "Display only the essential query information", NULL }, { NULL } }; - context = pcmk__build_arg_context(args, "text (default), xml", group, NULL); + context = pcmk__build_arg_context(args, NULL, NULL, NULL); g_option_context_set_description(context, description); /* Add the -q option, which cannot be part of the globally supported options @@ -182,21 +393,18 @@ build_arg_context(pcmk__common_args_t *args, GOptionGroup **group) { int main(int argc, char **argv) { - pcmk__output_t *out = NULL; - crm_exit_t exit_code = CRM_EX_OK; - int rc; int argerr = 0; + int rc; pcmk_ipc_api_t *controld_api = NULL; + pcmk_ipc_api_t *pacemakerd_api = NULL; pcmk__common_args_t *args = pcmk__new_common_args(SUMMARY); GError *error = NULL; GOptionContext *context = NULL; - GOptionGroup *output_group = NULL; gchar **processed_args = NULL; - context = build_arg_context(args, &output_group); - pcmk__register_formats(output_group, formats); + context = build_arg_context(args); crm_log_cli_init("crmadmin"); @@ -209,32 +417,28 @@ main(int argc, char **argv) } for (int i = 0; i < args->verbosity; i++) { + BE_VERBOSE = TRUE; crm_bump_log_level(argc, argv); } - rc = pcmk__output_new(&out, args->output_ty, args->output_dest, argv); - if (rc != pcmk_rc_ok) { - fprintf(stderr, "Error creating output format %s: %s\n", - args->output_ty, pcmk_rc_str(rc)); - exit_code = CRM_EX_ERROR; - goto done; + if (args->version) { + /* FIXME: When crmadmin is converted to use formatted output, this can go. */ + pcmk__cli_help('v', CRM_EX_USAGE); } - out->quiet = args->quiet; - - pcmk__register_lib_messages(out); - - if (!pcmk__force_args(context, &error, "%s --xml-simple-list --xml-substitute", g_get_prgname())) { - goto done; + if (options.timeout) { + message_timeout_ms = (guint) options.timeout; + if (message_timeout_ms < 1) { + message_timeout_ms = DEFAULT_MESSAGE_TIMEOUT_MS; + } } - if (args->version) { - out->version(out, false); - goto done; + if (options.quiet) { + BE_SILENT = TRUE; } if (options.health) { - out->err(out, "Cluster-wide health option not supported"); + fprintf(stderr, "Cluster-wide health option not supported\n"); ++argerr; } @@ -243,46 +447,64 @@ main(int argc, char **argv) } if (command == cmd_none) { - out->err(out, "error: Must specify a command option"); + fprintf(stderr, "error: Must specify a command option\n\n"); ++argerr; } if (argerr) { char *help = g_option_context_get_help(context, TRUE, NULL); - out->err(out, "%s", help); + fprintf(stderr, "%s", help); g_free(help); exit_code = CRM_EX_USAGE; goto done; } - switch (command) { - case cmd_health: - rc = pcmk__controller_status(out, options.dest_node, options.timeout); - break; - case cmd_pacemakerd_health: - rc = pcmk__pacemakerd_status(out, options.ipc_name, options.timeout); - break; - case cmd_list_nodes: - rc = pcmk__list_nodes(out, options.BASH_EXPORT); - break; - case cmd_whois_dc: - rc = pcmk__designated_controller(out, options.timeout); - break; - case cmd_shutdown: - rc = pcmk__shutdown_controller(out, options.dest_node); - break; - case cmd_elect_dc: - rc = pcmk__start_election(out); - break; - case cmd_none: - rc = pcmk_rc_error; - break; + // Connect to the controller if needed + if (need_controld_api) { + rc = pcmk_new_ipc_api(&controld_api, pcmk_ipc_controld); + if (controld_api == NULL) { + fprintf(stderr, "error: Could not connect to controller: %s\n", + pcmk_rc_str(rc)); + exit_code = pcmk_rc2exitc(rc); + goto done; + } + pcmk_register_ipc_callback(controld_api, controller_event_cb, NULL); + rc = pcmk_connect_ipc(controld_api, pcmk_ipc_dispatch_main); + if (rc != pcmk_rc_ok) { + fprintf(stderr, "error: Could not connect to controller: %s\n", + pcmk_rc_str(rc)); + exit_code = pcmk_rc2exitc(rc); + goto done; + } } - if (rc != pcmk_rc_ok) { - out->err(out, "error: Command failed: %s", pcmk_rc_str(rc)); - exit_code = pcmk_rc2exitc(rc); + // Connect to pacemakerd if needed + if (need_pacemakerd_api) { + rc = pcmk_new_ipc_api(&pacemakerd_api, pcmk_ipc_pacemakerd); + if (pacemakerd_api == NULL) { + fprintf(stderr, "error: Could not connect to pacemakerd: %s\n", + pcmk_rc_str(rc)); + exit_code = pcmk_rc2exitc(rc); + goto done; + } + pcmk_register_ipc_callback(pacemakerd_api, pacemakerd_event_cb, NULL); + rc = pcmk_connect_ipc(pacemakerd_api, pcmk_ipc_dispatch_main); + if (rc != pcmk_rc_ok) { + fprintf(stderr, "error: Could not connect to pacemakerd: %s\n", + pcmk_rc_str(rc)); + exit_code = pcmk_rc2exitc(rc); + goto done; + } + } + + if (do_work(controld_api?controld_api:pacemakerd_api)) { + // A reply is needed from controller, so run main loop to get it + exit_code = CRM_EX_DISCONNECT; // For unexpected disconnects + mainloop = g_main_loop_new(NULL, FALSE); + message_timer_id = g_timeout_add(message_timeout_ms, + admin_message_timeout, NULL); + g_main_loop_run(mainloop); } done: @@ -293,13 +515,104 @@ done: pcmk_free_ipc_api(capi); } + if (pacemakerd_api != NULL) { + pcmk_ipc_api_t *capi = pacemakerd_api; + pacemakerd_api = NULL; // Ensure we can't free this twice + pcmk_free_ipc_api(capi); + } + + if (mainloop != NULL) { + g_main_loop_unref(mainloop); + mainloop = NULL; + } g_strfreev(processed_args); g_clear_error(&error); pcmk__free_arg_context(context); - if (out != NULL) { - out->finish(out, exit_code, true, NULL); - pcmk__output_free(out); - } return crm_exit(exit_code); } + +// \return True if reply from controller is needed +bool +do_work(pcmk_ipc_api_t *api) +{ + bool need_reply = false; + int rc = pcmk_rc_ok; + + switch (command) { + case cmd_shutdown: + rc = pcmk_controld_api_shutdown(api, dest_node); + break; + + case cmd_health: // dest_node != NULL + case cmd_whois_dc: // dest_node == NULL + rc = pcmk_controld_api_ping(api, dest_node); + need_reply = true; + break; + + case cmd_elect_dc: + rc = pcmk_controld_api_start_election(api); + break; + + case cmd_list_nodes: + rc = list_nodes(); + break; + + case cmd_pacemakerd_health: + rc = pcmk_pacemakerd_api_ping(api, ipc_name); + need_reply = true; + break; + + case cmd_none: // not actually possible here + break; + } + if (rc != pcmk_rc_ok) { + fprintf(stderr, "error: Command failed: %s", pcmk_rc_str(rc)); + exit_code = pcmk_rc2exitc(rc); + } + return need_reply; +} + +gboolean +admin_message_timeout(gpointer data) +{ + fprintf(stderr, + "error: No reply received from controller before timeout (%dms)\n", + message_timeout_ms); + message_timer_id = 0; + quit_main_loop(CRM_EX_TIMEOUT); + return FALSE; // Tells glib to remove source +} + +void +do_find_node_list(xmlNode * xml_node) +{ + int found = 0; + xmlNode *node = NULL; + xmlNode *nodes = get_object_root(XML_CIB_TAG_NODES, xml_node); + + for (node = first_named_child(nodes, XML_CIB_TAG_NODE); node != NULL; + node = crm_next_same_xml(node)) { + + if (BASH_EXPORT) { + printf("export %s=%s\n", + crm_element_value(node, XML_ATTR_UNAME), + crm_element_value(node, XML_ATTR_ID)); + } else { + const char *node_type = crm_element_value(node, XML_ATTR_TYPE); + + if (node_type == NULL) { + node_type = "member"; + } + printf("%s node: %s (%s)\n", node_type, + crm_element_value(node, XML_ATTR_UNAME), + crm_element_value(node, XML_ATTR_ID)); + } + found++; + } + // @TODO List Pacemaker Remote nodes that don't have a entry + + if (found == 0) { + printf("No nodes configured\n"); + } +} diff --git a/xml/Makefile.am b/xml/Makefile.am index ac906bb..c045522 100644 --- a/xml/Makefile.am +++ b/xml/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2004-2021 the Pacemaker project contributors +# Copyright 2004-2019 the Pacemaker project contributors # # The version control history for this file may have further details. # @@ -44,25 +44,14 @@ version_pairs_last = $(wordlist \ ),$(1),$(2) \ ) -# NOTE: All files in API_request_base, CIB_cfg_base, API_base, and CIB_base -# need to start with a unique prefix. These variables all get iterated over -# and globbed, and two files starting with the same prefix will cause -# problems. - # Names of API schemas that form the choices for pacemaker-result content -API_request_base = command-output \ - crm_mon \ - crm_resource \ - crmadmin \ - digests \ - stonith_admin \ - version +API_request_base = command-output crm_mon stonith_admin version # Names of CIB schemas that form the choices for cib/configuration content CIB_cfg_base = options nodes resources constraints fencing acls tags alerts # Names of all schemas (including top level and those included by others) -API_base = $(API_request_base) fence-event generic-list item resources status +API_base = $(API_request_base) fence-event item status CIB_base = cib $(CIB_cfg_base) status score rule nvset # Static schema files and transforms (only CIB has transforms) diff --git a/xml/api/crm_mon-2.4.rng b/xml/api/crm_mon-2.4.rng deleted file mode 100644 index 88973a4..0000000 --- a/xml/api/crm_mon-2.4.rng +++ /dev/null @@ -1,311 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - unknown - member - remote - ping - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - granted - revoked - - - - - - - - - - - - - - - - - - - diff --git a/xml/api/crm_resource-2.4.rng b/xml/api/crm_resource-2.4.rng deleted file mode 100644 index 1bcb969..0000000 --- a/xml/api/crm_resource-2.4.rng +++ /dev/null @@ -1,255 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - promoted - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ocf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - false - - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - needs - with - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xml/api/crm_resource-2.6.rng b/xml/api/crm_resource-2.6.rng deleted file mode 100644 index b49e24c..0000000 --- a/xml/api/crm_resource-2.6.rng +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - promoted - - - - - - - - - - - - - - - - - - - - - - - - - - - ocf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - false - - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Stopped - Started - Master - Slave - - - diff --git a/xml/api/crmadmin-2.4.rng b/xml/api/crmadmin-2.4.rng deleted file mode 100644 index 34c9ca4..0000000 --- a/xml/api/crmadmin-2.4.rng +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - unknown - member - remote - ping - - - - - - - - diff --git a/xml/api/digests-2.6.rng b/xml/api/digests-2.6.rng deleted file mode 100644 index 7e843d4..0000000 --- a/xml/api/digests-2.6.rng +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xml/api/generic-list-2.4.rng b/xml/api/generic-list-2.4.rng deleted file mode 100644 index fee93a9..0000000 --- a/xml/api/generic-list-2.4.rng +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/xml/api/resources-2.4.rng b/xml/api/resources-2.4.rng deleted file mode 100644 index e279583..0000000 --- a/xml/api/resources-2.4.rng +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - docker - rkt - podman - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xml/constraints-3.6.rng b/xml/constraints-3.6.rng deleted file mode 100644 index fece6b0..0000000 --- a/xml/constraints-3.6.rng +++ /dev/null @@ -1,259 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - group - listed - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - stop - demote - fence - freeze - - - - - - - - - always - never - exclusive - - - - - - start - promote - demote - stop - - - - - - Stopped - Started - Master - Slave - - - - - - Optional - Mandatory - Serialize - - - - - - - - - - - -