17 #include <libxml/tree.h> 31 (dependents?
"needs" :
"with"),
44 xmlNodePtr node = NULL;
75 for (lpc = list; lpc != NULL; lpc = lpc->next) {
80 for (lpc2 = cons->
node_list_rh; lpc2 != NULL; lpc2 = lpc2->next) {
104 "pe_node_t *",
"pe_node_t *",
"pe_action_t *",
109 const char *change = va_arg(args,
const char *);
118 char *details = NULL;
119 bool same_host =
false;
120 bool same_role =
false;
121 bool need_role =
false;
123 static int rsc_width = 5;
124 static int detail_width = 5;
127 CRM_ASSERT(destination != NULL || origin != NULL);
133 len = strlen(rsc->
id);
134 if(len > rsc_width) {
143 if(origin != NULL && destination != NULL && origin->
details == destination->
details) {
151 if (need_role && (origin == NULL)) {
155 pe__node_name(destination));
157 }
else if (origin == NULL) {
161 }
else if (need_role && (destination == NULL)) {
164 pe__node_name(origin));
166 }
else if (destination == NULL) {
170 }
else if (need_role && same_role && same_host) {
173 pe__node_name(origin));
175 }
else if (same_role && same_host) {
179 }
else if (need_role && same_role) {
182 pe__node_name(destination),
185 }
else if (same_role) {
188 pe__node_name(destination));
190 }
else if (same_host) {
194 pe__node_name(origin));
199 pe__node_name(origin),
201 pe__node_name(destination));
204 len = strlen(details);
205 if(len > detail_width) {
212 }
else if(source->
reason) {
216 reason = strdup(
"blocked");
220 out->list_item(out, NULL,
"%-8s %-*s ( %*s )%s%s", change, rsc_width,
221 rsc->
id, detail_width, details, reason ?
" " :
"", reason ? reason :
"");
229 "pe_node_t *",
"pe_node_t *",
"pe_action_t *",
234 const char *change = va_arg(args,
const char *);
241 char *change_str = NULL;
243 bool same_host =
false;
244 bool same_role =
false;
245 bool need_role =
false;
249 CRM_ASSERT(destination != NULL || origin != NULL);
251 if (source == NULL) {
260 if(origin != NULL && destination != NULL && origin->
details == destination->
details) {
268 change_str = g_ascii_strdown(change, -1);
270 "action", change_str,
275 if (need_role && (origin == NULL)) {
283 }
else if (origin == NULL) {
287 }
else if (need_role && (destination == NULL)) {
294 }
else if (destination == NULL) {
298 }
else if (need_role && same_role && same_host) {
305 }
else if (same_role && same_host) {
309 }
else if (need_role && same_role) {
317 }
else if (same_role) {
324 }
else if (same_host) {
348 }
else if(source->
reason) {
363 bool recursive = va_arg(args,
int);
375 for (GList *lpc = rsc->
rsc_cons; lpc != NULL; lpc = lpc->next) {
382 out->list_item(out, NULL,
"%s (id=%s - loop)",
387 hdr = colocations_header(cons->
primary, cons,
false);
388 out->list_item(out, NULL,
"%s", hdr);
392 out->begin_list(out, NULL, NULL, NULL);
394 out->message(out,
"locations-list", cons->
primary);
396 out->message(out,
"rsc-is-colocated-with-list",
409 rsc_is_colocated_with_list_xml(
pcmk__output_t *out, va_list args) {
411 bool recursive = va_arg(args,
int);
423 for (GList *lpc = rsc->
rsc_cons; lpc != NULL; lpc = lpc->next) {
427 colocations_xml_node(out, cons->
primary, cons);
431 colocations_xml_node(out, cons->
primary, cons);
432 do_locations_list_xml(out, cons->
primary,
false);
435 out->message(out,
"rsc-is-colocated-with-list",
447 bool recursive = va_arg(args,
int);
460 for (GList *lpc = rsc->
rsc_cons_lhs; lpc != NULL; lpc = lpc->next) {
467 out->list_item(out, NULL,
"%s (id=%s - loop)",
472 hdr = colocations_header(cons->
dependent, cons,
true);
473 out->list_item(out, NULL,
"%s", hdr);
477 out->begin_list(out, NULL, NULL, NULL);
479 out->message(out,
"locations-list", cons->
dependent);
481 out->message(out,
"rscs-colocated-with-list",
496 bool recursive = va_arg(args,
int);
509 for (GList *lpc = rsc->
rsc_cons_lhs; lpc != NULL; lpc = lpc->next) {
513 colocations_xml_node(out, cons->
dependent, cons);
517 colocations_xml_node(out, cons->
dependent, cons);
518 do_locations_list_xml(out, cons->
dependent,
false);
521 out->message(out,
"rscs-colocated-with-list",
538 for (lpc = list; lpc != NULL; lpc = lpc->next) {
543 for (lpc2 = cons->
node_list_rh; lpc2 != NULL; lpc2 = lpc2->next) {
547 out->list_item(out, NULL,
"Node %s (score=%s, id=%s, rsc=%s)",
562 return do_locations_list_xml(out, rsc,
true);
566 "pe_working_set_t *",
"bool",
"bool")
572 bool recursive = va_arg(args,
int);
573 bool force = va_arg(args,
int);
582 out->message(out,
"locations-list", rsc);
585 out->message(out,
"rscs-colocated-with-list", rsc, recursive);
588 out->message(out,
"rsc-is-colocated-with-list", rsc, recursive);
593 "pe_working_set_t *",
"bool",
"bool")
599 bool recursive = va_arg(args,
int);
600 bool force = va_arg(args,
int);
610 do_locations_list_xml(out, rsc,
false);
613 out->message(out,
"rscs-colocated-with-list", rsc, recursive);
616 out->message(out,
"rsc-is-colocated-with-list", rsc, recursive);
622 PCMK__OUTPUT_ARGS(
"health",
"const char *",
"const char *",
"const char *",
"const char *")
626 const char *sys_from G_GNUC_UNUSED = va_arg(args,
const char *);
627 const char *host_from = va_arg(args,
const char *);
628 const char *fsa_state = va_arg(args,
const char *);
629 const char *
result = va_arg(args,
const char *);
631 return out->info(out,
"Controller on %s in state %s: %s",
632 pcmk__s(host_from,
"unknown node"),
633 pcmk__s(fsa_state,
"unknown"),
634 pcmk__s(
result,
"unknown result"));
637 PCMK__OUTPUT_ARGS(
"health",
"const char *",
"const char *",
"const char *",
"const char *")
641 if (!out->is_quiet(out)) {
642 return health(out, args);
644 const char *sys_from G_GNUC_UNUSED = va_arg(args,
const char *);
645 const char *host_from G_GNUC_UNUSED = va_arg(args,
const char *);
646 const char *fsa_state = va_arg(args,
const char *);
647 const char *
result G_GNUC_UNUSED = va_arg(args,
const char *);
649 if (fsa_state != NULL) {
658 PCMK__OUTPUT_ARGS(
"health",
"const char *",
"const char *",
"const char *",
"const char *")
662 const char *sys_from = va_arg(args,
const char *);
663 const char *host_from = va_arg(args,
const char *);
664 const char *fsa_state = va_arg(args,
const char *);
665 const char *
result = va_arg(args,
const char *);
668 "node_name", pcmk__s(host_from,
""),
669 "state", pcmk__s(fsa_state,
""),
670 "result", pcmk__s(
result,
""),
676 "enum pcmk_pacemakerd_state",
"const char *",
"time_t")
680 const char *sys_from = va_arg(args,
const char *);
683 const char *state_s = va_arg(args,
const char *);
684 time_t last_updated = va_arg(args, time_t);
686 char *last_updated_s = NULL;
689 if (sys_from == NULL) {
691 sys_from =
"pacemaker-remoted";
697 if (state_s == NULL) {
701 if (last_updated != 0) {
708 rc = out->info(out,
"Status of %s: '%s' (last updated %s)",
710 pcmk__s(last_updated_s,
"at unknown time"));
712 free(last_updated_s);
717 "enum pcmk_pacemakerd_state",
"const char *",
"time_t")
721 const char *sys_from = va_arg(args,
const char *);
724 const char *state_s = va_arg(args,
const char *);
725 time_t last_updated = va_arg(args, time_t);
727 char *last_updated_s = NULL;
730 if (sys_from == NULL) {
732 sys_from =
"pacemaker-remoted";
738 if (state_s == NULL) {
742 if (last_updated != 0) {
751 pcmk__s(last_updated_s,
"at unknown time"));
755 free(last_updated_s);
760 "enum pcmk_pacemakerd_state",
"const char *",
"time_t")
764 if (!out->is_quiet(out)) {
765 return pacemakerd_health(out, args);
767 const char *sys_from G_GNUC_UNUSED = va_arg(args,
const char *);
770 const char *state_s = va_arg(args,
const char *);
771 time_t last_updated G_GNUC_UNUSED = va_arg(args, time_t);
773 if (state_s == NULL) {
782 "enum pcmk_pacemakerd_state",
"const char *",
"time_t")
786 const char *sys_from = va_arg(args,
const char *);
789 const char *state_s = va_arg(args,
const char *);
790 time_t last_updated = va_arg(args, time_t);
792 char *last_updated_s = NULL;
794 if (sys_from == NULL) {
796 sys_from =
"pacemaker-remoted";
802 if (state_s == NULL) {
806 if (last_updated != 0) {
814 "sys_from", sys_from,
816 "last_updated", last_updated_s,
818 free(last_updated_s);
825 const char *xml_file = va_arg(args,
const char *);
826 clock_t start = va_arg(args, clock_t);
827 clock_t end = va_arg(args, clock_t);
829 out->list_item(out, NULL,
"Testing %s ... %.2f secs", xml_file,
830 (end - start) / (
float) CLOCKS_PER_SEC);
838 const char *xml_file = va_arg(args,
const char *);
839 clock_t start = va_arg(args, clock_t);
840 clock_t end = va_arg(args, clock_t);
842 char *duration = pcmk__ftoa((end - start) / (
float) CLOCKS_PER_SEC);
846 "duration", duration,
857 const char *dc = va_arg(args,
const char *);
859 return out->info(out,
"Designated Controller is: %s",
860 pcmk__s(dc,
"not yet elected"));
867 if (!out->is_quiet(out)) {
868 return dc(out, args);
870 const char *dc = va_arg(args,
const char *);
885 const char *dc = va_arg(args,
const char *);
888 "node_name", pcmk__s(dc,
""),
893 PCMK__OUTPUT_ARGS(
"crmadmin-node",
"const char *",
"const char *",
"const char *",
"bool")
897 const char *
type = va_arg(args,
const char *);
898 const char *
name = va_arg(args,
const char *);
899 const char *
id = va_arg(args,
const char *);
900 bool bash_export = va_arg(args,
int);
903 return out->info(out,
"export %s=%s",
904 pcmk__s(
name,
"<null>"), pcmk__s(
id,
""));
906 return out->info(out,
"%s node: %s (%s)",
type ?
type :
"cluster",
907 pcmk__s(
name,
"<null>"), pcmk__s(
id,
"<null>"));
911 PCMK__OUTPUT_ARGS(
"crmadmin-node",
"const char *",
"const char *",
"const char *",
"bool")
915 if (!out->is_quiet(out)) {
916 return crmadmin_node(out, args);
918 const char *
type G_GNUC_UNUSED = va_arg(args,
const char *);
919 const char *
name = va_arg(args,
const char *);
920 const char *
id G_GNUC_UNUSED = va_arg(args,
const char *);
921 bool bash_export G_GNUC_UNUSED = va_arg(args,
int);
928 PCMK__OUTPUT_ARGS(
"crmadmin-node",
"const char *",
"const char *",
"const char *",
"bool")
932 const char *
type = va_arg(args,
const char *);
933 const char *
name = va_arg(args,
const char *);
934 const char *
id = va_arg(args,
const char *);
935 bool bash_export G_GNUC_UNUSED = va_arg(args,
int);
939 "name", pcmk__s(
name,
""),
940 "id", pcmk__s(
id,
""),
946 "const char *",
"guint",
"const op_digest_cache_t *")
952 const char *task = va_arg(args,
const char *);
953 guint interval_ms = va_arg(args, guint);
956 char *action_desc = NULL;
957 const char *rsc_desc =
"unknown resource";
958 const char *node_desc =
"unknown node";
960 if (interval_ms != 0) {
962 ((task == NULL)?
"unknown" : task));
964 action_desc = strdup(
"probe action");
967 ((task == NULL)?
"unknown" : task));
969 if ((rsc != NULL) && (rsc->
id != NULL)) {
975 out->begin_list(out, NULL, NULL,
"Digests for %s %s on %s",
976 rsc_desc, action_desc, node_desc);
979 if (digests == NULL) {
980 out->list_item(out, NULL,
"none");
985 out->list_item(out, NULL,
"%s (all parameters)",
989 out->list_item(out, NULL,
"%s (non-private parameters)",
993 out->list_item(out, NULL,
"%s (non-reloadable parameters)",
1001 add_digest_xml(xmlNode *
parent,
const char *
type,
const char *digest,
1002 xmlNode *digest_source)
1004 if (digest != NULL) {
1009 if (digest_source != NULL) {
1016 "const char *",
"guint",
"const op_digest_cache_t *")
1022 const char *task = va_arg(args,
const char *);
1023 guint interval_ms = va_arg(args, guint);
1027 xmlNode *xml = NULL;
1030 "resource", pcmk__s(rsc->
id,
""),
1032 "task", pcmk__s(task,
""),
1033 "interval", interval_s,
1036 if (digests != NULL) {
1047 #define STOP_SANITY_ASSERT(lineno) do { \ 1048 if(current && current->details->unclean) { \ 1050 } else if(stop == NULL) { \ 1051 crm_err("%s:%d: No stop action exists for %s", \ 1052 __func__, lineno, rsc->id); \ 1053 CRM_ASSERT(stop != NULL); \ 1054 } else if (pcmk_is_set(stop->flags, pe_action_optional)) { \ 1055 crm_err("%s:%d: Action %s is still optional", \ 1056 __func__, lineno, stop->uuid); \ 1057 CRM_ASSERT(!pcmk_is_set(stop->flags, pe_action_optional)); \ 1061 PCMK__OUTPUT_ARGS(
"rsc-action",
"pe_resource_t *",
"pe_node_t *",
"pe_node_t *")
1069 GList *possible_matches = NULL;
1072 bool moving =
false;
1081 || (current == NULL && next == NULL)) {
1088 moving = (current != NULL) && (next != NULL)
1092 if (possible_matches) {
1093 start = possible_matches->data;
1094 g_list_free(possible_matches);
1100 start_node = current;
1103 if (possible_matches) {
1104 stop = possible_matches->data;
1105 g_list_free(possible_matches);
1112 if (possible_matches != NULL) {
1113 stop = possible_matches->data;
1114 g_list_free(possible_matches);
1119 if (possible_matches) {
1120 promote = possible_matches->data;
1121 g_list_free(possible_matches);
1125 if (possible_matches) {
1126 demote = possible_matches->data;
1127 g_list_free(possible_matches);
1136 if (possible_matches) {
1137 migrate_op = possible_matches->data;
1140 if ((migrate_op != NULL) && (current != NULL)
1142 rc = out->message(out,
"rsc-action-item",
"Migrate", rsc, current,
1146 rc = out->message(out,
"rsc-action-item",
"Reload", rsc, current,
1150 if ((demote != NULL) && (promote != NULL)
1153 rc = out->message(out,
"rsc-action-item",
"Re-promote", rsc,
1154 current, next, promote, demote);
1161 rc = out->message(out,
"rsc-action-item",
"Stop", rsc, current,
1162 NULL, stop, (stop && stop->
reason)? stop : start);
1165 }
else if (moving && current) {
1167 rsc, current, next, stop, NULL);
1170 rc = out->message(out,
"rsc-action-item",
"Recover", rsc, current,
1175 rc = out->message(out,
"rsc-action-item",
"Restart", rsc, current,
1180 g_list_free(possible_matches);
1188 GList *gIter = NULL;
1191 for (gIter = rsc->
running_on; gIter != NULL; gIter = gIter->next) {
1196 if (possible_matches) {
1197 stop_op = possible_matches->data;
1198 g_list_free(possible_matches);
1205 if (out->message(out,
"rsc-action-item",
"Stop", rsc, node, NULL,
1206 stop_op, (stop_op && stop_op->reason)? stop_op : start) ==
pcmk_rc_ok) {
1213 }
else if ((stop != NULL)
1216 rc = out->message(out,
"rsc-action-item",
"Recover", rsc, current,
1220 }
else if (moving) {
1221 rc = out->message(out,
"rsc-action-item",
"Move", rsc, current, next,
1226 rc = out->message(out,
"rsc-action-item",
"Reload", rsc, current, next,
1230 rc = out->message(out,
"rsc-action-item",
"Restart", rsc, current,
1236 rc = out->message(out,
"rsc-action-item",
"Demote", rsc, current,
1237 next, demote, NULL);
1241 rc = out->message(out,
"rsc-action-item",
"Promote", rsc, current,
1242 next, promote, NULL);
1245 rc = out->message(out,
"rsc-action-item",
"Start", rsc, current, next,
1252 PCMK__OUTPUT_ARGS(
"node-action",
"const char *",
"const char *",
"const char *")
1256 const char *task = va_arg(args,
const char *);
1257 const char *node_name = va_arg(args,
const char *);
1258 const char *reason = va_arg(args,
const char *);
1262 }
else if (reason) {
1263 out->list_item(out, NULL,
"%s %s '%s'", task, node_name, reason);
1271 PCMK__OUTPUT_ARGS(
"node-action",
"const char *",
"const char *",
"const char *")
1275 const char *task = va_arg(args,
const char *);
1276 const char *node_name = va_arg(args,
const char *);
1277 const char *reason = va_arg(args,
const char *);
1281 }
else if (reason) {
1295 "const char *",
"bool",
"bool")
1299 int node_id = va_arg(args,
int);
1300 const char *node_name = va_arg(args,
const char *);
1301 const char *uuid = va_arg(args,
const char *);
1302 const char *state = va_arg(args,
const char *);
1303 bool have_quorum = (bool) va_arg(args,
int);
1304 bool is_remote = (bool) va_arg(args,
int);
1306 return out->info(out,
1308 "(uuid=%s, state=%s, have_quorum=%s, is_remote=%s)",
1309 node_id, pcmk__s(node_name,
"unknown"),
1310 pcmk__s(uuid,
"unknown"), pcmk__s(state,
"unknown"),
1311 pcmk__btoa(have_quorum), pcmk__btoa(is_remote));
1315 "const char *",
"bool",
"bool")
1319 int node_id = va_arg(args,
int);
1320 const char *node_name = va_arg(args,
const char *);
1321 const char *uuid = va_arg(args,
const char *);
1322 const char *state = va_arg(args,
const char *);
1323 bool have_quorum = (bool) va_arg(args,
int);
1324 bool is_remote = (bool) va_arg(args,
int);
1340 PCMK__OUTPUT_ARGS(
"inject-cluster-action",
"const char *",
"const char *",
"xmlNodePtr")
1344 const char *node = va_arg(args,
const char *);
1345 const char *task = va_arg(args,
const char *);
1346 xmlNodePtr rsc = va_arg(args, xmlNodePtr);
1348 if (out->is_quiet(out)) {
1353 out->list_item(out, NULL,
"Cluster action: %s for %s on %s", task,
ID(rsc), node);
1355 out->list_item(out, NULL,
"Cluster action: %s on %s", task, node);
1361 PCMK__OUTPUT_ARGS(
"inject-cluster-action",
"const char *",
"const char *",
"xmlNodePtr")
1365 const char *node = va_arg(args,
const char *);
1366 const char *task = va_arg(args,
const char *);
1367 xmlNodePtr rsc = va_arg(args, xmlNodePtr);
1369 xmlNodePtr xml_node = NULL;
1371 if (out->is_quiet(out)) {
1391 const char *
target = va_arg(args,
const char *);
1392 const char *op = va_arg(args,
const char *);
1394 if (out->is_quiet(out)) {
1398 out->list_item(out, NULL,
"Fencing %s (%s)",
target, op);
1406 const char *
target = va_arg(args,
const char *);
1407 const char *op = va_arg(args,
const char *);
1409 if (out->is_quiet(out)) {
1424 const char *
name = va_arg(args,
const char *);
1425 const char *value = va_arg(args,
const char *);
1426 xmlNodePtr cib_node = va_arg(args, xmlNodePtr);
1428 xmlChar *node_path = NULL;
1430 if (out->is_quiet(out)) {
1434 node_path = xmlGetNodePath(cib_node);
1436 out->list_item(out, NULL,
"Injecting attribute %s=%s into %s '%s'",
1437 name, value, node_path,
ID(cib_node));
1447 const char *
name = va_arg(args,
const char *);
1448 const char *value = va_arg(args,
const char *);
1449 xmlNodePtr cib_node = va_arg(args, xmlNodePtr);
1451 xmlChar *node_path = NULL;
1453 if (out->is_quiet(out)) {
1457 node_path = xmlGetNodePath(cib_node);
1462 "node_path", node_path,
1463 "cib_node",
ID(cib_node),
1473 const char *spec = va_arg(args,
const char *);
1475 if (out->is_quiet(out)) {
1479 out->list_item(out, NULL,
"Injecting %s into the configuration", spec);
1487 const char *spec = va_arg(args,
const char *);
1489 if (out->is_quiet(out)) {
1503 const char *quorum = va_arg(args,
const char *);
1504 const char *watchdog = va_arg(args,
const char *);
1506 if (out->is_quiet(out)) {
1510 out->begin_list(out, NULL, NULL,
"Performing Requested Modifications");
1513 out->list_item(out, NULL,
"Setting quorum: %s", quorum);
1517 out->list_item(out, NULL,
"Setting watchdog: %s", watchdog);
1527 const char *quorum = va_arg(args,
const char *);
1528 const char *watchdog = va_arg(args,
const char *);
1530 xmlNodePtr node = NULL;
1532 if (out->is_quiet(out)) {
1553 const char *
action = va_arg(args,
const char *);
1554 const char *node = va_arg(args,
const char *);
1556 if (out->is_quiet(out)) {
1561 out->list_item(out, NULL,
"Bringing node %s online", node);
1564 out->list_item(out, NULL,
"Taking node %s offline", node);
1567 out->list_item(out, NULL,
"Failing node %s", node);
1578 const char *
action = va_arg(args,
const char *);
1579 const char *node = va_arg(args,
const char *);
1581 if (out->is_quiet(out)) {
1596 const char *
action = va_arg(args,
const char *);
1597 const char *ticket = va_arg(args,
const char *);
1599 if (out->is_quiet(out)) {
1604 out->list_item(out, NULL,
"Making ticket %s standby", ticket);
1606 out->list_item(out, NULL,
"%s ticket %s",
action, ticket);
1616 const char *
action = va_arg(args,
const char *);
1617 const char *ticket = va_arg(args,
const char *);
1619 if (out->is_quiet(out)) {
1634 const char *node = va_arg(args,
const char *);
1635 const char *task = va_arg(args,
const char *);
1637 if (out->is_quiet(out)) {
1641 out->list_item(out, NULL,
"Pseudo action: %s%s%s", task, node ?
" on " :
"",
1650 const char *node = va_arg(args,
const char *);
1651 const char *task = va_arg(args,
const char *);
1653 xmlNodePtr xml_node = NULL;
1655 if (out->is_quiet(out)) {
1670 "const char *",
"guint")
1674 const char *rsc = va_arg(args,
const char *);
1675 const char *operation = va_arg(args,
const char *);
1676 const char *node = va_arg(args,
const char *);
1677 guint interval_ms = va_arg(args, guint);
1679 if (out->is_quiet(out)) {
1684 out->list_item(out, NULL,
"Resource action: %-15s %s=%u on %s",
1685 rsc, operation, interval_ms, node);
1687 out->list_item(out, NULL,
"Resource action: %-15s %s on %s",
1688 rsc, operation, node);
1695 "const char *",
"guint")
1699 const char *rsc = va_arg(args,
const char *);
1700 const char *operation = va_arg(args,
const char *);
1701 const char *node = va_arg(args,
const char *);
1702 guint interval_ms = va_arg(args, guint);
1704 xmlNodePtr xml_node = NULL;
1706 if (out->is_quiet(out)) {
1717 char *interval_s = pcmk__itoa(interval_ms);
1726 #define CHECK_RC(retcode, retval) \ 1727 if (retval == pcmk_rc_ok) { \ 1728 retcode = pcmk_rc_ok; \ 1732 "enum pcmk_pacemakerd_state",
"crm_exit_t",
1733 "stonith_history_t *",
"enum pcmk__fence_history",
"uint32_t",
1734 "uint32_t",
"const char *",
"GList *",
"GList *")
1744 uint32_t section_opts = va_arg(args, uint32_t);
1745 uint32_t show_opts = va_arg(args, uint32_t);
1746 const char *prefix = va_arg(args,
const char *);
1747 GList *unames = va_arg(args, GList *);
1748 GList *resources = va_arg(args, GList *);
1751 bool already_printed_failure =
false;
1754 section_opts, show_opts));
1770 show_opts, rc ==
pcmk_rc_ok, unames, resources));
1778 resources, section_opts, show_opts, rc ==
pcmk_rc_ok));
1792 if (history_rc == 0) {
1797 CHECK_RC(rc, out->message(out,
"failed-fencing-list",
1798 stonith_history, unames, section_opts,
1803 out->begin_list(out, NULL, NULL,
"Failed Fencing Actions");
1804 out->list_item(out, NULL,
"Failed to get fencing history: %s",
1808 already_printed_failure =
true;
1826 if (history_rc != 0) {
1827 if (!already_printed_failure) {
1829 out->begin_list(out, NULL, NULL,
"Failed Fencing Actions");
1830 out->list_item(out, NULL,
"Failed to get fencing history: %s",
1839 CHECK_RC(rc, out->message(out,
"fencing-list", hp, unames,
1840 section_opts, show_opts,
1847 CHECK_RC(rc, out->message(out,
"pending-fencing-list", hp,
1848 unames, section_opts, show_opts,
1858 "enum pcmk_pacemakerd_state",
"crm_exit_t",
1859 "stonith_history_t *",
"enum pcmk__fence_history",
"uint32_t",
1860 "uint32_t",
"const char *",
"GList *",
"GList *")
1870 uint32_t section_opts = va_arg(args, uint32_t);
1871 uint32_t show_opts = va_arg(args, uint32_t);
1872 const char *prefix = va_arg(args,
const char *);
1873 GList *unames = va_arg(args, GList *);
1874 GList *resources = va_arg(args, GList *);
1876 out->message(out,
"cluster-summary",
data_set, pcmkd_state, section_opts,
1881 out->message(out,
"node-list",
data_set->
nodes, unames, resources,
1890 out->message(out,
"resource-list",
data_set, full_show_opts,
1891 false, unames, resources,
false);
1896 out->message(out,
"node-attribute-list",
data_set, show_opts,
false,
1904 out->message(out,
"node-summary",
data_set, unames,
1905 resources, section_opts, show_opts,
false);
1912 out->message(out,
"failed-action-list",
data_set, unames, resources,
1919 out->message(out,
"full-fencing-list", history_rc, stonith_history,
1920 unames, section_opts, show_opts,
false);
1925 out->message(out,
"ticket-list",
data_set,
false);
1930 out->message(out,
"ban-list",
data_set, prefix, resources, show_opts,
1938 "enum pcmk_pacemakerd_state",
"crm_exit_t",
1939 "stonith_history_t *",
"enum pcmk__fence_history",
"uint32_t",
1940 "uint32_t",
"const char *",
"GList *",
"GList *")
1950 uint32_t section_opts = va_arg(args, uint32_t);
1951 uint32_t show_opts = va_arg(args, uint32_t);
1952 const char *prefix = va_arg(args,
const char *);
1953 GList *unames = va_arg(args, GList *);
1954 GList *resources = va_arg(args, GList *);
1955 bool already_printed_failure =
false;
1957 out->message(out,
"cluster-summary",
data_set, pcmkd_state, section_opts,
1962 out->message(out,
"node-list",
data_set->
nodes, unames, resources,
1968 out->message(out,
"resource-list",
data_set, show_opts,
true, unames,
1974 out->message(out,
"node-attribute-list",
data_set, show_opts,
false,
1982 out->message(out,
"node-summary",
data_set, unames,
1983 resources, section_opts, show_opts,
false);
1990 out->message(out,
"failed-action-list",
data_set, unames, resources,
1997 if (history_rc == 0) {
2002 out->message(out,
"failed-fencing-list", stonith_history, unames,
2003 section_opts, show_opts,
false);
2006 out->begin_list(out, NULL, NULL,
"Failed Fencing Actions");
2007 out->list_item(out, NULL,
"Failed to get fencing history: %s",
2016 if (history_rc != 0) {
2017 if (!already_printed_failure) {
2018 out->begin_list(out, NULL, NULL,
"Failed Fencing Actions");
2019 out->list_item(out, NULL,
"Failed to get fencing history: %s",
2028 out->message(out,
"fencing-list", hp, unames, section_opts,
2035 out->message(out,
"pending-fencing-list", hp, unames,
2036 section_opts, show_opts,
false);
2043 out->message(out,
"ticket-list",
data_set,
false);
2048 out->message(out,
"ban-list",
data_set, prefix, resources, show_opts,
2056 "const char *",
"const char *")
2060 const char *scope = va_arg(args,
const char *);
2061 const char *instance = va_arg(args,
const char *);
2062 const char *
name = va_arg(args,
const char *);
2063 const char *value = va_arg(args,
const char *);
2064 const char *
host = va_arg(args,
const char *);
2066 GString *s = g_string_sized_new(50);
2068 if (!pcmk__str_empty(scope)) {
2072 if (!pcmk__str_empty(instance)) {
2078 if (!pcmk__str_empty(
host)) {
2084 out->info(out,
"%s", s->str);
2085 g_string_free(s, TRUE);
2091 "const char *",
"const char *")
2095 const char *scope = va_arg(args,
const char *);
2096 const char *instance = va_arg(args,
const char *);
2097 const char *
name = va_arg(args,
const char *);
2098 const char *value = va_arg(args,
const char *);
2099 const char *
host = va_arg(args,
const char *);
2101 xmlNodePtr node = NULL;
2105 "value", value ? value :
"",
2108 if (!pcmk__str_empty(scope)) {
2112 if (!pcmk__str_empty(instance)) {
2116 if (!pcmk__str_empty(
host)) {
2127 const char *rule_id = va_arg(args,
const char *);
2128 int result = va_arg(args,
int);
2129 const char *error = va_arg(args,
const char *);
2133 return out->info(out,
"Rule %s is still in effect", rule_id);
2135 return out->info(out,
"Rule %s satisfies conditions", rule_id);
2137 return out->info(out,
"Rule %s is expired", rule_id);
2139 return out->info(out,
"Rule %s has not yet taken effect", rule_id);
2141 return out->info(out,
"Rule %s does not satisfy conditions",
2145 "Could not determine whether rule %s is in effect: %s",
2146 rule_id, ((error != NULL)? error :
"unexpected error"));
2155 const char *rule_id = va_arg(args,
const char *);
2156 int result = va_arg(args,
int);
2157 const char *error = va_arg(args,
const char *);
2176 "Could not determine whether rule %s is in effect: %s",
2177 rule_id, ((error != NULL)? error :
"unexpected error"));
2193 int code = va_arg(args,
int);
2194 const char *
name = va_arg(args,
const char *);
2195 const char *desc = va_arg(args,
const char *);
2197 static int code_width = 0;
2199 if (out->is_quiet(out)) {
2204 if ((
name != NULL) && (desc != NULL)) {
2207 }
else if ((
name != NULL) || (desc != NULL)) {
2217 if (code_width == 0) {
2219 code_width = (int) snprintf(NULL, 0,
"%lld", most_negative);
2222 if ((
name != NULL) && (desc != NULL)) {
2223 static int name_width = 0;
2225 if (name_width == 0) {
2229 name_width = QB_MAX(name_width, len);
2232 return out->info(out,
"% *d: %-*s %s", code_width, code, name_width,
2236 if ((
name != NULL) || (desc != NULL)) {
2237 return out->info(out,
"% *d: %s", code_width, code,
2241 return out->info(out,
"% *d", code_width, code);
2248 int code = va_arg(args,
int);
2249 const char *
name = va_arg(args,
const char *);
2250 const char *desc = va_arg(args,
const char *);
2252 char *code_str = pcmk__itoa(code);
2264 {
"attribute",
"default", attribute_default },
2265 {
"attribute",
"xml", attribute_xml },
2267 {
"cluster-status",
"html", cluster_status_html },
2268 {
"cluster-status",
"xml", cluster_status_xml },
2269 {
"crmadmin-node",
"default", crmadmin_node },
2270 {
"crmadmin-node",
"text", crmadmin_node_text },
2271 {
"crmadmin-node",
"xml", crmadmin_node_xml },
2272 {
"dc",
"default", dc },
2273 {
"dc",
"text", dc_text },
2274 {
"dc",
"xml", dc_xml },
2275 {
"digests",
"default", digests_text },
2276 {
"digests",
"xml", digests_xml },
2277 {
"health",
"default", health },
2278 {
"health",
"text", health_text },
2279 {
"health",
"xml", health_xml },
2280 {
"inject-attr",
"default", inject_attr },
2281 {
"inject-attr",
"xml", inject_attr_xml },
2282 {
"inject-cluster-action",
"default", inject_cluster_action },
2283 {
"inject-cluster-action",
"xml", inject_cluster_action_xml },
2284 {
"inject-fencing-action",
"default", inject_fencing_action },
2285 {
"inject-fencing-action",
"xml", inject_fencing_action_xml },
2286 {
"inject-modify-config",
"default", inject_modify_config },
2287 {
"inject-modify-config",
"xml", inject_modify_config_xml },
2288 {
"inject-modify-node",
"default", inject_modify_node },
2289 {
"inject-modify-node",
"xml", inject_modify_node_xml },
2290 {
"inject-modify-ticket",
"default", inject_modify_ticket },
2291 {
"inject-modify-ticket",
"xml", inject_modify_ticket_xml },
2292 {
"inject-pseudo-action",
"default", inject_pseudo_action },
2293 {
"inject-pseudo-action",
"xml", inject_pseudo_action_xml },
2294 {
"inject-rsc-action",
"default", inject_rsc_action },
2295 {
"inject-rsc-action",
"xml", inject_rsc_action_xml },
2296 {
"inject-spec",
"default", inject_spec },
2297 {
"inject-spec",
"xml", inject_spec_xml },
2298 {
"locations-list",
"default", locations_list },
2299 {
"locations-list",
"xml", locations_list_xml },
2300 {
"node-action",
"default", node_action },
2301 {
"node-action",
"xml", node_action_xml },
2302 {
"node-info",
"default", node_info_default },
2303 {
"node-info",
"xml", node_info_xml },
2304 {
"pacemakerd-health",
"default", pacemakerd_health },
2305 {
"pacemakerd-health",
"html", pacemakerd_health_html },
2306 {
"pacemakerd-health",
"text", pacemakerd_health_text },
2307 {
"pacemakerd-health",
"xml", pacemakerd_health_xml },
2308 {
"profile",
"default", profile_default, },
2309 {
"profile",
"xml", profile_xml },
2310 {
"result-code",
"none", result_code_none },
2311 {
"result-code",
"text", result_code_text },
2312 {
"result-code",
"xml", result_code_xml },
2313 {
"rsc-action",
"default", rsc_action_default },
2314 {
"rsc-action-item",
"default", rsc_action_item },
2315 {
"rsc-action-item",
"xml", rsc_action_item_xml },
2316 {
"rsc-is-colocated-with-list",
"default", rsc_is_colocated_with_list },
2317 {
"rsc-is-colocated-with-list",
"xml", rsc_is_colocated_with_list_xml },
2318 {
"rscs-colocated-with-list",
"default", rscs_colocated_with_list },
2319 {
"rscs-colocated-with-list",
"xml", rscs_colocated_with_list_xml },
2320 {
"rule-check",
"default", rule_check_default },
2321 {
"rule-check",
"xml", rule_check_xml },
2322 {
"locations-and-colocations",
"default", locations_and_colocations },
2323 {
"locations-and-colocations",
"xml", locations_and_colocations_xml },
2325 { 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.
#define crm_time_log_timeofday
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
#define XML_ATTR_HAVE_QUORUM
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 pe_rsc_detect_loop
#define XML_NODE_IS_REMOTE
#define pcmk_section_fencing_all
int pcmk__cluster_status_text(pcmk__output_t *out, va_list args)
#define crm_time_log_with_timezone
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)
char * pcmk__epoch2str(const time_t *source, uint32_t flags)
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
#define crm_time_log_date
bool stonith__event_state_neq(stonith_history_t *history, void *user_data)
#define pe_rsc_info(rsc, fmt, args...)