diff --git a/cts/cli/regression.crm_shadow.exp b/cts/cli/regression.crm_shadow.exp index 84fae0fdf17..cdda7b8f693 100644 --- a/cts/cli/regression.crm_shadow.exp +++ b/cts/cli/regression.crm_shadow.exp @@ -814,6 +814,13 @@ Diff: +++ 1.4.1 (no digest) + /cib: @num_updates=1 =#=#=#= End test: Get active shadow instance's diff (after commit all) - Error occurred (1) =#=#=#= * Passed: crm_shadow - Get active shadow instance's diff (after commit all) +=#=#=#= Begin test: Commit shadow instance (force) (update-status) =#=#=#= +=#=#=#= End test: Commit shadow instance (force) (update-status) - OK (0) =#=#=#= +* Passed: crm_shadow - Commit shadow instance (force) (update-status) +=#=#=#= Begin test: Check status section after commit (update-status) =#=#=#= +1 +=#=#=#= End test: Check status section after commit (update-status) - OK (0) =#=#=#= +* Passed: cibadmin - Check status section after commit (update-status) =#=#=#= Begin test: Commit shadow instance (XML) =#=#=#= diff --git a/cts/cts-cli.in b/cts/cts-cli.in index eadb6a69ba1..2950a7e2ad5 100644 --- a/cts/cts-cli.in +++ b/cts/cts-cli.in @@ -1960,6 +1960,14 @@ class CrmShadowRegressionTest(RegressionTest): "crm_shadow --diff", expected_rc=ExitStatus.ERROR), ], cib_gen=partial(copy_existing_cib, f"{cts_cli_data}/crm_mon.xml")), + TestGroup([ + # Commit with --update-status uploads status section changes + Test("Commit shadow instance (force) (update-status)", + f"crm_shadow --commit {SHADOW_NAME} --force --update-status"), + Test("Check status section after commit (update-status)", + "cibadmin -Q -o status | grep -c cluster03", + env={"CIB_shadow": None}), + ], cib_gen=partial(copy_existing_cib, f"{cts_cli_data}/crm_mon.xml")), TestGroup([ # Repeat sequence with XML output ValidatingTest("Commit shadow instance", diff --git a/include/crm/cib/internal.h b/include/crm/cib/internal.h index 63b5eda8a6e..57f640d87f5 100644 --- a/include/crm/cib/internal.h +++ b/include/crm/cib/internal.h @@ -182,6 +182,7 @@ cib__client_triggers_refresh(const char *name) "crm_attribute", "crm_node", "crm_resource", + "crm_shadow_status", "crm_ticket", NULL); } diff --git a/tools/crm_shadow.c b/tools/crm_shadow.c index 890994815de..e04be604cbd 100644 --- a/tools/crm_shadow.c +++ b/tools/crm_shadow.c @@ -77,6 +77,7 @@ static struct { gboolean force; gboolean batch; gboolean full_upload; + gboolean update_status; gchar *validate_with; } options = { .cmd_options = cib_sync_call, @@ -679,6 +680,12 @@ commit_shadow_file(GError **error) return; } + if (options.update_status) { + options.full_upload = TRUE; + free(crm_system_name); + crm_system_name = strdup("crm_shadow_status"); + } + filename = get_shadow_file(options.instance); if (check_file_exists(filename, true, error) != pcmk_rc_ok) { goto done; @@ -1139,6 +1146,11 @@ static GOptionEntry addl_entries[] = { &options.validate_with, "(Advanced) Create an older configuration version", NULL }, + { "update-status", 'u', G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE, + &options.update_status, + "(Advanced) Upload entire CIB with --commit, without triggering a " + "controller refresh", NULL }, + { NULL } };