diff --git a/python/pacemaker/_cts/audits.py b/python/pacemaker/_cts/audits.py index 2c8329186fc..5c97425479c 100644 --- a/python/pacemaker/_cts/audits.py +++ b/python/pacemaker/_cts/audits.py @@ -491,7 +491,8 @@ def _setup(self): self.debug("No nodes active - skipping %s" % self.name) return False - (_, lines) = self._cm.rsh(self._target, "crm_resource -c", verbose=1) + (_, lines) = self._cm.rsh(self._target, "crm_resource --list-cts", + verbose=1) for line in lines: if re.search("^Resource", line): @@ -650,7 +651,9 @@ def __init__(self, cm): def _crm_location(self, resource): """Return a list of cluster nodes where a given resource is running.""" - (rc, lines) = self._cm.rsh(self._target, "crm_resource -W -r %s -Q" % resource, verbose=1) + (rc, lines) = self._cm.rsh(self._target, + "crm_resource --locate -r %s -Q" % resource, + verbose=1) hosts = [] if rc == 0: diff --git a/tools/crm_resource.c b/tools/crm_resource.c index 271c74f8b5c..45362914697 100644 --- a/tools/crm_resource.c +++ b/tools/crm_resource.c @@ -48,7 +48,6 @@ enum rsc_command { cmd_execute_agent, cmd_fail, cmd_get_param, - cmd_get_property, cmd_list_active_ops, cmd_list_agents, cmd_list_all_ops, @@ -66,7 +65,6 @@ enum rsc_command { cmd_refresh, cmd_restart, cmd_set_param, - cmd_set_property, cmd_wait, cmd_why, }; @@ -94,7 +92,6 @@ struct { gchar *prop_value; // --parameter-value (attribute value) guint timeout_ms; // Parsed from --timeout value char *agent_spec; // Standard and/or provider and/or agent - gchar *xml_file; // Value of (deprecated) --xml-file int check_level; // Optional value of --validate or --force-check // Resource configuration specified via command-line arguments @@ -383,10 +380,6 @@ command_cb(const gchar *option_name, const gchar *optarg, gpointer data, options.rsc_cmd = cmd_get_param; pcmk__str_update(&options.prop_name, optarg); - } else if (pcmk__str_any_of(option_name, "-G", "--get-property", NULL)) { - options.rsc_cmd = cmd_get_property; - pcmk__str_update(&options.prop_name, optarg); - } else if (pcmk__str_any_of(option_name, "-O", "--list-operations", NULL)) { options.rsc_cmd = cmd_list_active_ops; @@ -447,10 +440,6 @@ command_cb(const gchar *option_name, const gchar *optarg, gpointer data, options.rsc_cmd = cmd_set_param; pcmk__str_update(&options.prop_name, optarg); - } else if (pcmk__str_any_of(option_name, "-S", "--set-property", NULL)) { - options.rsc_cmd = cmd_set_property; - pcmk__str_update(&options.prop_name, optarg); - } else if (pcmk__str_eq(option_name, "--wait", pcmk__str_none)) { options.rsc_cmd = cmd_wait; @@ -522,11 +511,6 @@ static GOptionEntry query_entries[] = { "Display named parameter for resource (use instance attribute\n" INDENT "unless --element, --meta, or --utilization is specified)", "PARAM" }, - { "get-property", 'G', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_CALLBACK, - command_cb, - "Display named property of resource ('class', 'type', or 'provider') " - "(requires --resource)", - "PROPERTY" }, { "locate", 'W', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, command_cb, "Show node(s) currently running resource", NULL }, @@ -588,11 +572,6 @@ static GOptionEntry command_entries[] = { "Delete named parameter for resource. Use instance attribute\n" INDENT "unless --element, --meta or, --utilization is specified.", "PARAM" }, - { "set-property", 'S', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_CALLBACK, - command_cb, - "Set named property of resource ('class', 'type', or 'provider') " - "(requires -r, -t, -v)", - "PROPERTY" }, { NULL } }; @@ -776,9 +755,8 @@ static GOptionEntry addl_entries[] = { "Force the action to be performed. See help for individual commands for\n" INDENT "additional behavior.", NULL }, - { "xml-file", 'x', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_FILENAME, &options.xml_file, - NULL, - "FILE" }, + + // @COMPAT Used in resource-agents prior to v4.2.0 { "host-uname", 'H', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &options.host_uname, NULL, "HOST" }, @@ -858,7 +836,7 @@ ban_or_move(pcmk__output_t *out, pcmk_resource_t *rsc, if (nactive == 1) { rc = cli_resource_ban(out, options.rsc_id, current->priv->name, - move_lifetime, cib_conn, cib_sync_call, + move_lifetime, cib_conn, options.promoted_role_only, PCMK_ROLE_PROMOTED); } else if (pcmk_is_set(rsc->flags, pcmk__rsc_promotable)) { @@ -878,7 +856,7 @@ ban_or_move(pcmk__output_t *out, pcmk_resource_t *rsc, if(count == 1 && current) { rc = cli_resource_ban(out, options.rsc_id, current->priv->name, - move_lifetime, cib_conn, cib_sync_call, + move_lifetime, cib_conn, options.promoted_role_only, PCMK_ROLE_PROMOTED); @@ -931,7 +909,7 @@ cleanup(pcmk__output_t *out, pcmk_resource_t *rsc, pcmk_node_t *node) } static int -clear_constraints(pcmk__output_t *out, xmlNodePtr *cib_xml_copy) +clear_constraints(pcmk__output_t *out) { GList *before = NULL; GList *after = NULL; @@ -946,8 +924,7 @@ clear_constraints(pcmk__output_t *out, xmlNodePtr *cib_xml_copy) if (options.clear_expired) { rc = cli_resource_clear_all_expired(scheduler->input, cib_conn, - cib_sync_call, options.rsc_id, - options.host_uname, + options.rsc_id, options.host_uname, options.promoted_role_only); } else if (options.host_uname) { @@ -960,27 +937,28 @@ clear_constraints(pcmk__output_t *out, xmlNodePtr *cib_xml_copy) return rc; } rc = cli_resource_clear(options.rsc_id, dest->priv->name, NULL, - cib_conn, cib_sync_call, true, options.force); + cib_conn, true, options.force); } else { rc = cli_resource_clear(options.rsc_id, NULL, scheduler->nodes, - cib_conn, cib_sync_call, true, options.force); + cib_conn, true, options.force); } if (!out->is_quiet(out)) { - rc = cib_conn->cmds->query(cib_conn, NULL, cib_xml_copy, cib_sync_call); + xmlNode *cib_xml = NULL; + + rc = cib_conn->cmds->query(cib_conn, NULL, &cib_xml, cib_sync_call); rc = pcmk_legacy2rc(rc); if (rc != pcmk_rc_ok) { g_set_error(&error, PCMK__RC_ERROR, rc, _("Could not get modified CIB: %s\n"), pcmk_rc_str(rc)); g_list_free(before); - pcmk__xml_free(*cib_xml_copy); - *cib_xml_copy = NULL; + pcmk__xml_free(cib_xml); return rc; } - scheduler->input = *cib_xml_copy; + scheduler->input = cib_xml; cluster_status(scheduler); after = build_constraint_list(scheduler->input); @@ -999,19 +977,13 @@ clear_constraints(pcmk__output_t *out, xmlNodePtr *cib_xml_copy) } static int -initialize_scheduler_data(xmlNodePtr *cib_xml_copy) +initialize_scheduler_data(void) { + xmlNode *cib_xml = NULL; int rc = pcmk_rc_ok; - if (options.xml_file != NULL) { - *cib_xml_copy = pcmk__xml_read(options.xml_file); - if (*cib_xml_copy == NULL) { - rc = pcmk_rc_cib_corrupt; - } - } else { - rc = cib_conn->cmds->query(cib_conn, NULL, cib_xml_copy, cib_sync_call); - rc = pcmk_legacy2rc(rc); - } + rc = cib_conn->cmds->query(cib_conn, NULL, &cib_xml, cib_sync_call); + rc = pcmk_legacy2rc(rc); if (rc == pcmk_rc_ok) { scheduler = pe_new_working_set(); @@ -1020,13 +992,12 @@ initialize_scheduler_data(xmlNodePtr *cib_xml_copy) } else { pcmk__set_scheduler_flags(scheduler, pcmk__sched_no_counts); scheduler->priv->out = out; - rc = update_scheduler_input(scheduler, cib_xml_copy); + rc = update_scheduler_input(scheduler, &cib_xml); } } if (rc != pcmk_rc_ok) { - pcmk__xml_free(*cib_xml_copy); - *cib_xml_copy = NULL; + pcmk__xml_free(cib_xml); return rc; } @@ -1122,39 +1093,6 @@ refresh_resource(pcmk__output_t *out, pcmk_resource_t *rsc, pcmk_node_t *node) } } -static int -set_property(void) -{ - int rc = pcmk_rc_ok; - xmlNode *msg_data = NULL; - - if (pcmk__str_empty(options.rsc_type)) { - g_set_error(&error, PCMK__EXITC_ERROR, CRM_EX_USAGE, - _("Must specify -t with resource type")); - rc = ENXIO; - return rc; - - } else if (pcmk__str_empty(options.prop_value)) { - g_set_error(&error, PCMK__EXITC_ERROR, CRM_EX_USAGE, - _("Must supply -v with new value")); - rc = ENXIO; - return rc; - } - - CRM_LOG_ASSERT(options.prop_name != NULL); - - msg_data = pcmk__xe_create(NULL, options.rsc_type); - crm_xml_add(msg_data, PCMK_XA_ID, options.rsc_id); - crm_xml_add(msg_data, options.prop_name, options.prop_value); - - rc = cib_conn->cmds->modify(cib_conn, PCMK_XE_RESOURCES, msg_data, - cib_sync_call); - rc = pcmk_legacy2rc(rc); - pcmk__xml_free(msg_data); - - return rc; -} - static int show_metadata(pcmk__output_t *out, const char *agent_spec) { @@ -1271,11 +1209,9 @@ get_find_flags(void) case cmd_delete_param: case cmd_get_param: - case cmd_get_property: case cmd_query_xml_raw: case cmd_query_xml: case cmd_set_param: - case cmd_set_property: return pcmk_rsc_match_history|pcmk_rsc_match_basename; default: @@ -1507,7 +1443,6 @@ build_arg_context(pcmk__common_args_t *args, GOptionGroup **group) { int main(int argc, char **argv) { - xmlNode *cib_xml_copy = NULL; pcmk_resource_t *rsc = NULL; pcmk_node_t *node = NULL; uint32_t find_flags = 0; @@ -1628,7 +1563,6 @@ main(int argc, char **argv) * argument. */ case cmd_get_param: - case cmd_get_property: case cmd_list_instances: case cmd_list_standards: pcmk__output_enable_list_element(out); @@ -1711,7 +1645,7 @@ main(int argc, char **argv) // Populate scheduler data from XML file if specified or CIB query otherwise if (is_scheduler_required()) { - rc = initialize_scheduler_data(&cib_xml_copy); + rc = initialize_scheduler_data(); if (rc != pcmk_rc_ok) { exit_code = pcmk_rc2exitc(rc); goto done; @@ -1840,7 +1774,7 @@ main(int argc, char **argv) */ rc = cli_resource_restart(out, rsc, node, options.move_lifetime, options.timeout_ms, cib_conn, - cib_sync_call, options.promoted_role_only, + options.promoted_role_only, options.force); break; @@ -1930,7 +1864,7 @@ main(int argc, char **argv) break; case cmd_clear: - rc = clear_constraints(out, &cib_xml_copy); + rc = clear_constraints(out); break; case cmd_move: @@ -1939,8 +1873,7 @@ main(int argc, char **argv) } else { rc = cli_resource_move(rsc, options.rsc_id, options.host_uname, options.move_lifetime, cib_conn, - cib_sync_call, scheduler, - options.promoted_role_only, + scheduler, options.promoted_role_only, options.force); } @@ -1959,7 +1892,7 @@ main(int argc, char **argv) } else { rc = cli_resource_ban(out, options.rsc_id, node->priv->name, options.move_lifetime, cib_conn, - cib_sync_call, options.promoted_role_only, + options.promoted_role_only, PCMK_ROLE_PROMOTED); } @@ -1970,18 +1903,6 @@ 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; - } - - break; - - case cmd_set_property: - rc = set_property(); - break; - case cmd_get_param: { unsigned int count = 0; GHashTable *params = NULL; @@ -2064,7 +1985,7 @@ main(int argc, char **argv) options.attr_set_type, options.prop_id, options.prop_name, cib_conn, - cib_sync_call, options.force); + options.force); break; case cmd_cleanup: @@ -2160,7 +2081,6 @@ main(int argc, char **argv) free(options.v_agent); free(options.v_class); free(options.v_provider); - g_free(options.xml_file); g_strfreev(options.remainder); if (options.override_params != NULL) { diff --git a/tools/crm_resource.h b/tools/crm_resource.h index de85a5b3585..5855011d5a1 100644 --- a/tools/crm_resource.h +++ b/tools/crm_resource.h @@ -63,14 +63,15 @@ resource_checks_t *cli_check_resource(pcmk_resource_t *rsc, char *role_s, /* 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, + const char *move_lifetime, cib_t *cib_conn, gboolean promoted_role_only, const char *promoted_role); int cli_resource_ban(pcmk__output_t *out, const char *rsc_id, const char *host, - const char *move_lifetime, cib_t *cib_conn, int cib_options, + const char *move_lifetime, cib_t *cib_conn, gboolean promoted_role_only, const char *promoted_role); int cli_resource_clear(const char *rsc_id, const char *host, GList *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, + cib_t *cib_conn, bool clear_ban_constraints, + gboolean force); +int cli_resource_clear_all_expired(xmlNode *root, cib_t *cib_conn, const char *rsc, const char *node, gboolean promoted_role_only); /* print */ @@ -98,11 +99,11 @@ int cli_cleanup_all(pcmk_ipc_api_t *controld_api, const char *node_name, pcmk_scheduler_t *scheduler); int cli_resource_restart(pcmk__output_t *out, pcmk_resource_t *rsc, const pcmk_node_t *node, const char *move_lifetime, - guint timeout_ms, cib_t *cib, int cib_options, + guint timeout_ms, cib_t *cib, gboolean promoted_role_only, gboolean force); int cli_resource_move(const pcmk_resource_t *rsc, const char *rsc_id, const char *host_name, const char *move_lifetime, - cib_t *cib, int cib_options, pcmk_scheduler_t *scheduler, + cib_t *cib, pcmk_scheduler_t *scheduler, 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, @@ -128,7 +129,7 @@ int cli_resource_delete_attribute(pcmk_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, gboolean force); + cib_t *cib, gboolean force); int update_scheduler_input(pcmk_scheduler_t *scheduler, xmlNode **xml); int wait_till_stable(pcmk__output_t *out, guint timeout_ms, cib_t * cib); diff --git a/tools/crm_resource_ban.c b/tools/crm_resource_ban.c index 128cf451274..f5a3af4386a 100644 --- a/tools/crm_resource_ban.c +++ b/tools/crm_resource_ban.c @@ -59,7 +59,7 @@ 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, cib_t * cib_conn, int cib_options, + const char *move_lifetime, cib_t *cib_conn, gboolean promoted_role_only, const char *promoted_role) { char *later_s = NULL; @@ -122,7 +122,7 @@ cli_resource_ban(pcmk__output_t *out, const char *rsc_id, const char *host, crm_log_xml_notice(fragment, "Modify"); rc = cib_conn->cmds->modify(cib_conn, PCMK_XE_CONSTRAINTS, fragment, - cib_options); + cib_sync_call); rc = pcmk_legacy2rc(rc); pcmk__xml_free(fragment); @@ -133,8 +133,8 @@ cli_resource_ban(pcmk__output_t *out, const char *rsc_id, const char *host, && (strcmp(promoted_role, PCMK_ROLE_PROMOTED) == 0)) { int banrc = cli_resource_ban(out, rsc_id, host, move_lifetime, - cib_conn, cib_options, promoted_role_only, - PCMK__ROLE_PROMOTED_LEGACY); + cib_conn, promoted_role_only, + PCMK__ROLE_PROMOTED_LEGACY); if (banrc == pcmk_rc_ok) { rc = banrc; } @@ -146,7 +146,7 @@ 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, + const char *move_lifetime, cib_t *cib_conn, gboolean promoted_role_only, const char *promoted_role) { char *later_s = parse_cli_lifetime(out, move_lifetime); @@ -202,7 +202,7 @@ cli_resource_prefer(pcmk__output_t *out,const char *rsc_id, const char *host, crm_log_xml_info(fragment, "Modify"); rc = cib_conn->cmds->modify(cib_conn, PCMK_XE_CONSTRAINTS, fragment, - cib_options); + cib_sync_call); rc = pcmk_legacy2rc(rc); pcmk__xml_free(fragment); @@ -213,8 +213,8 @@ cli_resource_prefer(pcmk__output_t *out,const char *rsc_id, const char *host, && (strcmp(promoted_role, PCMK_ROLE_PROMOTED) == 0)) { int preferrc = cli_resource_prefer(out, rsc_id, host, move_lifetime, - cib_conn, cib_options, promoted_role_only, - PCMK__ROLE_PROMOTED_LEGACY); + cib_conn, promoted_role_only, + PCMK__ROLE_PROMOTED_LEGACY); if (preferrc == pcmk_rc_ok) { rc = preferrc; } @@ -245,8 +245,8 @@ cli_resource_prefer(pcmk__output_t *out,const char *rsc_id, const char *host, * \return Standard Pacemaker return code */ static int -resource_clear_node_in_expr(const char *rsc_id, const char *host, cib_t * cib_conn, - int cib_options) +resource_clear_node_in_expr(const char *rsc_id, const char *host, + cib_t *cib_conn) { int rc = pcmk_rc_ok; char *xpath_string = NULL; @@ -262,7 +262,8 @@ resource_clear_node_in_expr(const char *rsc_id, const char *host, cib_t * cib_co xpath_string = crm_strdup_printf(XPATH_FMT, rsc_id, rsc_id, host); - rc = cib_conn->cmds->remove(cib_conn, xpath_string, NULL, cib_xpath | cib_options); + rc = cib_conn->cmds->remove(cib_conn, xpath_string, NULL, + cib_xpath|cib_sync_call); if (rc == -ENXIO) { rc = pcmk_rc_ok; } else { @@ -276,7 +277,7 @@ resource_clear_node_in_expr(const char *rsc_id, const char *host, cib_t * cib_co // \return Standard Pacemaker return code static int resource_clear_node_in_location(const char *rsc_id, const char *host, cib_t * cib_conn, - int cib_options, bool clear_ban_constraints, gboolean force) + bool clear_ban_constraints, gboolean force) { int rc = pcmk_rc_ok; xmlNode *fragment = NULL; @@ -297,7 +298,7 @@ resource_clear_node_in_location(const char *rsc_id, const char *host, cib_t * ci crm_log_xml_info(fragment, "Delete"); rc = cib_conn->cmds->remove(cib_conn, PCMK_XE_CONSTRAINTS, fragment, - cib_options); + cib_sync_call); if (rc == -ENXIO) { rc = pcmk_rc_ok; } else { @@ -311,7 +312,7 @@ resource_clear_node_in_location(const char *rsc_id, const char *host, cib_t * ci // \return Standard Pacemaker return code int cli_resource_clear(const char *rsc_id, const char *host, GList *allnodes, cib_t * cib_conn, - int cib_options, bool clear_ban_constraints, gboolean force) + bool clear_ban_constraints, gboolean force) { int rc = pcmk_rc_ok; @@ -320,7 +321,7 @@ cli_resource_clear(const char *rsc_id, const char *host, GList *allnodes, cib_t } if (host) { - rc = resource_clear_node_in_expr(rsc_id, host, cib_conn, cib_options); + rc = resource_clear_node_in_expr(rsc_id, host, cib_conn); /* rc does not tell us whether the previous operation did anything, only * whether it failed or not. Thus, as long as it did not fail, we need @@ -328,8 +329,7 @@ cli_resource_clear(const char *rsc_id, const char *host, GList *allnodes, cib_t */ if (rc == pcmk_rc_ok) { rc = resource_clear_node_in_location(rsc_id, host, cib_conn, - cib_options, clear_ban_constraints, - force); + clear_ban_constraints, force); } } else { @@ -342,8 +342,7 @@ cli_resource_clear(const char *rsc_id, const char *host, GList *allnodes, cib_t pcmk_node_t *target = n->data; rc = cli_resource_clear(rsc_id, target->priv->name, NULL, - cib_conn, cib_options, clear_ban_constraints, - force); + cib_conn, clear_ban_constraints, force); if (rc != pcmk_rc_ok) { break; } @@ -436,8 +435,8 @@ build_clear_xpath_string(GString *buf, const xmlNode *constraint_node, // \return Standard Pacemaker return code 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) +cli_resource_clear_all_expired(xmlNode *root, cib_t *cib_conn, const char *rsc, + const char *node, gboolean promoted_role_only) { GString *buf = NULL; xmlXPathObject *xpathObj = NULL; @@ -492,7 +491,7 @@ cli_resource_clear_all_expired(xmlNode *root, cib_t *cib_conn, int cib_options, crm_log_xml_info(fragment, "Delete"); rc = cib_conn->cmds->remove(cib_conn, PCMK_XE_CONSTRAINTS, fragment, - cib_options); + cib_sync_call); rc = pcmk_legacy2rc(rc); if (rc != pcmk_rc_ok) { diff --git a/tools/crm_resource_print.c b/tools/crm_resource_print.c index e37b7cbd9aa..e8c95fd7a4d 100644 --- a/tools/crm_resource_print.c +++ b/tools/crm_resource_print.c @@ -360,38 +360,6 @@ override_xml(pcmk__output_t *out, va_list args) { return pcmk_rc_ok; } -PCMK__OUTPUT_ARGS("property-list", "pcmk_resource_t *", "const char *") -static int -property_list_default(pcmk__output_t *out, va_list args) { - pcmk_resource_t *rsc = va_arg(args, pcmk_resource_t *); - const char *attr = va_arg(args, char *); - - const char *value = crm_element_value(rsc->priv->xml, attr); - - if (value != NULL) { - out->begin_list(out, NULL, NULL, "Properties"); - out->list_item(out, attr, "%s", value); - out->end_list(out); - } - - return pcmk_rc_ok; -} - -PCMK__OUTPUT_ARGS("property-list", "pcmk_resource_t *", "const char *") -static int -property_list_text(pcmk__output_t *out, va_list args) { - pcmk_resource_t *rsc = va_arg(args, pcmk_resource_t *); - const char *attr = va_arg(args, const char *); - - const char *value = crm_element_value(rsc->priv->xml, attr); - - if (value != NULL) { - pcmk__formatted_printf(out, "%s\n", value); - } - - return pcmk_rc_ok; -} - PCMK__OUTPUT_ARGS("resource-agent-action", "int", "const char *", "const char *", "const char *", "const char *", "const char *", "GHashTable *", "crm_exit_t", "int", "const char *", "const char *", "const char *") @@ -896,8 +864,6 @@ static pcmk__message_entry_t fmt_functions[] = { { "attribute-list", "text", attribute_list_text }, { "override", "default", override_default }, { "override", "xml", override_xml }, - { "property-list", "default", property_list_default }, - { "property-list", "text", property_list_text }, { "resource-agent-action", "default", resource_agent_action_default }, { "resource-agent-action", "xml", resource_agent_action_xml }, { "resource-check-list", "default", resource_check_list_default }, diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c index 54defef53ec..530ae1d866b 100644 --- a/tools/crm_resource_runtime.c +++ b/tools/crm_resource_runtime.c @@ -562,7 +562,7 @@ int cli_resource_delete_attribute(pcmk_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, gboolean force) + cib_t *cib, gboolean force) { pcmk__output_t *out = rsc->priv->scheduler->priv->out; int rc = pcmk_rc_ok; @@ -584,7 +584,7 @@ cli_resource_delete_attribute(pcmk_resource_t *rsc, const char *requested_name, pcmk__xe_remove_attr(rsc->priv->xml, attr_name); pcmk__assert(cib != NULL); rc = cib->cmds->replace(cib, PCMK_XE_RESOURCES, rsc->priv->xml, - cib_options); + cib_sync_call); rc = pcmk_legacy2rc(rc); if (rc == pcmk_rc_ok) { out->info(out, "Deleted attribute: %s", attr_name); @@ -633,7 +633,7 @@ cli_resource_delete_attribute(pcmk_resource_t *rsc, const char *requested_name, crm_log_xml_debug(xml_obj, "Delete"); pcmk__assert(cib != NULL); - rc = cib->cmds->remove(cib, PCMK_XE_RESOURCES, xml_obj, cib_options); + rc = cib->cmds->remove(cib, PCMK_XE_RESOURCES, xml_obj, cib_sync_call); rc = pcmk_legacy2rc(rc); if (rc == pcmk_rc_ok) { @@ -1319,8 +1319,8 @@ static void display_list(pcmk__output_t *out, GList *items, const char *tag) * \param[in,out] xml XML to use as input * * \return Standard Pacemaker return code - * \note On success, caller is responsible for freeing memory allocated for - * scheduler->priv->now. + * \note On success, \p scheduler takes ownership of \p xml, and the caller is + * responsible for freeing memory allocated for \c scheduler->priv->now. */ int update_scheduler_input(pcmk_scheduler_t *scheduler, xmlNode **xml) @@ -1555,8 +1555,6 @@ wait_time_estimate(pcmk_scheduler_t *scheduler, const GList *resources) * used; if 0, it will be calculated based on * the resource timeout) * \param[in,out] cib Connection to the CIB manager - * \param[in] cib_options Group of enum cib_call_options flags to - * use with CIB calls * \param[in] promoted_role_only If true, limit to promoted instances * \param[in] force If true, apply only to requested instance * if part of a collective resource @@ -1566,8 +1564,8 @@ wait_time_estimate(pcmk_scheduler_t *scheduler, const GList *resources) int cli_resource_restart(pcmk__output_t *out, pcmk_resource_t *rsc, const pcmk_node_t *node, const char *move_lifetime, - guint timeout_ms, cib_t *cib, int cib_options, - gboolean promoted_role_only, gboolean force) + guint timeout_ms, cib_t *cib, gboolean promoted_role_only, + gboolean force) { int rc = pcmk_rc_ok; int lpc = 0; @@ -1691,8 +1689,7 @@ cli_resource_restart(pcmk__output_t *out, pcmk_resource_t *rsc, /* Stop the clone or bundle instance by banning it from the host */ out->quiet = true; rc = cli_resource_ban(out, lookup_id, host, move_lifetime, cib, - cib_options, promoted_role_only, - PCMK_ROLE_PROMOTED); + promoted_role_only, PCMK_ROLE_PROMOTED); } else { xmlNode *xml_search = NULL; @@ -1789,7 +1786,7 @@ cli_resource_restart(pcmk__output_t *out, pcmk_resource_t *rsc, } if (stop_via_ban) { - rc = cli_resource_clear(lookup_id, host, NULL, cib, cib_options, true, force); + rc = cli_resource_clear(lookup_id, host, NULL, cib, true, force); } else if (orig_target_role) { rc = cli_resource_update_attribute(rsc, rsc_id, NULL, @@ -1801,8 +1798,7 @@ cli_resource_restart(pcmk__output_t *out, pcmk_resource_t *rsc, } else { rc = cli_resource_delete_attribute(rsc, rsc_id, NULL, PCMK_XE_META_ATTRIBUTES, NULL, - PCMK_META_TARGET_ROLE, cib, - cib_options, force); + PCMK_META_TARGET_ROLE, cib, force); } if(rc != pcmk_rc_ok) { @@ -1874,7 +1870,7 @@ cli_resource_restart(pcmk__output_t *out, pcmk_resource_t *rsc, failure: if (stop_via_ban) { - cli_resource_clear(lookup_id, host, NULL, cib, cib_options, true, force); + cli_resource_clear(lookup_id, host, NULL, cib, true, force); } else if (orig_target_role) { cli_resource_update_attribute(rsc, rsc_id, NULL, PCMK_XE_META_ATTRIBUTES, NULL, @@ -1884,8 +1880,7 @@ cli_resource_restart(pcmk__output_t *out, pcmk_resource_t *rsc, } else { cli_resource_delete_attribute(rsc, rsc_id, NULL, PCMK_XE_META_ATTRIBUTES, NULL, - PCMK_META_TARGET_ROLE, cib, cib_options, - force); + PCMK_META_TARGET_ROLE, cib, force); } done: @@ -2317,8 +2312,8 @@ cli_resource_execute(pcmk_resource_t *rsc, const char *requested_name, int cli_resource_move(const pcmk_resource_t *rsc, const char *rsc_id, const char *host_name, const char *move_lifetime, cib_t *cib, - int cib_options, pcmk_scheduler_t *scheduler, - gboolean promoted_role_only, gboolean force) + pcmk_scheduler_t *scheduler, gboolean promoted_role_only, + gboolean force) { pcmk__output_t *out = scheduler->priv->out; int rc = pcmk_rc_ok; @@ -2393,17 +2388,15 @@ cli_resource_move(const pcmk_resource_t *rsc, const char *rsc_id, } /* Clear any previous prefer constraints across all nodes. */ - cli_resource_clear(rsc_id, NULL, scheduler->nodes, cib, cib_options, false, - force); + cli_resource_clear(rsc_id, NULL, scheduler->nodes, cib, false, force); /* Clear any previous ban constraints on 'dest'. */ - cli_resource_clear(rsc_id, dest->priv->name, scheduler->nodes, cib, - cib_options, TRUE, force); + cli_resource_clear(rsc_id, dest->priv->name, scheduler->nodes, cib, true, + force); /* Record an explicit preference for 'dest' */ rc = cli_resource_prefer(out, rsc_id, dest->priv->name, move_lifetime, - cib, cib_options, promoted_role_only, - PCMK_ROLE_PROMOTED); + cib, promoted_role_only, PCMK_ROLE_PROMOTED); crm_trace("%s%s now prefers %s%s", rsc->id, (promoted_role_only? " (promoted)" : ""), @@ -2416,8 +2409,8 @@ cli_resource_move(const pcmk_resource_t *rsc, const char *rsc_id, /* Ban the original location if possible */ if(current) { (void)cli_resource_ban(out, rsc_id, current->priv->name, - move_lifetime, cib, cib_options, - promoted_role_only, PCMK_ROLE_PROMOTED); + move_lifetime, cib, promoted_role_only, + PCMK_ROLE_PROMOTED); } else if(count > 1) { out->info(out, "Resource '%s' is currently %s in %d locations. " "One may now move to %s",