From 6a5513120944e9bf0c6977e980acc8834981c8f8 Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Mon, 10 Feb 2025 09:39:48 -0500 Subject: [PATCH 1/4] API: libcrmcommon: Map pcmk_rc_cib_corrupt to CRM_EX_CONFIG. --- lib/common/results.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/common/results.c b/lib/common/results.c index 359d1eeccc1..226ba40c5bd 100644 --- a/lib/common/results.c +++ b/lib/common/results.c @@ -1,5 +1,5 @@ /* - * Copyright 2004-2024 the Pacemaker project contributors + * Copyright 2004-2025 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -822,6 +822,7 @@ pcmk_rc2exitc(int rc) case pcmk_rc_old_data: return CRM_EX_OLD; + case pcmk_rc_cib_corrupt: case pcmk_rc_schema_validation: case pcmk_rc_transform_failed: case pcmk_rc_unpack_error: From 6731ec9fd2ed208e6f6f8d4953d1d3beeedba0cc Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Fri, 7 Feb 2025 12:59:58 -0500 Subject: [PATCH 2/4] Med: cts: Add missing crm_simulate regression tests back to cts-cli. These were dropped during the conversion from shell to python. --- cts/cli/regression.crm_simulate.exp | 806 ++++++++++++++++++++++++++++ cts/cts-cli.in | 89 ++- 2 files changed, 893 insertions(+), 2 deletions(-) create mode 100644 cts/cli/regression.crm_simulate.exp diff --git a/cts/cli/regression.crm_simulate.exp b/cts/cli/regression.crm_simulate.exp new file mode 100644 index 00000000000..cc442403a1a --- /dev/null +++ b/cts/cli/regression.crm_simulate.exp @@ -0,0 +1,806 @@ +=#=#=#= Begin test: Show allocation scores with crm_simulate =#=#=#= + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +=#=#=#= End test: Show allocation scores with crm_simulate - OK (0) =#=#=#= +* Passed: crm_simulate - Show allocation scores with crm_simulate +=#=#=#= Begin test: Show utilization with crm_simulate =#=#=#= +4 of 32 resource instances DISABLED and 0 BLOCKED from further action due to failure + +Current cluster status: + * Node List: + * Online: [ cluster01 cluster02 ] + * GuestOnline: [ httpd-bundle-0 httpd-bundle-1 ] + + * Full List of Resources: + * Clone Set: ping-clone [ping]: + * Started: [ cluster01 cluster02 ] + * Fencing (stonith:fence_xvm): Started cluster01 + * dummy (ocf:pacemaker:Dummy): Started cluster02 + * Clone Set: inactive-clone [inactive-dhcpd] (disabled): + * Stopped (disabled): [ cluster01 cluster02 ] + * Resource Group: inactive-group (disabled): + * inactive-dummy-1 (ocf:pacemaker:Dummy): Stopped (disabled) + * inactive-dummy-2 (ocf:pacemaker:Dummy): Stopped (disabled) + * Container bundle set: httpd-bundle [pcmk:http]: + * httpd-bundle-0 (192.168.122.131) (ocf:heartbeat:apache): Started cluster01 + * httpd-bundle-1 (192.168.122.132) (ocf:heartbeat:apache): Started cluster02 + * httpd-bundle-2 (192.168.122.133) (ocf:heartbeat:apache): Stopped + * Resource Group: exim-group: + * Public-IP (ocf:heartbeat:IPaddr): Started cluster02 + * Email (lsb:exim): Started cluster02 + * Clone Set: mysql-clone-group [mysql-group]: + * Started: [ cluster01 cluster02 ] + * Clone Set: promotable-clone [promotable-rsc] (promotable): + * Promoted: [ cluster02 ] + * Unpromoted: [ cluster01 ] + +Utilization Information: +Only 'private' parameters to 1m-interval monitor for dummy on cluster02 changed: 0:0;16:2:0:4a9e64d6-e1dd-4395-917c-1596312eafe4 + * Original: cluster01 capacity: + * Original: cluster02 capacity: + * pcmk__assign_resource: ping:0 utilization on cluster02: + * pcmk__assign_resource: ping:1 utilization on cluster01: + * pcmk__assign_resource: Fencing utilization on cluster01: + * pcmk__assign_resource: dummy utilization on cluster02: + * pcmk__assign_resource: httpd-bundle-docker-0 utilization on cluster01: + * pcmk__assign_resource: httpd-bundle-docker-1 utilization on cluster02: + * pcmk__assign_resource: httpd-bundle-ip-192.168.122.131 utilization on cluster01: + * pcmk__assign_resource: httpd-bundle-0 utilization on cluster01: + * pcmk__assign_resource: httpd:0 utilization on httpd-bundle-0: + * pcmk__assign_resource: httpd-bundle-ip-192.168.122.132 utilization on cluster02: + * pcmk__assign_resource: httpd-bundle-1 utilization on cluster02: + * pcmk__assign_resource: httpd:1 utilization on httpd-bundle-1: + * pcmk__assign_resource: httpd-bundle-2 utilization on cluster01: + * pcmk__assign_resource: httpd:2 utilization on httpd-bundle-2: + * pcmk__assign_resource: Public-IP utilization on cluster02: + * pcmk__assign_resource: Email utilization on cluster02: + * pcmk__assign_resource: mysql-proxy:0 utilization on cluster02: + * pcmk__assign_resource: mysql-proxy:1 utilization on cluster01: + * pcmk__assign_resource: promotable-rsc:0 utilization on cluster02: + * pcmk__assign_resource: promotable-rsc:1 utilization on cluster01: + * Remaining: cluster01 capacity: + * Remaining: cluster02 capacity: + +Transition Summary: + * Start httpd-bundle-2 ( cluster01 ) due to unrunnable httpd-bundle-docker-2 start (blocked) + * Start httpd:2 ( httpd-bundle-2 ) due to unrunnable httpd-bundle-docker-2 start (blocked) +=#=#=#= End test: Show utilization with crm_simulate - OK (0) =#=#=#= +* Passed: crm_simulate - Show utilization with crm_simulate +=#=#=#= Begin test: Simulate injecting a failure =#=#=#= +4 of 32 resource instances DISABLED and 0 BLOCKED from further action due to failure + +Current cluster status: + * Node List: + * Online: [ cluster01 cluster02 ] + * GuestOnline: [ httpd-bundle-0 httpd-bundle-1 ] + + * Full List of Resources: + * Clone Set: ping-clone [ping]: + * Started: [ cluster01 cluster02 ] + * Fencing (stonith:fence_xvm): Started cluster01 + * dummy (ocf:pacemaker:Dummy): Started cluster02 + * Clone Set: inactive-clone [inactive-dhcpd] (disabled): + * Stopped (disabled): [ cluster01 cluster02 ] + * Resource Group: inactive-group (disabled): + * inactive-dummy-1 (ocf:pacemaker:Dummy): Stopped (disabled) + * inactive-dummy-2 (ocf:pacemaker:Dummy): Stopped (disabled) + * Container bundle set: httpd-bundle [pcmk:http]: + * httpd-bundle-0 (192.168.122.131) (ocf:heartbeat:apache): Started cluster01 + * httpd-bundle-1 (192.168.122.132) (ocf:heartbeat:apache): Started cluster02 + * httpd-bundle-2 (192.168.122.133) (ocf:heartbeat:apache): Stopped + * Resource Group: exim-group: + * Public-IP (ocf:heartbeat:IPaddr): Started cluster02 + * Email (lsb:exim): Started cluster02 + * Clone Set: mysql-clone-group [mysql-group]: + * Started: [ cluster01 cluster02 ] + * Clone Set: promotable-clone [promotable-rsc] (promotable): + * Promoted: [ cluster02 ] + * Unpromoted: [ cluster01 ] + +Performing Requested Modifications: + * Injecting ping_monitor_10000@cluster02=1 into the configuration + * Injecting attribute fail-count-ping#monitor_10000=1 into /node_state '2' + * Injecting attribute last-failure-ping#monitor_10000= into /node_state '2' + +Transition Summary: + * Recover ping:0 ( cluster02 ) + * Start httpd-bundle-2 ( cluster01 ) due to unrunnable httpd-bundle-docker-2 start (blocked) + * Start httpd:2 ( httpd-bundle-2 ) due to unrunnable httpd-bundle-docker-2 start (blocked) + +Executing Cluster Transition: + * Cluster action: clear_failcount for ping on cluster02 + * Pseudo action: ping-clone_stop_0 + * Pseudo action: httpd-bundle_start_0 + * Resource action: ping stop on cluster02 + * Pseudo action: ping-clone_stopped_0 + * Pseudo action: ping-clone_start_0 + * Pseudo action: httpd-bundle-clone_start_0 + * Resource action: ping start on cluster02 + * Resource action: ping monitor=10000 on cluster02 + * Pseudo action: ping-clone_running_0 + * Pseudo action: httpd-bundle-clone_running_0 + * Pseudo action: httpd-bundle_running_0 + +Revised Cluster Status: + * Node List: + * Online: [ cluster01 cluster02 ] + * GuestOnline: [ httpd-bundle-0 httpd-bundle-1 ] + + * Full List of Resources: + * Clone Set: ping-clone [ping]: + * Started: [ cluster01 cluster02 ] + * Fencing (stonith:fence_xvm): Started cluster01 + * dummy (ocf:pacemaker:Dummy): Started cluster02 + * Clone Set: inactive-clone [inactive-dhcpd] (disabled): + * Stopped (disabled): [ cluster01 cluster02 ] + * Resource Group: inactive-group (disabled): + * inactive-dummy-1 (ocf:pacemaker:Dummy): Stopped (disabled) + * inactive-dummy-2 (ocf:pacemaker:Dummy): Stopped (disabled) + * Container bundle set: httpd-bundle [pcmk:http]: + * httpd-bundle-0 (192.168.122.131) (ocf:heartbeat:apache): Started cluster01 + * httpd-bundle-1 (192.168.122.132) (ocf:heartbeat:apache): Started cluster02 + * httpd-bundle-2 (192.168.122.133) (ocf:heartbeat:apache): Stopped + * Resource Group: exim-group: + * Public-IP (ocf:heartbeat:IPaddr): Started cluster02 + * Email (lsb:exim): Started cluster02 + * Clone Set: mysql-clone-group [mysql-group]: + * Started: [ cluster01 cluster02 ] + * Clone Set: promotable-clone [promotable-rsc] (promotable): + * Promoted: [ cluster02 ] + * Unpromoted: [ cluster01 ] +=#=#=#= End test: Simulate injecting a failure - OK (0) =#=#=#= +* Passed: crm_simulate - Simulate injecting a failure +=#=#=#= Begin test: Simulate bringing a node down =#=#=#= +4 of 32 resource instances DISABLED and 0 BLOCKED from further action due to failure + +Current cluster status: + * Node List: + * Online: [ cluster01 cluster02 ] + * GuestOnline: [ httpd-bundle-0 httpd-bundle-1 ] + + * Full List of Resources: + * Clone Set: ping-clone [ping]: + * Started: [ cluster01 cluster02 ] + * Fencing (stonith:fence_xvm): Started cluster01 + * dummy (ocf:pacemaker:Dummy): Started cluster02 + * Clone Set: inactive-clone [inactive-dhcpd] (disabled): + * Stopped (disabled): [ cluster01 cluster02 ] + * Resource Group: inactive-group (disabled): + * inactive-dummy-1 (ocf:pacemaker:Dummy): Stopped (disabled) + * inactive-dummy-2 (ocf:pacemaker:Dummy): Stopped (disabled) + * Container bundle set: httpd-bundle [pcmk:http]: + * httpd-bundle-0 (192.168.122.131) (ocf:heartbeat:apache): Started cluster01 + * httpd-bundle-1 (192.168.122.132) (ocf:heartbeat:apache): Started cluster02 + * httpd-bundle-2 (192.168.122.133) (ocf:heartbeat:apache): Stopped + * Resource Group: exim-group: + * Public-IP (ocf:heartbeat:IPaddr): Started cluster02 + * Email (lsb:exim): Started cluster02 + * Clone Set: mysql-clone-group [mysql-group]: + * Started: [ cluster01 cluster02 ] + * Clone Set: promotable-clone [promotable-rsc] (promotable): + * Promoted: [ cluster02 ] + * Unpromoted: [ cluster01 ] + +Performing Requested Modifications: + * Taking node cluster01 offline + +Transition Summary: + * Fence (off) httpd-bundle-0 (resource: httpd-bundle-docker-0) 'guest is unclean' + * Start Fencing ( cluster02 ) + * Start httpd-bundle-0 ( cluster02 ) due to unrunnable httpd-bundle-docker-0 start (blocked) + * Stop httpd:0 ( httpd-bundle-0 ) due to unrunnable httpd-bundle-docker-0 start + * Start httpd-bundle-2 ( cluster02 ) due to unrunnable httpd-bundle-docker-2 start (blocked) + * Start httpd:2 ( httpd-bundle-2 ) due to unrunnable httpd-bundle-docker-2 start (blocked) + +Executing Cluster Transition: + * Resource action: Fencing start on cluster02 + * Pseudo action: stonith-httpd-bundle-0-off on httpd-bundle-0 + * Pseudo action: httpd-bundle_stop_0 + * Pseudo action: httpd-bundle_start_0 + * Resource action: Fencing monitor=60000 on cluster02 + * Pseudo action: httpd-bundle-clone_stop_0 + * Pseudo action: httpd_stop_0 + * Pseudo action: httpd-bundle-clone_stopped_0 + * Pseudo action: httpd-bundle-clone_start_0 + * Pseudo action: httpd-bundle_stopped_0 + * Pseudo action: httpd-bundle-clone_running_0 + * Pseudo action: httpd-bundle_running_0 + +Revised Cluster Status: + * Node List: + * Online: [ cluster02 ] + * OFFLINE: [ cluster01 ] + * GuestOnline: [ httpd-bundle-1 ] + + * Full List of Resources: + * Clone Set: ping-clone [ping]: + * Started: [ cluster02 ] + * Stopped: [ cluster01 ] + * Fencing (stonith:fence_xvm): Started cluster02 + * dummy (ocf:pacemaker:Dummy): Started cluster02 + * Clone Set: inactive-clone [inactive-dhcpd] (disabled): + * Stopped (disabled): [ cluster01 cluster02 ] + * Resource Group: inactive-group (disabled): + * inactive-dummy-1 (ocf:pacemaker:Dummy): Stopped (disabled) + * inactive-dummy-2 (ocf:pacemaker:Dummy): Stopped (disabled) + * Container bundle set: httpd-bundle [pcmk:http]: + * httpd-bundle-0 (192.168.122.131) (ocf:heartbeat:apache): FAILED + * httpd-bundle-1 (192.168.122.132) (ocf:heartbeat:apache): Started cluster02 + * httpd-bundle-2 (192.168.122.133) (ocf:heartbeat:apache): Stopped + * Resource Group: exim-group: + * Public-IP (ocf:heartbeat:IPaddr): Started cluster02 + * Email (lsb:exim): Started cluster02 + * Clone Set: mysql-clone-group [mysql-group]: + * Started: [ cluster02 ] + * Stopped: [ cluster01 ] + * Clone Set: promotable-clone [promotable-rsc] (promotable): + * Promoted: [ cluster02 ] + * Stopped: [ cluster01 ] +=#=#=#= End test: Simulate bringing a node down - OK (0) =#=#=#= +* Passed: crm_simulate - Simulate bringing a node down +=#=#=#= Begin test: Simulate a node failing =#=#=#= +4 of 32 resource instances DISABLED and 0 BLOCKED from further action due to failure + +Current cluster status: + * Node List: + * Online: [ cluster01 cluster02 ] + * GuestOnline: [ httpd-bundle-0 httpd-bundle-1 ] + + * Full List of Resources: + * Clone Set: ping-clone [ping]: + * Started: [ cluster01 cluster02 ] + * Fencing (stonith:fence_xvm): Started cluster01 + * dummy (ocf:pacemaker:Dummy): Started cluster02 + * Clone Set: inactive-clone [inactive-dhcpd] (disabled): + * Stopped (disabled): [ cluster01 cluster02 ] + * Resource Group: inactive-group (disabled): + * inactive-dummy-1 (ocf:pacemaker:Dummy): Stopped (disabled) + * inactive-dummy-2 (ocf:pacemaker:Dummy): Stopped (disabled) + * Container bundle set: httpd-bundle [pcmk:http]: + * httpd-bundle-0 (192.168.122.131) (ocf:heartbeat:apache): Started cluster01 + * httpd-bundle-1 (192.168.122.132) (ocf:heartbeat:apache): Started cluster02 + * httpd-bundle-2 (192.168.122.133) (ocf:heartbeat:apache): Stopped + * Resource Group: exim-group: + * Public-IP (ocf:heartbeat:IPaddr): Started cluster02 + * Email (lsb:exim): Started cluster02 + * Clone Set: mysql-clone-group [mysql-group]: + * Started: [ cluster01 cluster02 ] + * Clone Set: promotable-clone [promotable-rsc] (promotable): + * Promoted: [ cluster02 ] + * Unpromoted: [ cluster01 ] + +Performing Requested Modifications: + * Failing node cluster02 + +Transition Summary: + * Fence (off) httpd-bundle-1 (resource: httpd-bundle-docker-1) 'guest is unclean' + * Fence (reboot) cluster02 'peer is no longer part of the cluster' + * Stop ping:0 ( cluster02 ) due to node availability + * Stop dummy ( cluster02 ) due to node availability + * Stop httpd-bundle-ip-192.168.122.132 ( cluster02 ) due to node availability + * Stop httpd-bundle-docker-1 ( cluster02 ) due to node availability + * Stop httpd-bundle-1 ( cluster02 ) due to unrunnable httpd-bundle-docker-1 start + * Stop httpd:1 ( httpd-bundle-1 ) due to unrunnable httpd-bundle-docker-1 start + * Start httpd-bundle-2 ( cluster01 ) due to unrunnable httpd-bundle-docker-2 start (blocked) + * Start httpd:2 ( httpd-bundle-2 ) due to unrunnable httpd-bundle-docker-2 start (blocked) + * Move Public-IP ( cluster02 -> cluster01 ) + * Move Email ( cluster02 -> cluster01 ) + * Stop mysql-proxy:0 ( cluster02 ) due to node availability + * Stop promotable-rsc:0 ( Promoted cluster02 ) due to node availability + +Executing Cluster Transition: + * Pseudo action: httpd-bundle-1_stop_0 + * Pseudo action: promotable-clone_demote_0 + * Pseudo action: httpd-bundle_stop_0 + * Pseudo action: httpd-bundle_start_0 + * Fencing cluster02 (reboot) + * Pseudo action: ping-clone_stop_0 + * Pseudo action: dummy_stop_0 + * Pseudo action: httpd-bundle-docker-1_stop_0 + * Pseudo action: exim-group_stop_0 + * Pseudo action: Email_stop_0 + * Pseudo action: mysql-clone-group_stop_0 + * Pseudo action: promotable-rsc_demote_0 + * Pseudo action: promotable-clone_demoted_0 + * Pseudo action: promotable-clone_stop_0 + * Pseudo action: stonith-httpd-bundle-1-off on httpd-bundle-1 + * Pseudo action: ping_stop_0 + * Pseudo action: ping-clone_stopped_0 + * Pseudo action: httpd-bundle-clone_stop_0 + * Pseudo action: httpd-bundle-ip-192.168.122.132_stop_0 + * Pseudo action: Public-IP_stop_0 + * Pseudo action: mysql-group:0_stop_0 + * Pseudo action: mysql-proxy_stop_0 + * Pseudo action: promotable-rsc_stop_0 + * Pseudo action: promotable-clone_stopped_0 + * Pseudo action: httpd_stop_0 + * Pseudo action: httpd-bundle-clone_stopped_0 + * Pseudo action: httpd-bundle-clone_start_0 + * Pseudo action: exim-group_stopped_0 + * Pseudo action: exim-group_start_0 + * Resource action: Public-IP start on cluster01 + * Resource action: Email start on cluster01 + * Pseudo action: mysql-group:0_stopped_0 + * Pseudo action: mysql-clone-group_stopped_0 + * Pseudo action: httpd-bundle_stopped_0 + * Pseudo action: httpd-bundle-clone_running_0 + * Pseudo action: exim-group_running_0 + * Pseudo action: httpd-bundle_running_0 + +Revised Cluster Status: + * Node List: + * Online: [ cluster01 ] + * OFFLINE: [ cluster02 ] + * GuestOnline: [ httpd-bundle-0 ] + + * Full List of Resources: + * Clone Set: ping-clone [ping]: + * Started: [ cluster01 ] + * Stopped: [ cluster02 ] + * Fencing (stonith:fence_xvm): Started cluster01 + * dummy (ocf:pacemaker:Dummy): Stopped + * Clone Set: inactive-clone [inactive-dhcpd] (disabled): + * Stopped (disabled): [ cluster01 cluster02 ] + * Resource Group: inactive-group (disabled): + * inactive-dummy-1 (ocf:pacemaker:Dummy): Stopped (disabled) + * inactive-dummy-2 (ocf:pacemaker:Dummy): Stopped (disabled) + * Container bundle set: httpd-bundle [pcmk:http]: + * httpd-bundle-0 (192.168.122.131) (ocf:heartbeat:apache): Started cluster01 + * httpd-bundle-1 (192.168.122.132) (ocf:heartbeat:apache): FAILED + * httpd-bundle-2 (192.168.122.133) (ocf:heartbeat:apache): Stopped + * Resource Group: exim-group: + * Public-IP (ocf:heartbeat:IPaddr): Started cluster01 + * Email (lsb:exim): Started cluster01 + * Clone Set: mysql-clone-group [mysql-group]: + * Started: [ cluster01 ] + * Stopped: [ cluster02 ] + * Clone Set: promotable-clone [promotable-rsc] (promotable): + * Unpromoted: [ cluster01 ] + * Stopped: [ cluster02 ] +=#=#=#= End test: Simulate a node failing - OK (0) =#=#=#= +* Passed: crm_simulate - Simulate a node failing +=#=#=#= Begin test: Run crm_simulate with invalid CIB (enum violation) =#=#=#= +Invalid attribute first-action for element rsc_order +Element constraints has extra content: rsc_order +pcmk__update_schema debug: Schema pacemaker-1.2 does not validate +Invalid attribute first-action for element rsc_order +Element constraints has extra content: rsc_order +pcmk__update_schema debug: Schema pacemaker-1.3 does not validate +Invalid attribute first-action for element rsc_order +Element constraints has extra content: rsc_order +pcmk__update_schema debug: Schema pacemaker-2.0 does not validate +Invalid attribute first-action for element rsc_order +Element constraints has extra content: rsc_order +pcmk__update_schema debug: Schema pacemaker-2.1 does not validate +Invalid attribute first-action for element rsc_order +Element constraints has extra content: rsc_order +pcmk__update_schema debug: Schema pacemaker-2.2 does not validate +Invalid attribute first-action for element rsc_order +Element constraints has extra content: rsc_order +pcmk__update_schema debug: Schema pacemaker-2.3 does not validate +Invalid attribute first-action for element rsc_order +Element constraints has extra content: rsc_order +pcmk__update_schema debug: Schema pacemaker-2.4 does not validate +Invalid attribute first-action for element rsc_order +Element constraints has extra content: rsc_order +pcmk__update_schema debug: Schema pacemaker-2.5 does not validate +Invalid attribute first-action for element rsc_order +Element constraints has extra content: rsc_order +pcmk__update_schema debug: Schema pacemaker-2.6 does not validate +Invalid attribute first-action for element rsc_order +Element constraints has extra content: rsc_order +pcmk__update_schema debug: Schema pacemaker-2.7 does not validate +Invalid attribute first-action for element rsc_order +Element constraints has extra content: rsc_order +pcmk__update_schema debug: Schema pacemaker-2.8 does not validate +Invalid attribute first-action for element rsc_order +Element constraints has extra content: rsc_order +pcmk__update_schema debug: Schema pacemaker-2.9 does not validate +Invalid attribute first-action for element rsc_order +Element constraints has extra content: rsc_order +pcmk__update_schema debug: Schema pacemaker-2.10 does not validate +Invalid attribute first-action for element rsc_order +Element constraints has extra content: rsc_order +pcmk__update_schema debug: Schema pacemaker-3.0 does not validate +Invalid attribute first-action for element rsc_order +Element constraints has extra content: rsc_order +pcmk__update_schema debug: Schema pacemaker-3.1 does not validate +Invalid attribute first-action for element rsc_order +Element constraints has extra content: rsc_order +pcmk__update_schema debug: Schema pacemaker-3.2 does not validate +Invalid attribute first-action for element rsc_order +Element constraints has extra content: rsc_order +pcmk__update_schema debug: Schema pacemaker-3.3 does not validate +Invalid attribute first-action for element rsc_order +Element constraints has extra content: rsc_order +pcmk__update_schema debug: Schema pacemaker-3.4 does not validate +Invalid attribute first-action for element rsc_order +Element constraints has extra content: rsc_order +pcmk__update_schema debug: Schema pacemaker-3.5 does not validate +Invalid attribute first-action for element rsc_order +Element constraints has extra content: rsc_order +pcmk__update_schema debug: Schema pacemaker-3.6 does not validate +Invalid attribute first-action for element rsc_order +Element constraints has extra content: rsc_order +pcmk__update_schema debug: Schema pacemaker-3.7 does not validate +Invalid attribute first-action for element rsc_order +Element constraints has extra content: rsc_order +pcmk__update_schema debug: Schema pacemaker-3.8 does not validate +Invalid attribute first-action for element rsc_order +Element constraints has extra content: rsc_order +pcmk__update_schema debug: Schema pacemaker-3.9 does not validate +Invalid attribute first-action for element rsc_order +Element constraints has extra content: rsc_order +pcmk__update_schema debug: Schema pacemaker-3.10 does not validate +Invalid attribute first-action for element rsc_order +Element constraints has extra content: rsc_order +pcmk__update_schema debug: Schema pacemaker-4.0 does not validate +Cannot upgrade configuration (claiming pacemaker-1.2 schema) to at least pacemaker-4.0 because it does not validate with any schema from pacemaker-1.2 to the latest +=#=#=#= 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: Run crm_simulate with invalid CIB (unrecognized validate-with) =#=#=#= +=#=#=#= 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: Run crm_simulate with invalid, but possibly recoverable CIB (valid with X.Y+1) =#=#=#= +Element configuration has extra content: tags +pcmk__update_schema debug: Schema pacemaker-1.2 does not validate +pcmk__update_schema debug: Schema pacemaker-1.3 validates +pcmk__update_schema debug: Schema pacemaker-2.0 validates +pcmk__update_schema debug: Schema pacemaker-2.1 validates +pcmk__update_schema debug: Schema pacemaker-2.2 validates +pcmk__update_schema debug: Schema pacemaker-2.3 validates +pcmk__update_schema debug: Schema pacemaker-2.4 validates +pcmk__update_schema debug: Schema pacemaker-2.5 validates +pcmk__update_schema debug: Schema pacemaker-2.6 validates +pcmk__update_schema debug: Schema pacemaker-2.7 validates +pcmk__update_schema debug: Schema pacemaker-2.8 validates +pcmk__update_schema debug: Schema pacemaker-2.9 validates +pcmk__update_schema debug: Schema pacemaker-2.10 validates +pcmk__update_schema debug: Schema pacemaker-3.0 validates +pcmk__update_schema debug: Schema pacemaker-3.1 validates +pcmk__update_schema debug: Schema pacemaker-3.2 validates +pcmk__update_schema debug: Schema pacemaker-3.3 validates +pcmk__update_schema debug: Schema pacemaker-3.4 validates +pcmk__update_schema debug: Schema pacemaker-3.5 validates +pcmk__update_schema debug: Schema pacemaker-3.6 validates +pcmk__update_schema debug: Schema pacemaker-3.7 validates +pcmk__update_schema debug: Schema pacemaker-3.8 validates +pcmk__update_schema debug: Schema pacemaker-3.9 validates +pcmk__update_schema debug: Schema pacemaker-3.10 validates +pcmk__update_schema debug: Schema pacemaker-4.0 validates +pcmk__update_schema info: Transformed the configuration schema to pacemaker-4.0 +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 +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 +Current cluster status: + * Full List of Resources: + * dummy1 (ocf:pacemaker:Dummy): Stopped + * dummy2 (ocf:pacemaker:Dummy): Stopped + +Transition Summary: + +Executing Cluster Transition: + +Revised Cluster Status: + * Full List of Resources: + * dummy1 (ocf:pacemaker:Dummy): Stopped + * dummy2 (ocf:pacemaker:Dummy): Stopped +=#=#=#= End test: Run crm_simulate with invalid, but possibly recoverable CIB (valid with X.Y+1) - OK (0) =#=#=#= +* Passed: crm_simulate - Run crm_simulate with invalid, but possibly recoverable CIB (valid with X.Y+1) +=#=#=#= Begin test: Run crm_simulate with valid CIB, but without validate-with attribute =#=#=#= +=#=#=#= End test: Run crm_simulate with valid CIB, but without validate-with attribute - Invalid configuration (78) =#=#=#= +* Passed: crm_simulate - Run crm_simulate with valid CIB, but without validate-with attribute +=#=#=#= Begin test: Run crm_simulate with invalid CIB, also without validate-with attribute =#=#=#= +=#=#=#= End test: Run crm_simulate with invalid CIB, also without validate-with attribute - Invalid configuration (78) =#=#=#= +* Passed: crm_simulate - Run crm_simulate with invalid CIB, also without validate-with attribute diff --git a/cts/cts-cli.in b/cts/cts-cli.in index bf1e0807440..7c23b11da3c 100644 --- a/cts/cts-cli.in +++ b/cts/cts-cli.in @@ -9,7 +9,7 @@ # We know this is a very long file. # pylint: disable=too-many-lines -__copyright__ = "Copyright 2024 the Pacemaker project contributors" +__copyright__ = "Copyright 2024-2025 the Pacemaker project contributors" __license__ = "GNU General Public License version 2 or later (GPLv2+) WITHOUT ANY WARRANTY" import argparse @@ -45,7 +45,7 @@ from pacemaker.exitstatus import ExitStatus # Individual tool tests are split out, but can also be accessed as a group with "tools" tools_tests = ["cibadmin", "crm_attribute", "crm_standby", "crm_resource", - "crm_ticket", "crmadmin", "crm_shadow", "crm_verify"] + "crm_ticket", "crmadmin", "crm_shadow", "crm_verify", "crm_simulate"] # The default list of tests to run, in the order they should be run default_tests = ["access_render", "daemons", "dates", "error_codes"] + tools_tests + \ ["crm_mon", "acls", "validity", "upgrade", "rules", "feature_set"] @@ -246,6 +246,7 @@ def sanitize_output(s): (r'Created new pacemaker-.* configuration', r'Created new pacemaker configuration'), (r'Device not configured', r'No such device or address'), (r'^Entity: line [0-9]+: ', r''), + (r'(Injecting attribute last-failure-ping#monitor_10000=)[0-9]*', r'\1'), (r'Last change: .*', r'Last change:'), (r'Last updated: .*', r'Last updated:'), (r'^Migration will take effect until: .*', r'Migration will take effect until:'), @@ -282,6 +283,7 @@ def sanitize_output(s): (r'(@validate-with=pacemaker-)[0-9.]+,', r'\1X,'), (r' version="[^"]*"', r' version=""'), (r'\(version .*\)', r'(version)'), + (r'-x .*cli/(.*)\.xml', r'-x \1.xml'), (r'--xml-file .*cli/(.*)\.xml', r'--xml-file \1.xml'), ] @@ -2394,6 +2396,88 @@ class CrmVerifyRegressionTest(RegressionTest): return invalid_tests + valid_tests +class CrmSimulateRegressionTest(RegressionTest): + """A class for testing crm_simulate.""" + + @property + def name(self): + """Return the name of this regression test.""" + return "crm_simulate" + + @property + def tests(self): + """A list of Test instances to be run as part of this regression test.""" + + good_cib = """ + + + + + + + + + + + + + + +""" + + bad_cib = good_cib.replace("start", "break") + + bad_version_cib = good_cib.replace("pacemaker-1.2", "pacemaker-9999.0") + + recoverable_cib = good_cib.replace("", "") + + no_version_cib = good_cib.replace('validate-with="pacemaker-1.2" ', "") + + no_version_bad_cib = bad_version_cib.replace('epoch="3"', 'epoch="30"').replace("start", "break") + + basic_tests = [ + Test("Show allocation scores with crm_simulate", + "crm_simulate -x {cts_cli_data}/crm_mon.xml --show-scores --output-as=xml"), + Test("Show utilization with crm_simulate", + "crm_simulate -x {cts_cli_data}/crm_mon.xml --show-utilization"), + Test("Simulate injecting a failure", + "crm_simulate -x {cts_cli_data}/crm_mon.xml -S -i ping_monitor_10000@cluster02=1"), + Test("Simulate bringing a node down", + "crm_simulate -x {cts_cli_data}/crm_mon.xml -S --node-down=cluster01"), + Test("Simulate a node failing", + "crm_simulate -x {cts_cli_data}/crm_mon.xml -S --node-fail=cluster02"), + Test("Run crm_simulate with invalid CIB (enum violation)", + "crm_simulate -p -S", + stdin=bad_cib, + env={"PCMK_trace_functions": "apply_upgrade,pcmk__update_schema"}, + expected_rc=ExitStatus.CONFIG), + Test("Run crm_simulate with invalid CIB (unrecognized validate-with)", + "crm_simulate -p -S", + stdin=bad_version_cib, + env={"PCMK_trace_functions": "apply_upgrade,pcmk__update_schema"}, + expected_rc=ExitStatus.CONFIG), + Test("Run crm_simulate with invalid, but possibly recoverable CIB (valid with X.Y+1)", + "crm_simulate -p -S", + stdin=recoverable_cib, + env={"PCMK_trace_functions": "apply_upgrade,pcmk__update_schema"}), + Test("Run crm_simulate with valid CIB, but without validate-with attribute", + "crm_simulate -p -S", + stdin=no_version_cib, + env={"PCMK_trace_functions": "apply_upgrade,pcmk__update_schema"}, + expected_rc=ExitStatus.CONFIG), + Test("Run crm_simulate with invalid CIB, also without validate-with attribute", + "crm_simulate -p -S", + stdin=no_version_bad_cib, + env={"PCMK_trace_functions": "apply_upgrade,pcmk__update_schema"}, + expected_rc=ExitStatus.CONFIG), + ] + + return [ + ShadowTestGroup(basic_tests, create=False, + env={"CIB_shadow": None}), + ] + + class CrmMonRegressionTest(RegressionTest): """A class for testing crm_mon.""" @@ -3354,6 +3438,7 @@ regression_classes = [ CrmadminRegressionTest, CrmShadowRegressionTest, CrmVerifyRegressionTest, + CrmSimulateRegressionTest, CrmMonRegressionTest, AclsRegressionTest, ValidityRegressionTest, From c01dc909232f3deaec51838b8aab7050bc02e0db Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Mon, 10 Feb 2025 13:11:35 -0500 Subject: [PATCH 3/4] Test: CTS: Pass verbose argument to the diff function. If there are differences from expected output when running under CI, it's useful to be able to see them instead of having to track down the files. --- cts/cts-cli.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cts/cts-cli.in b/cts/cts-cli.in index 7c23b11da3c..72334868601 100644 --- a/cts/cts-cli.in +++ b/cts/cts-cli.in @@ -3355,6 +3355,7 @@ def results(regs, save, verbose): if verbose: print("\n\nResults") + sys.stdout.flush() for r in regs: r.write() @@ -3363,7 +3364,7 @@ def results(regs, save, verbose): dest = "%s/cli/regression.%s.exp" % (test_home, r.name) copyfile(r.results_file, dest) - r.diff() + r.diff(verbose) if not r.identical: output_differs += 1 @@ -3380,6 +3381,7 @@ def summary(regs, output_differs, verbose): test_successes += r.successes print("\n\nSummary") + sys.stdout.flush() # First, print all the Passed/Failed lines from each Test run. for r in regs: From 33c36aedb705ade6822ca6dbcd5d15701b2bf155 Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Mon, 10 Feb 2025 13:18:32 -0500 Subject: [PATCH 4/4] Build: Run cts-cli verbosely. This helps to capture the output from the tests if problems are encountered when running under CI. --- rpm/pacemaker.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpm/pacemaker.spec.in b/rpm/pacemaker.spec.in index 4998c1aed41..9072783aa8b 100644 --- a/rpm/pacemaker.spec.in +++ b/rpm/pacemaker.spec.in @@ -517,7 +517,7 @@ popd %check make %{_smp_mflags} check { cts/cts-scheduler --run load-stopped-loop \ - && cts/cts-cli \ + && cts/cts-cli -V \ && touch .CHECKED } 2>&1 | sed 's/[fF]ail/faiil/g' # prevent false positives in rpmlint [ -f .CHECKED ] && rm -f -- .CHECKED