17 #include <libxml/tree.h> 30 (dependents?
"needs" :
"with"),
43 xmlNodePtr node = NULL;
74 for (lpc = list; lpc != NULL; lpc = lpc->next) {
79 for (lpc2 = cons->
node_list_rh; lpc2 != NULL; lpc2 = lpc2->next) {
103 "pe_node_t *",
"pe_node_t *",
"pe_action_t *",
108 const char *change = va_arg(args,
const char *);
117 char *details = NULL;
118 bool same_host =
false;
119 bool same_role =
false;
120 bool need_role =
false;
122 static int rsc_width = 5;
123 static int detail_width = 5;
126 CRM_ASSERT(destination != NULL || origin != NULL);
132 len = strlen(rsc->
id);
133 if(len > rsc_width) {
142 if(origin != NULL && destination != NULL && origin->
details == destination->
details) {
150 if (need_role && (origin == NULL)) {
154 pe__node_name(destination));
156 }
else if (origin == NULL) {
160 }
else if (need_role && (destination == NULL)) {
163 pe__node_name(origin));
165 }
else if (destination == NULL) {
169 }
else if (need_role && same_role && same_host) {
172 pe__node_name(origin));
174 }
else if (same_role && same_host) {
178 }
else if (need_role && same_role) {
181 pe__node_name(destination),
184 }
else if (same_role) {
187 pe__node_name(destination));
189 }
else if (same_host) {
193 pe__node_name(origin));
198 pe__node_name(origin),
200 pe__node_name(destination));
203 len = strlen(details);
204 if(len > detail_width) {
211 }
else if(source->
reason) {
215 reason = strdup(
"blocked");
219 out->list_item(out, NULL,
"%-8s %-*s ( %*s )%s%s", change, rsc_width,
220 rsc->
id, detail_width, details, reason ?
" " :
"", reason ? reason :
"");
228 "pe_node_t *",
"pe_node_t *",
"pe_action_t *",
233 const char *change = va_arg(args,
const char *);
240 char *change_str = NULL;
242 bool same_host =
false;
243 bool same_role =
false;
244 bool need_role =
false;
248 CRM_ASSERT(destination != NULL || origin != NULL);
250 if (source == NULL) {
259 if(origin != NULL && destination != NULL && origin->
details == destination->
details) {
267 change_str = g_ascii_strdown(change, -1);
269 "action", change_str,
274 if (need_role && (origin == NULL)) {
282 }
else if (origin == NULL) {
286 }
else if (need_role && (destination == NULL)) {
293 }
else if (destination == NULL) {
297 }
else if (need_role && same_role && same_host) {
304 }
else if (same_role && same_host) {
308 }
else if (need_role && same_role) {
316 }
else if (same_role) {
323 }
else if (same_host) {
347 }
else if(source->
reason) {
362 bool recursive = va_arg(args,
int);
371 for (GList *lpc = rsc->
rsc_cons; lpc != NULL; lpc = lpc->next) {
378 out->list_item(out, NULL,
"%s (id=%s - loop)",
383 hdr = colocations_header(cons->
primary, cons,
false);
384 out->list_item(out, NULL,
"%s", hdr);
388 out->begin_list(out, NULL, NULL, NULL);
390 out->message(out,
"locations-list", cons->
primary);
392 out->message(out,
"rsc-is-colocated-with-list",
405 rsc_is_colocated_with_list_xml(
pcmk__output_t *out, va_list args) {
407 bool recursive = va_arg(args,
int);
416 for (GList *lpc = rsc->
rsc_cons; lpc != NULL; lpc = lpc->next) {
420 colocations_xml_node(out, cons->
primary, cons);
424 colocations_xml_node(out, cons->
primary, cons);
425 do_locations_list_xml(out, cons->
primary,
false);
428 out->message(out,
"rsc-is-colocated-with-list",
440 bool recursive = va_arg(args,
int);
449 for (GList *lpc = rsc->
rsc_cons_lhs; lpc != NULL; lpc = lpc->next) {
456 out->list_item(out, NULL,
"%s (id=%s - loop)",
461 hdr = colocations_header(cons->
dependent, cons,
true);
462 out->list_item(out, NULL,
"%s", hdr);
466 out->begin_list(out, NULL, NULL, NULL);
468 out->message(out,
"locations-list", cons->
dependent);
470 out->message(out,
"rscs-colocated-with-list",
485 bool recursive = va_arg(args,
int);
494 for (GList *lpc = rsc->
rsc_cons_lhs; lpc != NULL; lpc = lpc->next) {
498 colocations_xml_node(out, cons->
dependent, cons);
502 colocations_xml_node(out, cons->
dependent, cons);
503 do_locations_list_xml(out, cons->
dependent,
false);
506 out->message(out,
"rscs-colocated-with-list",
523 for (lpc = list; lpc != NULL; lpc = lpc->next) {
528 for (lpc2 = cons->
node_list_rh; lpc2 != NULL; lpc2 = lpc2->next) {
532 out->list_item(out, NULL,
"Node %s (score=%s, id=%s, rsc=%s)",
547 return do_locations_list_xml(out, rsc,
true);
551 "pe_working_set_t *",
"bool",
"bool")
557 bool recursive = va_arg(args,
int);
558 bool force = va_arg(args,
int);
567 out->message(out,
"locations-list", rsc);
570 out->message(out,
"rscs-colocated-with-list", rsc, recursive);
573 out->message(out,
"rsc-is-colocated-with-list", rsc, recursive);
578 "pe_working_set_t *",
"bool",
"bool")
584 bool recursive = va_arg(args,
int);
585 bool force = va_arg(args,
int);
595 do_locations_list_xml(out, rsc,
false);
598 out->message(out,
"rscs-colocated-with-list", rsc, recursive);
601 out->message(out,
"rsc-is-colocated-with-list", rsc, recursive);
607 PCMK__OUTPUT_ARGS(
"health",
"const char *",
"const char *",
"const char *",
"const char *")
611 const char *sys_from G_GNUC_UNUSED = va_arg(args,
const char *);
612 const char *host_from = va_arg(args,
const char *);
613 const char *fsa_state = va_arg(args,
const char *);
614 const char *
result = va_arg(args,
const char *);
616 return out->info(out,
"Controller on %s in state %s: %s",
617 pcmk__s(host_from,
"unknown node"),
618 pcmk__s(fsa_state,
"unknown"),
619 pcmk__s(
result,
"unknown result"));
622 PCMK__OUTPUT_ARGS(
"health",
"const char *",
"const char *",
"const char *",
"const char *")
626 if (!out->is_quiet(out)) {
627 return health(out, args);
629 const char *sys_from G_GNUC_UNUSED = va_arg(args,
const char *);
630 const char *host_from G_GNUC_UNUSED = va_arg(args,
const char *);
631 const char *fsa_state = va_arg(args,
const char *);
632 const char *
result G_GNUC_UNUSED = va_arg(args,
const char *);
634 if (fsa_state != NULL) {
643 PCMK__OUTPUT_ARGS(
"health",
"const char *",
"const char *",
"const char *",
"const char *")
647 const char *sys_from = va_arg(args,
const char *);
648 const char *host_from = va_arg(args,
const char *);
649 const char *fsa_state = va_arg(args,
const char *);
650 const char *
result = va_arg(args,
const char *);
653 "node_name", pcmk__s(host_from,
""),
654 "state", pcmk__s(fsa_state,
""),
655 "result", pcmk__s(
result,
""),
665 const char *sys_from = va_arg(args,
const char *);
668 const char *state_s = va_arg(args,
const char *);
669 const char *last_updated = va_arg(args,
const char *);
671 if (state_s == NULL) {
674 return out->info(out,
"Status of %s: '%s' (last updated %s)",
675 pcmk__s(sys_from,
"unknown subsystem"), state_s,
676 pcmk__s(last_updated,
"at unknown time"));
684 const char *sys_from = va_arg(args,
const char *);
687 const char *state_s = va_arg(args,
const char *);
688 const char *last_updated = va_arg(args,
const char *);
691 if (state_s == NULL) {
696 pcmk__s(sys_from,
"unknown subsystem"), state_s,
697 pcmk__s(last_updated,
"at unknown time"));
709 if (!out->is_quiet(out)) {
710 return pacemakerd_health(out, args);
712 const char *sys_from G_GNUC_UNUSED = va_arg(args,
const char *);
715 const char *state_s = va_arg(args,
const char *);
716 const char *last_updated G_GNUC_UNUSED = va_arg(args,
const char *);
718 if (state_s == NULL) {
731 const char *sys_from = va_arg(args,
const char *);
734 const char *state_s = va_arg(args,
const char *);
735 const char *last_updated = va_arg(args,
const char *);
737 if (state_s == NULL) {
742 "sys_from", sys_from,
744 "last_updated", last_updated,
752 const char *xml_file = va_arg(args,
const char *);
753 clock_t start = va_arg(args, clock_t);
754 clock_t end = va_arg(args, clock_t);
756 out->list_item(out, NULL,
"Testing %s ... %.2f secs", xml_file,
757 (end - start) / (
float) CLOCKS_PER_SEC);
765 const char *xml_file = va_arg(args,
const char *);
766 clock_t start = va_arg(args, clock_t);
767 clock_t end = va_arg(args, clock_t);
769 char *duration = pcmk__ftoa((end - start) / (
float) CLOCKS_PER_SEC);
773 "duration", duration,
784 const char *dc = va_arg(args,
const char *);
786 return out->info(out,
"Designated Controller is: %s",
787 pcmk__s(dc,
"not yet elected"));
794 if (!out->is_quiet(out)) {
795 return dc(out, args);
797 const char *dc = va_arg(args,
const char *);
812 const char *dc = va_arg(args,
const char *);
815 "node_name", pcmk__s(dc,
""),
820 PCMK__OUTPUT_ARGS(
"crmadmin-node",
"const char *",
"const char *",
"const char *",
"bool")
824 const char *
type = va_arg(args,
const char *);
825 const char *
name = va_arg(args,
const char *);
826 const char *
id = va_arg(args,
const char *);
827 bool bash_export = va_arg(args,
int);
830 return out->info(out,
"export %s=%s",
831 pcmk__s(
name,
"<null>"), pcmk__s(
id,
""));
833 return out->info(out,
"%s node: %s (%s)",
type ?
type :
"cluster",
834 pcmk__s(
name,
"<null>"), pcmk__s(
id,
"<null>"));
838 PCMK__OUTPUT_ARGS(
"crmadmin-node",
"const char *",
"const char *",
"const char *",
"bool")
842 if (!out->is_quiet(out)) {
843 return crmadmin_node(out, args);
845 const char *
type G_GNUC_UNUSED = va_arg(args,
const char *);
846 const char *
name = va_arg(args,
const char *);
847 const char *
id G_GNUC_UNUSED = va_arg(args,
const char *);
848 bool bash_export G_GNUC_UNUSED = va_arg(args,
int);
855 PCMK__OUTPUT_ARGS(
"crmadmin-node",
"const char *",
"const char *",
"const char *",
"bool")
859 const char *
type = va_arg(args,
const char *);
860 const char *
name = va_arg(args,
const char *);
861 const char *
id = va_arg(args,
const char *);
862 bool bash_export G_GNUC_UNUSED = va_arg(args,
int);
866 "name", pcmk__s(
name,
""),
867 "id", pcmk__s(
id,
""),
873 "guint",
"op_digest_cache_t *")
879 const char *task = va_arg(args,
const char *);
880 guint interval_ms = va_arg(args, guint);
883 char *action_desc = NULL;
884 const char *rsc_desc =
"unknown resource";
885 const char *node_desc =
"unknown node";
887 if (interval_ms != 0) {
889 ((task == NULL)?
"unknown" : task));
891 action_desc = strdup(
"probe action");
894 ((task == NULL)?
"unknown" : task));
896 if ((rsc != NULL) && (rsc->
id != NULL)) {
902 out->begin_list(out, NULL, NULL,
"Digests for %s %s on %s",
903 rsc_desc, action_desc, node_desc);
906 if (digests == NULL) {
907 out->list_item(out, NULL,
"none");
912 out->list_item(out, NULL,
"%s (all parameters)",
916 out->list_item(out, NULL,
"%s (non-private parameters)",
920 out->list_item(out, NULL,
"%s (non-reloadable parameters)",
928 add_digest_xml(xmlNode *
parent,
const char *
type,
const char *digest,
929 xmlNode *digest_source)
931 if (digest != NULL) {
936 if (digest_source != NULL) {
943 "guint",
"op_digest_cache_t *")
949 const char *task = va_arg(args,
const char *);
950 guint interval_ms = va_arg(args, guint);
957 "resource", pcmk__s(rsc->
id,
""),
959 "task", pcmk__s(task,
""),
960 "interval", interval_s,
963 if (digests != NULL) {
974 #define STOP_SANITY_ASSERT(lineno) do { \ 975 if(current && current->details->unclean) { \ 977 } else if(stop == NULL) { \ 978 crm_err("%s:%d: No stop action exists for %s", \ 979 __func__, lineno, rsc->id); \ 980 CRM_ASSERT(stop != NULL); \ 981 } else if (pcmk_is_set(stop->flags, pe_action_optional)) { \ 982 crm_err("%s:%d: Action %s is still optional", \ 983 __func__, lineno, stop->uuid); \ 984 CRM_ASSERT(!pcmk_is_set(stop->flags, pe_action_optional)); \ 996 GList *possible_matches = NULL;
1008 || (current == NULL && next == NULL)) {
1015 moving = (current != NULL) && (next != NULL)
1019 if (possible_matches) {
1020 start = possible_matches->data;
1021 g_list_free(possible_matches);
1027 start_node = current;
1030 if (possible_matches) {
1031 stop = possible_matches->data;
1032 g_list_free(possible_matches);
1039 if (possible_matches != NULL) {
1040 stop = possible_matches->data;
1041 g_list_free(possible_matches);
1046 if (possible_matches) {
1047 promote = possible_matches->data;
1048 g_list_free(possible_matches);
1052 if (possible_matches) {
1053 demote = possible_matches->data;
1054 g_list_free(possible_matches);
1063 if (possible_matches) {
1064 migrate_op = possible_matches->data;
1067 if ((migrate_op != NULL) && (current != NULL)
1069 rc = out->message(out,
"rsc-action-item",
"Migrate", rsc, current,
1073 rc = out->message(out,
"rsc-action-item",
"Reload", rsc, current,
1077 if ((demote != NULL) && (promote != NULL)
1080 rc = out->message(out,
"rsc-action-item",
"Re-promote", rsc,
1081 current, next, promote, demote);
1088 rc = out->message(out,
"rsc-action-item",
"Stop", rsc, current,
1089 NULL, stop, (stop && stop->
reason)? stop : start);
1092 }
else if (moving && current) {
1094 rsc, current, next, stop, NULL);
1097 rc = out->message(out,
"rsc-action-item",
"Recover", rsc, current,
1102 rc = out->message(out,
"rsc-action-item",
"Restart", rsc, current,
1107 g_list_free(possible_matches);
1115 GList *gIter = NULL;
1118 for (gIter = rsc->
running_on; gIter != NULL; gIter = gIter->next) {
1123 if (possible_matches) {
1124 stop_op = possible_matches->data;
1125 g_list_free(possible_matches);
1132 if (out->message(out,
"rsc-action-item",
"Stop", rsc, node, NULL,
1133 stop_op, (stop_op && stop_op->reason)? stop_op : start) ==
pcmk_rc_ok) {
1140 }
else if ((stop != NULL)
1143 rc = out->message(out,
"rsc-action-item",
"Recover", rsc, current,
1147 }
else if (moving) {
1148 rc = out->message(out,
"rsc-action-item",
"Move", rsc, current, next,
1153 rc = out->message(out,
"rsc-action-item",
"Reload", rsc, current, next,
1157 rc = out->message(out,
"rsc-action-item",
"Restart", rsc, current,
1163 rc = out->message(out,
"rsc-action-item",
"Demote", rsc, current,
1164 next, demote, NULL);
1168 rc = out->message(out,
"rsc-action-item",
"Promote", rsc, current,
1169 next, promote, NULL);
1172 rc = out->message(out,
"rsc-action-item",
"Start", rsc, current, next,
1183 char *task = va_arg(args,
char *);
1184 char *node_name = va_arg(args,
char *);
1185 char *reason = va_arg(args,
char *);
1189 }
else if (reason) {
1190 out->list_item(out, NULL,
"%s %s '%s'", task, node_name, reason);
1202 char *task = va_arg(args,
char *);
1203 char *node_name = va_arg(args,
char *);
1204 char *reason = va_arg(args,
char *);
1208 }
else if (reason) {
1221 PCMK__OUTPUT_ARGS(
"inject-cluster-action",
"const char *",
"const char *",
"xmlNodePtr")
1225 const char *node = va_arg(args,
const char *);
1226 const char *task = va_arg(args,
const char *);
1227 xmlNodePtr rsc = va_arg(args, xmlNodePtr);
1229 if (out->is_quiet(out)) {
1234 out->list_item(out, NULL,
"Cluster action: %s for %s on %s", task,
ID(rsc), node);
1236 out->list_item(out, NULL,
"Cluster action: %s on %s", task, node);
1242 PCMK__OUTPUT_ARGS(
"inject-cluster-action",
"const char *",
"const char *",
"xmlNodePtr")
1246 const char *node = va_arg(args,
const char *);
1247 const char *task = va_arg(args,
const char *);
1248 xmlNodePtr rsc = va_arg(args, xmlNodePtr);
1250 xmlNodePtr xml_node = NULL;
1252 if (out->is_quiet(out)) {
1272 char *
target = va_arg(args,
char *);
1273 const char *op = va_arg(args,
const char *);
1275 if (out->is_quiet(out)) {
1279 out->list_item(out, NULL,
"Fencing %s (%s)",
target, op);
1287 char *
target = va_arg(args,
char *);
1288 const char *op = va_arg(args,
const char *);
1290 if (out->is_quiet(out)) {
1305 const char *
name = va_arg(args,
const char *);
1306 const char *value = va_arg(args,
const char *);
1307 xmlNodePtr cib_node = va_arg(args, xmlNodePtr);
1309 xmlChar *node_path = NULL;
1311 if (out->is_quiet(out)) {
1315 node_path = xmlGetNodePath(cib_node);
1317 out->list_item(out, NULL,
"Injecting attribute %s=%s into %s '%s'",
1318 name, value, node_path,
ID(cib_node));
1328 const char *
name = va_arg(args,
const char *);
1329 const char *value = va_arg(args,
const char *);
1330 xmlNodePtr cib_node = va_arg(args, xmlNodePtr);
1332 xmlChar *node_path = NULL;
1334 if (out->is_quiet(out)) {
1338 node_path = xmlGetNodePath(cib_node);
1343 "node_path", node_path,
1344 "cib_node",
ID(cib_node),
1354 const char *spec = va_arg(args,
const char *);
1356 if (out->is_quiet(out)) {
1360 out->list_item(out, NULL,
"Injecting %s into the configuration", spec);
1368 const char *spec = va_arg(args,
const char *);
1370 if (out->is_quiet(out)) {
1384 char *quorum = va_arg(args,
char *);
1385 char *watchdog = va_arg(args,
char *);
1387 if (out->is_quiet(out)) {
1391 out->begin_list(out, NULL, NULL,
"Performing Requested Modifications");
1394 out->list_item(out, NULL,
"Setting quorum: %s", quorum);
1398 out->list_item(out, NULL,
"Setting watchdog: %s", watchdog);
1408 char *quorum = va_arg(args,
char *);
1409 char *watchdog = va_arg(args,
char *);
1411 xmlNodePtr node = NULL;
1413 if (out->is_quiet(out)) {
1434 const char *
action = va_arg(args,
const char *);
1435 char *node = va_arg(args,
char *);
1437 if (out->is_quiet(out)) {
1442 out->list_item(out, NULL,
"Bringing node %s online", node);
1445 out->list_item(out, NULL,
"Taking node %s offline", node);
1448 out->list_item(out, NULL,
"Failing node %s", node);
1459 const char *
action = va_arg(args,
const char *);
1460 char *node = va_arg(args,
char *);
1462 if (out->is_quiet(out)) {
1477 const char *
action = va_arg(args,
const char *);
1478 char *ticket = va_arg(args,
char *);
1480 if (out->is_quiet(out)) {
1485 out->list_item(out, NULL,
"Making ticket %s standby", ticket);
1487 out->list_item(out, NULL,
"%s ticket %s",
action, ticket);
1497 const char *
action = va_arg(args,
const char *);
1498 char *ticket = va_arg(args,
char *);
1500 if (out->is_quiet(out)) {
1515 const char *node = va_arg(args,
const char *);
1516 const char *task = va_arg(args,
const char *);
1518 if (out->is_quiet(out)) {
1522 out->list_item(out, NULL,
"Pseudo action: %s%s%s", task, node ?
" on " :
"",
1531 const char *node = va_arg(args,
const char *);
1532 const char *task = va_arg(args,
const char *);
1534 xmlNodePtr xml_node = NULL;
1536 if (out->is_quiet(out)) {
1550 PCMK__OUTPUT_ARGS(
"inject-rsc-action",
"const char *",
"const char *",
"char *",
"guint")
1554 const char *rsc = va_arg(args,
const char *);
1555 const char *operation = va_arg(args,
const char *);
1556 char *node = va_arg(args,
char *);
1557 guint interval_ms = va_arg(args, guint);
1559 if (out->is_quiet(out)) {
1564 out->list_item(out, NULL,
"Resource action: %-15s %s=%u on %s",
1565 rsc, operation, interval_ms, node);
1567 out->list_item(out, NULL,
"Resource action: %-15s %s on %s",
1568 rsc, operation, node);
1574 PCMK__OUTPUT_ARGS(
"inject-rsc-action",
"const char *",
"const char *",
"char *",
"guint")
1578 const char *rsc = va_arg(args,
const char *);
1579 const char *operation = va_arg(args,
const char *);
1580 char *node = va_arg(args,
char *);
1581 guint interval_ms = va_arg(args, guint);
1583 xmlNodePtr xml_node = NULL;
1585 if (out->is_quiet(out)) {
1596 char *interval_s = pcmk__itoa(interval_ms);
1605 #define CHECK_RC(retcode, retval) \ 1606 if (retval == pcmk_rc_ok) { \ 1607 retcode = pcmk_rc_ok; \ 1611 "enum pcmk__fence_history",
"uint32_t",
"uint32_t",
"const char *",
"GList *",
1620 uint32_t section_opts = va_arg(args, uint32_t);
1621 uint32_t show_opts = va_arg(args, uint32_t);
1622 const char *prefix = va_arg(args,
const char *);
1623 GList *unames = va_arg(args, GList *);
1624 GList *resources = va_arg(args, GList *);
1627 bool already_printed_failure =
false;
1630 section_opts, show_opts));
1646 show_opts, rc ==
pcmk_rc_ok, unames, resources));
1654 resources, section_opts, show_opts, rc ==
pcmk_rc_ok));
1668 if (history_rc == 0) {
1673 CHECK_RC(rc, out->message(out,
"failed-fencing-list",
1674 stonith_history, unames, section_opts,
1679 out->begin_list(out, NULL, NULL,
"Failed Fencing Actions");
1680 out->list_item(out, NULL,
"Failed to get fencing history: %s",
1684 already_printed_failure =
true;
1702 if (history_rc != 0) {
1703 if (!already_printed_failure) {
1705 out->begin_list(out, NULL, NULL,
"Failed Fencing Actions");
1706 out->list_item(out, NULL,
"Failed to get fencing history: %s",
1715 CHECK_RC(rc, out->message(out,
"fencing-list", hp, unames,
1716 section_opts, show_opts,
1723 CHECK_RC(rc, out->message(out,
"pending-fencing-list", hp,
1724 unames, section_opts, show_opts,
1733 PCMK__OUTPUT_ARGS(
"cluster-status",
"pe_working_set_t *",
"crm_exit_t",
"stonith_history_t *",
1734 "enum pcmk__fence_history",
"uint32_t",
"uint32_t",
"const char *",
"GList *",
1743 uint32_t section_opts = va_arg(args, uint32_t);
1744 uint32_t show_opts = va_arg(args, uint32_t);
1745 const char *prefix = va_arg(args,
const char *);
1746 GList *unames = va_arg(args, GList *);
1747 GList *resources = va_arg(args, GList *);
1749 out->message(out,
"cluster-summary",
data_set, section_opts, show_opts);
1753 out->message(out,
"node-list",
data_set->
nodes, unames, resources,
1762 out->message(out,
"resource-list",
data_set, full_show_opts,
1763 false, unames, resources,
false);
1768 out->message(out,
"node-attribute-list",
data_set, show_opts,
false,
1776 out->message(out,
"node-summary",
data_set, unames,
1777 resources, section_opts, show_opts,
false);
1784 out->message(out,
"failed-action-list",
data_set, unames, resources,
1791 out->message(out,
"full-fencing-list", history_rc, stonith_history,
1792 unames, section_opts, show_opts,
false);
1797 out->message(out,
"ticket-list",
data_set,
false);
1802 out->message(out,
"ban-list",
data_set, prefix, resources, show_opts,
1809 PCMK__OUTPUT_ARGS(
"cluster-status",
"pe_working_set_t *",
"crm_exit_t",
"stonith_history_t *",
1810 "enum pcmk__fence_history",
"uint32_t",
"uint32_t",
"const char *",
"GList *",
1819 uint32_t section_opts = va_arg(args, uint32_t);
1820 uint32_t show_opts = va_arg(args, uint32_t);
1821 const char *prefix = va_arg(args,
const char *);
1822 GList *unames = va_arg(args, GList *);
1823 GList *resources = va_arg(args, GList *);
1824 bool already_printed_failure =
false;
1826 out->message(out,
"cluster-summary",
data_set, section_opts, show_opts);
1830 out->message(out,
"node-list",
data_set->
nodes, unames, resources,
1836 out->message(out,
"resource-list",
data_set, show_opts,
true, unames,
1842 out->message(out,
"node-attribute-list",
data_set, show_opts,
false,
1850 out->message(out,
"node-summary",
data_set, unames,
1851 resources, section_opts, show_opts,
false);
1858 out->message(out,
"failed-action-list",
data_set, unames, resources,
1865 if (history_rc == 0) {
1870 out->message(out,
"failed-fencing-list", stonith_history, unames,
1871 section_opts, show_opts,
false);
1874 out->begin_list(out, NULL, NULL,
"Failed Fencing Actions");
1875 out->list_item(out, NULL,
"Failed to get fencing history: %s",
1884 if (history_rc != 0) {
1885 if (!already_printed_failure) {
1886 out->begin_list(out, NULL, NULL,
"Failed Fencing Actions");
1887 out->list_item(out, NULL,
"Failed to get fencing history: %s",
1896 out->message(out,
"fencing-list", hp, unames, section_opts,
1903 out->message(out,
"pending-fencing-list", hp, unames,
1904 section_opts, show_opts,
false);
1911 out->message(out,
"ticket-list",
data_set,
false);
1916 out->message(out,
"ban-list",
data_set, prefix, resources, show_opts,
1924 "const char *",
"const char *")
1928 const char *scope = va_arg(args,
const char *);
1929 const char *instance = va_arg(args,
const char *);
1930 const char *
name = va_arg(args,
const char *);
1931 const char *value = va_arg(args,
const char *);
1932 const char *
host = va_arg(args,
const char *);
1934 GString *s = g_string_sized_new(50);
1936 if (!pcmk__str_empty(scope)) {
1940 if (!pcmk__str_empty(instance)) {
1946 if (!pcmk__str_empty(
host)) {
1952 out->info(out,
"%s", s->str);
1953 g_string_free(s, TRUE);
1959 "const char *",
"const char *")
1963 const char *scope = va_arg(args,
const char *);
1964 const char *instance = va_arg(args,
const char *);
1965 const char *
name = va_arg(args,
const char *);
1966 const char *value = va_arg(args,
const char *);
1967 const char *
host = va_arg(args,
const char *);
1969 xmlNodePtr node = NULL;
1973 "value", value ? value :
"",
1976 if (!pcmk__str_empty(scope)) {
1980 if (!pcmk__str_empty(instance)) {
1984 if (!pcmk__str_empty(
host)) {
1995 const char *rule_id = va_arg(args,
const char *);
1996 int result = va_arg(args,
int);
1997 const char *error = va_arg(args,
const char *);
2001 return out->info(out,
"Rule %s is still in effect", rule_id);
2003 return out->info(out,
"Rule %s satisfies conditions", rule_id);
2005 return out->info(out,
"Rule %s is expired", rule_id);
2007 return out->info(out,
"Rule %s has not yet taken effect", rule_id);
2009 return out->info(out,
"Rule %s does not satisfy conditions",
2013 "Could not determine whether rule %s is in effect: %s",
2014 rule_id, ((error != NULL)? error :
"unexpected error"));
2023 const char *rule_id = va_arg(args,
const char *);
2024 int result = va_arg(args,
int);
2025 const char *error = va_arg(args,
const char *);
2044 "Could not determine whether rule %s is in effect: %s",
2045 rule_id, ((error != NULL)? error :
"unexpected error"));
2061 int code = va_arg(args,
int);
2062 const char *
name = va_arg(args,
const char *);
2063 const char *desc = va_arg(args,
const char *);
2065 static int code_width = 0;
2067 if (out->is_quiet(out)) {
2072 if ((
name != NULL) && (desc != NULL)) {
2075 }
else if ((
name != NULL) || (desc != NULL)) {
2085 if (code_width == 0) {
2087 code_width = (int) snprintf(NULL, 0,
"%lld", most_negative);
2090 if ((
name != NULL) && (desc != NULL)) {
2091 static int name_width = 0;
2093 if (name_width == 0) {
2097 name_width = QB_MAX(name_width, len);
2100 return out->info(out,
"% *d: %-*s %s", code_width, code, name_width,
2104 if ((
name != NULL) || (desc != NULL)) {
2105 return out->info(out,
"% *d: %s", code_width, code,
2109 return out->info(out,
"% *d", code_width, code);
2116 int code = va_arg(args,
int);
2117 const char *
name = va_arg(args,
const char *);
2118 const char *desc = va_arg(args,
const char *);
2120 char *code_str = pcmk__itoa(code);
2132 {
"attribute",
"default", attribute_default },
2133 {
"attribute",
"xml", attribute_xml },
2135 {
"cluster-status",
"html", cluster_status_html },
2136 {
"cluster-status",
"xml", cluster_status_xml },
2137 {
"crmadmin-node",
"default", crmadmin_node },
2138 {
"crmadmin-node",
"text", crmadmin_node_text },
2139 {
"crmadmin-node",
"xml", crmadmin_node_xml },
2140 {
"dc",
"default", dc },
2141 {
"dc",
"text", dc_text },
2142 {
"dc",
"xml", dc_xml },
2143 {
"digests",
"default", digests_text },
2144 {
"digests",
"xml", digests_xml },
2145 {
"health",
"default", health },
2146 {
"health",
"text", health_text },
2147 {
"health",
"xml", health_xml },
2148 {
"inject-attr",
"default", inject_attr },
2149 {
"inject-attr",
"xml", inject_attr_xml },
2150 {
"inject-cluster-action",
"default", inject_cluster_action },
2151 {
"inject-cluster-action",
"xml", inject_cluster_action_xml },
2152 {
"inject-fencing-action",
"default", inject_fencing_action },
2153 {
"inject-fencing-action",
"xml", inject_fencing_action_xml },
2154 {
"inject-modify-config",
"default", inject_modify_config },
2155 {
"inject-modify-config",
"xml", inject_modify_config_xml },
2156 {
"inject-modify-node",
"default", inject_modify_node },
2157 {
"inject-modify-node",
"xml", inject_modify_node_xml },
2158 {
"inject-modify-ticket",
"default", inject_modify_ticket },
2159 {
"inject-modify-ticket",
"xml", inject_modify_ticket_xml },
2160 {
"inject-pseudo-action",
"default", inject_pseudo_action },
2161 {
"inject-pseudo-action",
"xml", inject_pseudo_action_xml },
2162 {
"inject-rsc-action",
"default", inject_rsc_action },
2163 {
"inject-rsc-action",
"xml", inject_rsc_action_xml },
2164 {
"inject-spec",
"default", inject_spec },
2165 {
"inject-spec",
"xml", inject_spec_xml },
2166 {
"locations-list",
"default", locations_list },
2167 {
"locations-list",
"xml", locations_list_xml },
2168 {
"node-action",
"default", node_action },
2169 {
"node-action",
"xml", node_action_xml },
2170 {
"pacemakerd-health",
"default", pacemakerd_health },
2171 {
"pacemakerd-health",
"html", pacemakerd_health_html },
2172 {
"pacemakerd-health",
"text", pacemakerd_health_text },
2173 {
"pacemakerd-health",
"xml", pacemakerd_health_xml },
2174 {
"profile",
"default", profile_default, },
2175 {
"profile",
"xml", profile_xml },
2176 {
"result-code",
"none", result_code_none },
2177 {
"result-code",
"text", result_code_text },
2178 {
"result-code",
"xml", result_code_xml },
2179 {
"rsc-action",
"default", rsc_action_default },
2180 {
"rsc-action-item",
"default", rsc_action_item },
2181 {
"rsc-action-item",
"xml", rsc_action_item_xml },
2182 {
"rsc-is-colocated-with-list",
"default", rsc_is_colocated_with_list },
2183 {
"rsc-is-colocated-with-list",
"xml", rsc_is_colocated_with_list_xml },
2184 {
"rscs-colocated-with-list",
"default", rscs_colocated_with_list },
2185 {
"rscs-colocated-with-list",
"xml", rscs_colocated_with_list_xml },
2186 {
"rule-check",
"default", rule_check_default },
2187 {
"rule-check",
"xml", rule_check_xml },
2188 {
"locations-and-colocations",
"default", locations_and_colocations },
2189 {
"locations-and-colocations",
"xml", locations_and_colocations_xml },
2191 { NULL, NULL, NULL }
#define CRM_CHECK(expr, failure_action)
#define crm_notice(fmt, args...)
stonith_history_t * stonith__first_matching_event(stonith_history_t *history, bool(*matching_fn)(stonith_history_t *, void *), void *user_data)
Control output from tools.
void pcmk__register_messages(pcmk__output_t *out, const pcmk__message_entry_t *table)
const char * pcmk_readable_score(int score)
Return a displayable static string for a score value.
pcmk__fence_history
Control how much of the fencing history is output.
GList * find_actions(GList *input, const char *key, const pe_node_t *on_node)
enum rsc_role_e next_role
crm_exit_t pcmk_rc2exitc(int rc)
Map a function return code to the most similar exit code.
xmlNodePtr pcmk__output_xml_create_parent(pcmk__output_t *out, const char *name,...) G_GNUC_NULL_TERMINATED
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value.
#define CHECK_RC(retcode, retval)
pe_resource_t * dependent
void pcmk__xe_set_bool_attr(xmlNodePtr node, const char *name, bool value)
#define XML_CONS_TAG_RSC_DEPEND
enum crm_exit_e crm_exit_t
#define CRM_LOG_ASSERT(expr)
enum crm_ais_msg_types type
#define pe_rsc_stop_unexpected
xmlNodePtr pcmk__output_create_html_node(pcmk__output_t *out, const char *element_name, const char *id, const char *class_name, const char *text)
void pcmk__register_lib_messages(pcmk__output_t *out)
bool stonith__event_state_pending(stonith_history_t *history, void *user_data)
#define pe__set_resource_flags(resource, flags_to_set)
void void void pcmk__formatted_printf(pcmk__output_t *out, const char *format,...) G_GNUC_PRINTF(2
#define PCMK__OUTPUT_SPACER_IF(out_obj, cond)
const char * role2text(enum rsc_role_e role)
const char * crm_exit_str(crm_exit_t exit_code)
pe_resource_t * uber_parent(pe_resource_t *rsc)
#define XML_CONS_TAG_RSC_LOCATION
void pcmk__g_strcat(GString *buffer,...) G_GNUC_NULL_TERMINATED
char * digest_secure_calc
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
xmlNode * add_node_copy(xmlNode *new_parent, xmlNode *xml_node)
struct pe_node_shared_s * details
pe_working_set_t * data_set
void pcmk__unpack_constraints(pe_working_set_t *data_set)
xmlNode * create_xml_node(xmlNode *parent, const char *name)
xmlNodePtr pcmk__output_create_xml_node(pcmk__output_t *out, const char *name,...) G_GNUC_NULL_TERMINATED
#define pcmk_section_fencing_all
int pcmk__cluster_status_text(pcmk__output_t *out, va_list args)
#define pe_rsc_allocating
gboolean xml_has_children(const xmlNode *root)
void pcmk__output_xml_pop_parent(pcmk__output_t *out)
Function and executable result codes.
void pcmk__xe_set_props(xmlNodePtr node,...) G_GNUC_NULL_TERMINATED
const xmlChar * pcmkXmlStr
#define PCMK__OUTPUT_LIST_FOOTER(out_obj, retcode)
#define PCMK__OUTPUT_LIST_HEADER(out_obj, cond, retcode, title...)
pcmk__action_result_t result
const char * pcmk_rc_name(int rc)
Get a return code constant name as a string.
const char * pcmk_pacemakerd_api_daemon_state_enum2text(enum pcmk_pacemakerd_state state)
#define STOP_SANITY_ASSERT(lineno)
This structure contains everything that makes up a single output formatter.
void pe__clear_resource_flags_on_all(pe_working_set_t *data_set, uint64_t flag)
const char * pcmk__pcmkd_state_enum2friendly(enum pcmk_pacemakerd_state state)
enum pe_action_flags flags
const char * node_attribute
GList * pe__resource_actions(const pe_resource_t *rsc, const pe_node_t *node, const char *task, bool require_node)
Find all actions of given type for a resource.
bool stonith__event_state_eq(stonith_history_t *history, void *user_data)
PCMK__OUTPUT_ARGS("rsc-action-item", "const char *", "pe_resource_t *", "pe_node_t *", "pe_node_t *", "pe_action_t *", "pe_action_t *")
char * digest_restart_calc
bool stonith__event_state_neq(stonith_history_t *history, void *user_data)
#define pe_rsc_info(rsc, fmt, args...)