summaryrefslogtreecommitdiffstats
path: root/tools/crm_resource.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tools/crm_resource.c339
1 files changed, 124 insertions, 215 deletions
diff --git a/tools/crm_resource.c b/tools/crm_resource.c
index f351c26..7c4a0a1 100644
--- a/tools/crm_resource.c
+++ b/tools/crm_resource.c
@@ -76,7 +76,7 @@ struct {
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_scheduler; // Whether command requires scheduler data
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
@@ -117,7 +117,7 @@ struct {
.check_level = -1,
.cib_options = cib_sync_call,
.require_cib = TRUE,
- .require_dataset = TRUE,
+ .require_scheduler = TRUE,
.require_resource = TRUE,
};
@@ -183,7 +183,7 @@ static GError *error = NULL;
static GMainLoop *mainloop = NULL;
static cib_t *cib_conn = NULL;
static pcmk_ipc_api_t *controld_api = NULL;
-static pe_working_set_t *data_set = NULL;
+static pcmk_scheduler_t *scheduler = NULL;
#define MESSAGE_TIMEOUT_S 60
@@ -227,8 +227,8 @@ bye(crm_exit_t ec)
mainloop = NULL;
}
- pe_free_working_set(data_set);
- data_set = NULL;
+ pe_free_working_set(scheduler);
+ scheduler = NULL;
crm_exit(ec);
return ec;
}
@@ -650,7 +650,7 @@ reset_options(void) {
options.require_node = FALSE;
options.require_cib = TRUE;
- options.require_dataset = TRUE;
+ options.require_scheduler = TRUE;
options.require_resource = TRUE;
options.find_flags = 0;
@@ -702,15 +702,15 @@ cleanup_refresh_cb(const gchar *option_name, const gchar *optarg, gpointer data,
if (getenv("CIB_file") == NULL) {
options.require_crmd = TRUE;
}
- options.find_flags = pe_find_renamed|pe_find_anon;
+ options.find_flags = pcmk_rsc_match_history|pcmk_rsc_match_anon_basename;
return TRUE;
}
gboolean
delete_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError **error) {
SET_COMMAND(cmd_delete);
- options.require_dataset = FALSE;
- options.find_flags = pe_find_renamed|pe_find_any;
+ options.require_scheduler = FALSE;
+ options.find_flags = pcmk_rsc_match_history|pcmk_rsc_match_basename;
return TRUE;
}
@@ -725,7 +725,7 @@ static void
get_agent_spec(const gchar *optarg)
{
options.require_cib = FALSE;
- options.require_dataset = FALSE;
+ options.require_scheduler = FALSE;
options.require_resource = FALSE;
pcmk__str_update(&options.agent_spec, optarg);
}
@@ -754,7 +754,7 @@ list_standards_cb(const gchar *option_name, const gchar *optarg, gpointer data,
{
SET_COMMAND(cmd_list_standards);
options.require_cib = FALSE;
- options.require_dataset = FALSE;
+ options.require_scheduler = FALSE;
options.require_resource = FALSE;
return TRUE;
}
@@ -806,30 +806,36 @@ gboolean
flag_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError **error) {
if (pcmk__str_any_of(option_name, "-U", "--clear", NULL)) {
SET_COMMAND(cmd_clear);
- options.find_flags = pe_find_renamed|pe_find_anon;
+ options.find_flags = pcmk_rsc_match_history
+ |pcmk_rsc_match_anon_basename;
} else if (pcmk__str_any_of(option_name, "-B", "--ban", NULL)) {
SET_COMMAND(cmd_ban);
- options.find_flags = pe_find_renamed|pe_find_anon;
+ options.find_flags = pcmk_rsc_match_history
+ |pcmk_rsc_match_anon_basename;
} else if (pcmk__str_any_of(option_name, "-M", "--move", NULL)) {
SET_COMMAND(cmd_move);
- options.find_flags = pe_find_renamed|pe_find_anon;
+ options.find_flags = pcmk_rsc_match_history
+ |pcmk_rsc_match_anon_basename;
} else if (pcmk__str_any_of(option_name, "-q", "--query-xml", NULL)) {
SET_COMMAND(cmd_query_xml);
- options.find_flags = pe_find_renamed|pe_find_any;
+ options.find_flags = pcmk_rsc_match_history|pcmk_rsc_match_basename;
} else if (pcmk__str_any_of(option_name, "-w", "--query-xml-raw", NULL)) {
SET_COMMAND(cmd_query_raw_xml);
- options.find_flags = pe_find_renamed|pe_find_any;
+ options.find_flags = pcmk_rsc_match_history|pcmk_rsc_match_basename;
} else if (pcmk__str_any_of(option_name, "-W", "--locate", NULL)) {
SET_COMMAND(cmd_locate);
- options.find_flags = pe_find_renamed|pe_find_anon;
+ options.find_flags = pcmk_rsc_match_history
+ |pcmk_rsc_match_anon_basename;
} else if (pcmk__str_any_of(option_name, "-a", "--constraints", NULL)) {
SET_COMMAND(cmd_colocations);
- options.find_flags = pe_find_renamed|pe_find_anon;
+ options.find_flags = pcmk_rsc_match_history
+ |pcmk_rsc_match_anon_basename;
} else if (pcmk__str_any_of(option_name, "-A", "--stack", NULL)) {
SET_COMMAND(cmd_colocations);
- options.find_flags = pe_find_renamed|pe_find_anon;
+ options.find_flags = pcmk_rsc_match_history
+ |pcmk_rsc_match_anon_basename;
options.recursive = TRUE;
}
@@ -845,7 +851,7 @@ get_param_prop_cb(const gchar *option_name, const gchar *optarg, gpointer data,
}
pcmk__str_update(&options.prop_name, optarg);
- options.find_flags = pe_find_renamed|pe_find_any;
+ options.find_flags = pcmk_rsc_match_history|pcmk_rsc_match_basename;
return TRUE;
}
@@ -876,16 +882,16 @@ set_delete_param_cb(const gchar *option_name, const gchar *optarg, gpointer data
}
pcmk__str_update(&options.prop_name, optarg);
- options.find_flags = pe_find_renamed|pe_find_any;
+ options.find_flags = pcmk_rsc_match_history|pcmk_rsc_match_basename;
return TRUE;
}
gboolean
set_prop_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError **error) {
SET_COMMAND(cmd_set_property);
- options.require_dataset = FALSE;
+ options.require_scheduler = FALSE;
pcmk__str_update(&options.prop_name, optarg);
- options.find_flags = pe_find_renamed|pe_find_any;
+ options.find_flags = pcmk_rsc_match_history|pcmk_rsc_match_basename;
return TRUE;
}
@@ -904,7 +910,7 @@ validate_or_force_cb(const gchar *option_name, const gchar *optarg,
g_free(options.operation);
}
options.operation = g_strdup(option_name + 2); // skip "--"
- options.find_flags = pe_find_renamed|pe_find_anon;
+ options.find_flags = pcmk_rsc_match_history|pcmk_rsc_match_anon_basename;
if (options.override_params == NULL) {
options.override_params = pcmk__strkey_table(free, free);
}
@@ -925,7 +931,7 @@ restart_cb(const gchar *option_name, const gchar *optarg, gpointer data,
GError **error)
{
SET_COMMAND(cmd_restart);
- options.find_flags = pe_find_renamed|pe_find_anon;
+ options.find_flags = pcmk_rsc_match_history|pcmk_rsc_match_anon_basename;
return TRUE;
}
@@ -934,12 +940,12 @@ 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;
+ options.find_flags = pcmk_rsc_match_history|pcmk_rsc_match_anon_basename;
if (options.override_params == NULL) {
options.override_params = pcmk__strkey_table(free, free);
}
options.require_node = TRUE;
- options.require_dataset = TRUE;
+ options.require_scheduler = TRUE;
return TRUE;
}
@@ -947,7 +953,7 @@ gboolean
wait_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError **error) {
SET_COMMAND(cmd_wait);
options.require_resource = FALSE;
- options.require_dataset = FALSE;
+ options.require_scheduler = FALSE;
return TRUE;
}
@@ -955,15 +961,16 @@ gboolean
why_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError **error) {
SET_COMMAND(cmd_why);
options.require_resource = FALSE;
- options.find_flags = pe_find_renamed|pe_find_anon;
+ options.find_flags = pcmk_rsc_match_history|pcmk_rsc_match_anon_basename;
return TRUE;
}
static int
-ban_or_move(pcmk__output_t *out, pe_resource_t *rsc, const char *move_lifetime)
+ban_or_move(pcmk__output_t *out, pcmk_resource_t *rsc,
+ const char *move_lifetime)
{
int rc = pcmk_rc_ok;
- pe_node_t *current = NULL;
+ pcmk_node_t *current = NULL;
unsigned int nactive = 0;
CRM_CHECK(rsc != NULL, return EINVAL);
@@ -971,27 +978,29 @@ 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,
- cib_conn, options.cib_options, options.promoted_role_only);
+ rc = cli_resource_ban(out, options.rsc_id, current->details->uname, move_lifetime,
+ cib_conn, options.cib_options, options.promoted_role_only,
+ PCMK__ROLE_PROMOTED);
- } else if (pcmk_is_set(rsc->flags, pe_rsc_promotable)) {
+ } else if (pcmk_is_set(rsc->flags, pcmk_rsc_promotable)) {
int count = 0;
GList *iter = NULL;
current = NULL;
for(iter = rsc->children; iter; iter = iter->next) {
- pe_resource_t *child = (pe_resource_t *)iter->data;
+ pcmk_resource_t *child = (pcmk_resource_t *)iter->data;
enum rsc_role_e child_role = child->fns->state(child, TRUE);
- if (child_role == RSC_ROLE_PROMOTED) {
+ if (child_role == pcmk_role_promoted) {
count++;
current = pe__current_node(child);
}
}
if(count == 1 && current) {
- rc = cli_resource_ban(out, options.rsc_id, current->details->uname, move_lifetime, NULL,
- cib_conn, options.cib_options, options.promoted_role_only);
+ rc = cli_resource_ban(out, options.rsc_id, current->details->uname, move_lifetime,
+ cib_conn, options.cib_options, options.promoted_role_only,
+ PCMK__ROLE_PROMOTED);
} else {
rc = EINVAL;
@@ -1017,7 +1026,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, pe_node_t *node)
+cleanup(pcmk__output_t *out, pcmk_resource_t *rsc, pcmk_node_t *node)
{
int rc = pcmk_rc_ok;
@@ -1027,8 +1036,9 @@ cleanup(pcmk__output_t *out, pe_resource_t *rsc, pe_node_t *node)
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(controld_api, options.host_uname, rsc, options.operation,
- options.interval_spec, TRUE, data_set, options.force);
+ rc = cli_resource_delete(controld_api, options.host_uname, rsc,
+ options.operation, options.interval_spec, TRUE,
+ scheduler, options.force);
if ((rc == pcmk_rc_ok) && !out->is_quiet(out)) {
// Show any reasons why resource might stay stopped
@@ -1047,20 +1057,21 @@ clear_constraints(pcmk__output_t *out, xmlNodePtr *cib_xml_copy)
GList *after = NULL;
GList *remaining = NULL;
GList *ele = NULL;
- pe_node_t *dest = NULL;
+ pcmk_node_t *dest = NULL;
int rc = pcmk_rc_ok;
if (!out->is_quiet(out)) {
- before = build_constraint_list(data_set->input);
+ before = build_constraint_list(scheduler->input);
}
if (options.clear_expired) {
- rc = cli_resource_clear_all_expired(data_set->input, cib_conn, options.cib_options,
- options.rsc_id, options.host_uname,
+ rc = cli_resource_clear_all_expired(scheduler->input, cib_conn,
+ options.cib_options, options.rsc_id,
+ options.host_uname,
options.promoted_role_only);
} else if (options.host_uname) {
- dest = pe_find_node(data_set->nodes, options.host_uname);
+ dest = pe_find_node(scheduler->nodes, options.host_uname);
if (dest == NULL) {
rc = pcmk_rc_node_unknown;
if (!out->is_quiet(out)) {
@@ -1072,7 +1083,7 @@ clear_constraints(pcmk__output_t *out, xmlNodePtr *cib_xml_copy)
cib_conn, options.cib_options, TRUE, options.force);
} else {
- rc = cli_resource_clear(options.rsc_id, NULL, data_set->nodes,
+ rc = cli_resource_clear(options.rsc_id, NULL, scheduler->nodes,
cib_conn, options.cib_options, TRUE, options.force);
}
@@ -1082,17 +1093,17 @@ clear_constraints(pcmk__output_t *out, xmlNodePtr *cib_xml_copy)
if (rc != pcmk_rc_ok) {
g_set_error(&error, PCMK__RC_ERROR, rc,
- _("Could not get modified CIB: %s\n"), pcmk_strerror(rc));
+ _("Could not get modified CIB: %s\n"), pcmk_rc_str(rc));
g_list_free(before);
free_xml(*cib_xml_copy);
*cib_xml_copy = NULL;
return rc;
}
- data_set->input = *cib_xml_copy;
- cluster_status(data_set);
+ scheduler->input = *cib_xml_copy;
+ cluster_status(scheduler);
- after = build_constraint_list(data_set->input);
+ after = build_constraint_list(scheduler->input);
remaining = pcmk__subtract_lists(before, after, (GCompareFunc) strcmp);
for (ele = remaining; ele != NULL; ele = ele->next) {
@@ -1131,119 +1142,7 @@ delete(void)
}
static int
-list_agents(pcmk__output_t *out, const char *agent_spec)
-{
- int rc = pcmk_rc_ok;
- char *provider = strchr(agent_spec, ':');
- lrmd_t *lrmd_conn = NULL;
- lrmd_list_t *list = NULL;
-
- rc = lrmd__new(&lrmd_conn, NULL, NULL, 0);
- if (rc != pcmk_rc_ok) {
- goto error;
- }
-
- 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);
- } else {
- rc = pcmk_rc_error;
- }
-
-error:
- if (rc != pcmk_rc_ok) {
- if (provider == NULL) {
- g_set_error(&error, PCMK__RC_ERROR, rc,
- _("No agents found for standard '%s'"), agent_spec);
- } else {
- g_set_error(&error, PCMK__RC_ERROR, rc,
- _("No agents found for standard '%s' and provider '%s'"),
- agent_spec, provider);
- }
- }
-
- lrmd_api_delete(lrmd_conn);
- return rc;
-}
-
-static int
-list_providers(pcmk__output_t *out, const char *agent_spec)
-{
- int rc;
- const char *text = NULL;
- lrmd_t *lrmd_conn = NULL;
- lrmd_list_t *list = NULL;
-
- rc = lrmd__new(&lrmd_conn, NULL, NULL, 0);
- if (rc != pcmk_rc_ok) {
- goto error;
- }
-
- 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;
- }
-
- text = "OCF providers";
- break;
- default:
- g_set_error(&error, PCMK__RC_ERROR, pcmk_rc_error, "Bug");
- lrmd_api_delete(lrmd_conn);
- return pcmk_rc_error;
- }
-
-error:
- if (rc != pcmk_rc_ok) {
- if (agent_spec != NULL) {
- rc = ENXIO;
- g_set_error(&error, PCMK__RC_ERROR, rc,
- _("No %s found for %s"), text, agent_spec);
-
- } else {
- rc = ENXIO;
- g_set_error(&error, PCMK__RC_ERROR, rc,
- _("No %s found"), text);
- }
- }
-
- lrmd_api_delete(lrmd_conn);
- return rc;
-}
-
-static int
-populate_working_set(xmlNodePtr *cib_xml_copy)
+initialize_scheduler_data(xmlNodePtr *cib_xml_copy)
{
int rc = pcmk_rc_ok;
@@ -1258,14 +1157,15 @@ populate_working_set(xmlNodePtr *cib_xml_copy)
}
if (rc == pcmk_rc_ok) {
- data_set = pe_new_working_set();
- if (data_set == NULL) {
+ scheduler = pe_new_working_set();
+ if (scheduler == NULL) {
rc = ENOMEM;
} else {
- pe__set_working_set_flags(data_set,
- pe_flag_no_counts|pe_flag_no_compat);
- data_set->priv = out;
- rc = update_working_set_xml(data_set, cib_xml_copy);
+ pe__set_working_set_flags(scheduler,
+ pcmk_sched_no_counts
+ |pcmk_sched_no_compat);
+ scheduler->priv = out;
+ rc = update_scheduler_input(scheduler, cib_xml_copy);
}
}
@@ -1275,7 +1175,7 @@ populate_working_set(xmlNodePtr *cib_xml_copy)
return rc;
}
- cluster_status(data_set);
+ cluster_status(scheduler);
return pcmk_rc_ok;
}
@@ -1287,7 +1187,7 @@ refresh(pcmk__output_t *out)
int attr_options = pcmk__node_attr_none;
if (options.host_uname) {
- pe_node_t *node = pe_find_node(data_set->nodes, options.host_uname);
+ pcmk_node_t *node = pe_find_node(scheduler->nodes, options.host_uname);
if (pe__is_guest_or_remote_node(node)) {
node = pe__current_node(node->details->remote_rsc);
@@ -1324,7 +1224,7 @@ refresh(pcmk__output_t *out)
}
static void
-refresh_resource(pcmk__output_t *out, pe_resource_t *rsc, pe_node_t *node)
+refresh_resource(pcmk__output_t *out, pcmk_resource_t *rsc, pcmk_node_t *node)
{
int rc = pcmk_rc_ok;
@@ -1335,7 +1235,7 @@ refresh_resource(pcmk__output_t *out, pe_resource_t *rsc, pe_node_t *node)
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(controld_api, options.host_uname, rsc, NULL, 0,
- FALSE, data_set, options.force);
+ FALSE, scheduler, options.force);
if ((rc == pcmk_rc_ok) && !out->is_quiet(out)) {
// Show any reasons why resource might stay stopped
@@ -1474,7 +1374,7 @@ validate_cmdline_config(void)
options.cmdline_params = pcmk__strkey_table(free, free);
}
options.require_resource = FALSE;
- options.require_dataset = FALSE;
+ options.require_scheduler = FALSE;
options.require_cib = FALSE;
}
@@ -1547,8 +1447,8 @@ int
main(int argc, char **argv)
{
xmlNode *cib_xml_copy = NULL;
- pe_resource_t *rsc = NULL;
- pe_node_t *node = NULL;
+ pcmk_resource_t *rsc = NULL;
+ pcmk_node_t *node = NULL;
int rc = pcmk_rc_ok;
GOptionGroup *output_group = NULL;
@@ -1730,7 +1630,7 @@ main(int argc, char **argv)
*/
if (options.find_flags && options.rsc_id) {
- options.require_dataset = TRUE;
+ options.require_scheduler = TRUE;
}
// Establish a connection to the CIB if needed
@@ -1752,9 +1652,9 @@ main(int argc, char **argv)
}
}
- /* Populate working set from XML file if specified or CIB query otherwise */
- if (options.require_dataset) {
- rc = populate_working_set(&cib_xml_copy);
+ // Populate scheduler data from XML file if specified or CIB query otherwise
+ if (options.require_scheduler) {
+ rc = initialize_scheduler_data(&cib_xml_copy);
if (rc != pcmk_rc_ok) {
exit_code = pcmk_rc2exitc(rc);
goto done;
@@ -1763,7 +1663,7 @@ main(int argc, char **argv)
// If command requires that resource exist if specified, find it
if (options.find_flags && options.rsc_id) {
- rsc = pe_find_resource_with_flags(data_set->resources, options.rsc_id,
+ rsc = pe_find_resource_with_flags(scheduler->resources, options.rsc_id,
options.find_flags);
if (rsc == NULL) {
exit_code = CRM_EX_NOSUCH;
@@ -1786,8 +1686,8 @@ 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);
+ if ((options.host_uname != NULL) && (scheduler != NULL)) {
+ node = pe_find_node(scheduler->nodes, options.host_uname);
if (node == NULL) {
exit_code = CRM_EX_NOSUCH;
@@ -1808,11 +1708,12 @@ main(int argc, char **argv)
}
pcmk_register_ipc_callback(controld_api, controller_event_callback,
NULL);
- rc = pcmk_connect_ipc(controld_api, pcmk_ipc_dispatch_main);
+ rc = pcmk__connect_ipc(controld_api, pcmk_ipc_dispatch_main, 5);
if (rc != pcmk_rc_ok) {
exit_code = pcmk_rc2exitc(rc);
g_set_error(&error, PCMK__EXITC_ERROR, exit_code,
- _("Error connecting to the controller: %s"), pcmk_rc_str(rc));
+ _("Error connecting to %s: %s"),
+ pcmk_ipc_name(controld_api, true), pcmk_rc_str(rc));
goto done;
}
}
@@ -1825,7 +1726,7 @@ main(int argc, char **argv)
case cmd_list_resources: {
GList *all = NULL;
all = g_list_prepend(all, (gpointer) "*");
- rc = out->message(out, "resource-list", data_set,
+ rc = out->message(out, "resource-list", scheduler,
pcmk_show_inactive_rscs | pcmk_show_rsc_only | pcmk_show_pending,
true, all, all, false);
g_list_free(all);
@@ -1837,7 +1738,7 @@ main(int argc, char **argv)
}
case cmd_list_instances:
- rc = out->message(out, "resource-names-list", data_set->resources);
+ rc = out->message(out, "resource-names-list", scheduler->resources);
if (rc != pcmk_rc_ok) {
rc = ENXIO;
@@ -1845,14 +1746,20 @@ main(int argc, char **argv)
break;
- case cmd_list_standards:
- case cmd_list_providers:
case cmd_list_alternatives:
- rc = list_providers(out, options.agent_spec);
+ rc = pcmk__list_alternatives(out, options.agent_spec);
break;
case cmd_list_agents:
- rc = list_agents(out, options.agent_spec);
+ rc = pcmk__list_agents(out, options.agent_spec);
+ break;
+
+ case cmd_list_standards:
+ rc = pcmk__list_standards(out);
+ break;
+
+ case cmd_list_providers:
+ rc = pcmk__list_providers(out, options.agent_spec);
break;
case cmd_metadata:
@@ -1860,10 +1767,10 @@ main(int argc, char **argv)
break;
case cmd_restart:
- /* We don't pass data_set because rsc needs to stay valid for the
+ /* We don't pass scheduler because rsc needs to stay valid for the
* entire lifetime of cli_resource_restart(), but it will reset and
- * update the working set multiple times, so it needs to use its own
- * copy.
+ * update the scheduler data multiple times, so it needs to use its
+ * own copy.
*/
rc = cli_resource_restart(out, rsc, node, options.move_lifetime,
options.timeout_ms, cib_conn,
@@ -1885,13 +1792,13 @@ main(int argc, char **argv)
} else {
exit_code = cli_resource_execute(rsc, options.rsc_id,
options.operation, options.override_params,
- options.timeout_ms, cib_conn, data_set,
+ options.timeout_ms, cib_conn, scheduler,
args->verbosity, options.force, options.check_level);
}
goto done;
case cmd_digests:
- node = pe_find_node(data_set->nodes, options.host_uname);
+ node = pe_find_node(scheduler->nodes, options.host_uname);
if (node == NULL) {
rc = pcmk_rc_node_unknown;
} else {
@@ -1901,19 +1808,20 @@ main(int argc, char **argv)
break;
case cmd_colocations:
- rc = out->message(out, "locations-and-colocations", rsc, data_set,
+ rc = out->message(out, "locations-and-colocations", rsc,
options.recursive, (bool) options.force);
break;
case cmd_cts:
rc = pcmk_rc_ok;
- g_list_foreach(data_set->resources, (GFunc) cli_resource_print_cts, out);
- cli_resource_print_cts_constraints(data_set);
+ g_list_foreach(scheduler->resources, (GFunc) cli_resource_print_cts,
+ out);
+ cli_resource_print_cts_constraints(scheduler);
break;
case cmd_fail:
rc = cli_resource_fail(controld_api, options.host_uname,
- options.rsc_id, data_set);
+ options.rsc_id, scheduler);
if (rc == pcmk_rc_ok) {
start_mainloop(controld_api);
}
@@ -1922,28 +1830,28 @@ main(int argc, char **argv)
case cmd_list_active_ops:
rc = cli_resource_print_operations(options.rsc_id,
options.host_uname, TRUE,
- data_set);
+ scheduler);
break;
case cmd_list_all_ops:
rc = cli_resource_print_operations(options.rsc_id,
options.host_uname, FALSE,
- data_set);
+ scheduler);
break;
case cmd_locate: {
- GList *nodes = cli_resource_search(rsc, options.rsc_id, data_set);
+ GList *nodes = cli_resource_search(rsc, options.rsc_id, scheduler);
rc = out->message(out, "resource-search-list", nodes, options.rsc_id);
g_list_free_full(nodes, free);
break;
}
case cmd_query_xml:
- rc = cli_resource_print(rsc, data_set, true);
+ rc = cli_resource_print(rsc, scheduler, true);
break;
case cmd_query_raw_xml:
- rc = cli_resource_print(rsc, data_set, false);
+ rc = cli_resource_print(rsc, scheduler, false);
break;
case cmd_why:
@@ -1951,7 +1859,7 @@ main(int argc, char **argv)
rc = pcmk_rc_node_unknown;
} else {
rc = out->message(out, "resource-reasons-list",
- data_set->resources, rsc, node);
+ scheduler->resources, rsc, node);
}
break;
@@ -1965,7 +1873,7 @@ main(int argc, char **argv)
} else {
rc = cli_resource_move(rsc, options.rsc_id, options.host_uname,
options.move_lifetime, cib_conn,
- options.cib_options, data_set,
+ options.cib_options, scheduler,
options.promoted_role_only,
options.force);
}
@@ -1984,9 +1892,10 @@ main(int argc, char **argv)
rc = pcmk_rc_node_unknown;
} else {
rc = cli_resource_ban(out, options.rsc_id, node->details->uname,
- options.move_lifetime, NULL, cib_conn,
+ options.move_lifetime, cib_conn,
options.cib_options,
- options.promoted_role_only);
+ options.promoted_role_only,
+ PCMK__ROLE_PROMOTED);
}
if (rc == EINVAL) {
@@ -2011,7 +1920,7 @@ main(int argc, char **argv)
case cmd_get_param: {
unsigned int count = 0;
GHashTable *params = NULL;
- pe_node_t *current = rsc->fns->active_node(rsc, &count, NULL);
+ pcmk_node_t *current = rsc->fns->active_node(rsc, &count, NULL);
bool free_params = true;
const char* value = NULL;
@@ -2025,14 +1934,14 @@ main(int argc, char **argv)
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_none)) {
- params = pe_rsc_params(rsc, current, data_set);
+ params = pe_rsc_params(rsc, current, scheduler);
free_params = false;
value = g_hash_table_lookup(params, options.prop_name);
} else if (pcmk__str_eq(options.attr_set_type, XML_TAG_META_SETS, pcmk__str_none)) {
params = pcmk__strkey_table(free, free);
- get_meta_attributes(params, rsc, current, data_set);
+ get_meta_attributes(params, rsc, current, scheduler);
value = g_hash_table_lookup(params, options.prop_name);
@@ -2044,7 +1953,7 @@ main(int argc, char **argv)
} else {
params = pcmk__strkey_table(free, free);
pe__unpack_dataset_nvpairs(rsc->xml, XML_TAG_UTILIZATION, NULL, params,
- NULL, FALSE, data_set);
+ NULL, FALSE, scheduler);
value = g_hash_table_lookup(params, options.prop_name);
}
@@ -2092,7 +2001,7 @@ main(int argc, char **argv)
if (rsc == NULL) {
rc = cli_cleanup_all(controld_api, options.host_uname,
options.operation, options.interval_spec,
- data_set);
+ scheduler);
if (rc == pcmk_rc_ok) {
start_mainloop(controld_api);
}