17 #include <libxml/tree.h> 31 (dependents?
"needs" :
"with"),
45 xmlNodePtr node = NULL;
79 for (lpc = list; lpc != NULL; lpc = lpc->next) {
84 for (lpc2 = cons->
nodes; lpc2 != NULL; lpc2 = lpc2->next) {
109 "pcmk_node_t *",
"pcmk_node_t *",
"pcmk_action_t *",
114 const char *change = va_arg(args,
const char *);
123 char *details = NULL;
124 bool same_host =
false;
125 bool same_role =
false;
126 bool need_role =
false;
128 static int rsc_width = 5;
129 static int detail_width = 5;
132 CRM_ASSERT(destination != NULL || origin != NULL);
134 if (source == NULL) {
138 len = strlen(rsc->
id);
139 if (len > rsc_width) {
148 if (pcmk__same_node(origin, destination)) {
156 if (need_role && (origin == NULL)) {
160 pcmk__node_name(destination));
162 }
else if (origin == NULL) {
166 }
else if (need_role && (destination == NULL)) {
169 pcmk__node_name(origin));
171 }
else if (destination == NULL) {
175 }
else if (need_role && same_role && same_host) {
178 pcmk__node_name(origin));
180 }
else if (same_role && same_host) {
184 }
else if (need_role && same_role) {
187 pcmk__node_name(destination),
190 }
else if (same_role) {
193 pcmk__node_name(destination));
195 }
else if (same_host) {
199 pcmk__node_name(origin));
205 pcmk__node_name(origin),
207 pcmk__node_name(destination));
210 len = strlen(details);
211 if (len > detail_width) {
215 if ((source->
reason != NULL)
219 }
else if (source->
reason) {
223 reason = strdup(
"blocked");
227 out->list_item(out, NULL,
"%-8s %-*s ( %*s )%s%s",
228 change, rsc_width, rsc->
id, detail_width, details,
229 ((reason == NULL)?
"" :
" "), pcmk__s(reason,
""));
237 "pcmk_node_t *",
"pcmk_node_t *",
"pcmk_action_t *",
242 const char *change = va_arg(args,
const char *);
249 char *change_str = NULL;
251 bool same_host =
false;
252 bool same_role =
false;
253 bool need_role =
false;
257 CRM_ASSERT(destination != NULL || origin != NULL);
259 if (source == NULL) {
268 if (pcmk__same_node(origin, destination)) {
276 change_str = g_ascii_strdown(change, -1);
283 if (need_role && (origin == NULL)) {
291 }
else if (origin == NULL) {
295 }
else if (need_role && (destination == NULL)) {
302 }
else if (destination == NULL) {
306 }
else if (need_role && same_role && same_host) {
313 }
else if (same_role && same_host) {
317 }
else if (need_role && same_role) {
325 }
else if (same_role) {
332 }
else if (same_host) {
350 if ((source->
reason != NULL)
357 }
else if (source->
reason != NULL) {
372 bool recursive = va_arg(args,
int);
384 for (GList *lpc = rsc->
rsc_cons; lpc != NULL; lpc = lpc->next) {
389 "Resources %s is colocated with", rsc->
id);
392 out->list_item(out, NULL,
"%s (id=%s - loop)",
397 hdr = colocations_header(cons->
primary, cons,
false);
398 out->list_item(out, NULL,
"%s", hdr);
402 out->begin_list(out, NULL, NULL, NULL);
404 out->message(out,
"locations-list", cons->
primary);
406 out->message(out,
"rsc-is-colocated-with-list",
419 rsc_is_colocated_with_list_xml(
pcmk__output_t *out, va_list args) {
421 bool recursive = va_arg(args,
int);
433 for (GList *lpc = rsc->
rsc_cons; lpc != NULL; lpc = lpc->next) {
437 colocations_xml_node(out, cons->
primary, cons);
441 colocations_xml_node(out, cons->
primary, cons);
442 do_locations_list_xml(out, cons->
primary,
false);
445 out->message(out,
"rsc-is-colocated-with-list",
457 bool recursive = va_arg(args,
int);
470 for (GList *lpc = rsc->
rsc_cons_lhs; lpc != NULL; lpc = lpc->next) {
478 out->list_item(out, NULL,
"%s (id=%s - loop)",
483 hdr = colocations_header(cons->
dependent, cons,
true);
484 out->list_item(out, NULL,
"%s", hdr);
488 out->begin_list(out, NULL, NULL, NULL);
490 out->message(out,
"locations-list", cons->
dependent);
492 out->message(out,
"rscs-colocated-with-list",
507 bool recursive = va_arg(args,
int);
520 for (GList *lpc = rsc->
rsc_cons_lhs; lpc != NULL; lpc = lpc->next) {
524 colocations_xml_node(out, cons->
dependent, cons);
528 colocations_xml_node(out, cons->
dependent, cons);
529 do_locations_list_xml(out, cons->
dependent,
false);
532 out->message(out,
"rscs-colocated-with-list",
549 for (lpc = list; lpc != NULL; lpc = lpc->next) {
554 for (lpc2 = cons->
nodes; lpc2 != NULL; lpc2 = lpc2->next) {
558 out->list_item(out, NULL,
"Node %s (score=%s, id=%s, rsc=%s)",
559 pcmk__node_name(node),
573 return do_locations_list_xml(out, rsc,
true);
582 bool recursive = va_arg(args,
int);
583 bool force = va_arg(args,
int);
592 out->message(out,
"locations-list", rsc);
595 out->message(out,
"rscs-colocated-with-list", rsc, recursive);
598 out->message(out,
"rsc-is-colocated-with-list", rsc, recursive);
608 bool recursive = va_arg(args,
int);
609 bool force = va_arg(args,
int);
619 do_locations_list_xml(out, rsc,
false);
622 out->message(out,
"rscs-colocated-with-list", rsc, recursive);
625 out->message(out,
"rsc-is-colocated-with-list", rsc, recursive);
636 const char *sys_from G_GNUC_UNUSED = va_arg(args,
const char *);
637 const char *host_from = va_arg(args,
const char *);
638 const char *fsa_state = va_arg(args,
const char *);
639 const char *
result = va_arg(args,
const char *);
641 return out->info(out,
"Controller on %s in state %s: %s",
642 pcmk__s(host_from,
"unknown node"),
643 pcmk__s(fsa_state,
"unknown"),
644 pcmk__s(
result,
"unknown result"));
652 if (!out->is_quiet(out)) {
653 return health(out, args);
655 const char *sys_from G_GNUC_UNUSED = va_arg(args,
const char *);
656 const char *host_from G_GNUC_UNUSED = va_arg(args,
const char *);
657 const char *fsa_state = va_arg(args,
const char *);
658 const char *
result G_GNUC_UNUSED = va_arg(args,
const char *);
660 if (fsa_state != NULL) {
674 const char *sys_from = va_arg(args,
const char *);
675 const char *host_from = va_arg(args,
const char *);
676 const char *fsa_state = va_arg(args,
const char *);
677 const char *
result = va_arg(args,
const char *);
688 "enum pcmk_pacemakerd_state",
"const char *",
"time_t")
692 const char *sys_from = va_arg(args,
const char *);
695 const char *state_s = va_arg(args,
const char *);
696 time_t last_updated = va_arg(args, time_t);
698 char *last_updated_s = NULL;
701 if (sys_from == NULL) {
703 sys_from =
"pacemaker-remoted";
709 if (state_s == NULL) {
713 if (last_updated != 0) {
720 rc = out->info(out,
"Status of %s: '%s' (last updated %s)",
722 pcmk__s(last_updated_s,
"at unknown time"));
724 free(last_updated_s);
729 "enum pcmk_pacemakerd_state",
"const char *",
"time_t")
733 const char *sys_from = va_arg(args,
const char *);
736 const char *state_s = va_arg(args,
const char *);
737 time_t last_updated = va_arg(args, time_t);
739 char *last_updated_s = NULL;
742 if (sys_from == NULL) {
744 sys_from =
"pacemaker-remoted";
750 if (state_s == NULL) {
754 if (last_updated != 0) {
763 pcmk__s(last_updated_s,
"at unknown time"));
767 free(last_updated_s);
772 "enum pcmk_pacemakerd_state",
"const char *",
"time_t")
776 if (!out->is_quiet(out)) {
777 return pacemakerd_health(out, args);
779 const char *sys_from G_GNUC_UNUSED = va_arg(args,
const char *);
782 const char *state_s = va_arg(args,
const char *);
783 time_t last_updated G_GNUC_UNUSED = va_arg(args, time_t);
785 if (state_s == NULL) {
794 "enum pcmk_pacemakerd_state",
"const char *",
"time_t")
798 const char *sys_from = va_arg(args,
const char *);
801 const char *state_s = va_arg(args,
const char *);
802 time_t last_updated = va_arg(args, time_t);
804 char *last_updated_s = NULL;
806 if (sys_from == NULL) {
808 sys_from =
"pacemaker-remoted";
814 if (state_s == NULL) {
818 if (last_updated != 0) {
830 free(last_updated_s);
837 const char *xml_file = va_arg(args,
const char *);
838 clock_t start = va_arg(args, clock_t);
839 clock_t end = va_arg(args, clock_t);
841 out->list_item(out, NULL,
"Testing %s ... %.2f secs", xml_file,
842 (end - start) / (
float) CLOCKS_PER_SEC);
850 const char *xml_file = va_arg(args,
const char *);
851 clock_t start = va_arg(args, clock_t);
852 clock_t end = va_arg(args, clock_t);
854 char *duration = pcmk__ftoa((end - start) / (
float) CLOCKS_PER_SEC);
869 const char *dc = va_arg(args,
const char *);
871 return out->info(out,
"Designated Controller is: %s",
872 pcmk__s(dc,
"not yet elected"));
879 if (!out->is_quiet(out)) {
880 return dc(out, args);
882 const char *dc = va_arg(args,
const char *);
897 const char *dc = va_arg(args,
const char *);
906 "const char *",
"bool")
910 const char *
type = va_arg(args,
const char *);
911 const char *
name = va_arg(args,
const char *);
912 const char *
id = va_arg(args,
const char *);
913 bool bash_export = va_arg(args,
int);
916 return out->info(out,
"export %s=%s",
917 pcmk__s(
name,
"<null>"), pcmk__s(
id,
""));
919 return out->info(out,
"%s node: %s (%s)",
type ?
type :
"cluster",
920 pcmk__s(
name,
"<null>"), pcmk__s(
id,
"<null>"));
925 "const char *",
"bool")
929 if (!out->is_quiet(out)) {
930 return crmadmin_node(out, args);
932 const char *
type G_GNUC_UNUSED = va_arg(args,
const char *);
933 const char *
name = va_arg(args,
const char *);
934 const char *
id G_GNUC_UNUSED = va_arg(args,
const char *);
935 bool bash_export G_GNUC_UNUSED = va_arg(args,
int);
943 "const char *",
"bool")
947 const char *
type = va_arg(args,
const char *);
948 const char *
name = va_arg(args,
const char *);
949 const char *
id = va_arg(args,
const char *);
950 bool bash_export G_GNUC_UNUSED = va_arg(args,
int);
961 "const char *",
"guint",
"const pcmk__op_digest_t *")
967 const char *task = va_arg(args,
const char *);
968 guint interval_ms = va_arg(args, guint);
971 char *action_desc = NULL;
972 const char *rsc_desc =
"unknown resource";
973 const char *node_desc =
"unknown node";
975 if (interval_ms != 0) {
977 ((task == NULL)?
"unknown" : task));
979 action_desc = strdup(
"probe action");
982 ((task == NULL)?
"unknown" : task));
984 if ((rsc != NULL) && (rsc->
id != NULL)) {
990 out->begin_list(out, NULL, NULL,
"Digests for %s %s on %s",
991 rsc_desc, action_desc, node_desc);
994 if (digests == NULL) {
995 out->list_item(out, NULL,
"none");
1000 out->list_item(out, NULL,
"%s (all parameters)",
1004 out->list_item(out, NULL,
"%s (non-private parameters)",
1008 out->list_item(out, NULL,
"%s (non-reloadable parameters)",
1016 add_digest_xml(xmlNode *
parent,
const char *
type,
const char *digest,
1017 xmlNode *digest_source)
1019 if (digest != NULL) {
1029 "const char *",
"guint",
"const pcmk__op_digest_t *")
1035 const char *task = va_arg(args,
const char *);
1036 guint interval_ms = va_arg(args, guint);
1040 xmlNode *xml = NULL;
1050 if (digests != NULL) {
1061 #define STOP_SANITY_ASSERT(lineno) do { \ 1062 if ((current != NULL) && current->details->unclean) { \ 1064 } else if (stop == NULL) { \ 1065 crm_err("%s:%d: No stop action exists for %s", \ 1066 __func__, lineno, rsc->id); \ 1067 CRM_ASSERT(stop != NULL); \ 1068 } else if (pcmk_is_set(stop->flags, pcmk_action_optional)) { \ 1069 crm_err("%s:%d: Action %s is still optional", \ 1070 __func__, lineno, stop->uuid); \ 1071 CRM_ASSERT(!pcmk_is_set(stop->flags, pcmk_action_optional));\ 1084 GList *possible_matches = NULL;
1087 bool moving =
false;
1097 || (current == NULL && next == NULL)) {
1102 (managed?
"" :
" unmanaged"));
1106 moving = (current != NULL) && (next != NULL)
1107 && !pcmk__same_node(current, next);
1111 if (possible_matches) {
1112 start = possible_matches->data;
1113 g_list_free(possible_matches);
1120 start_node = current;
1124 if (possible_matches) {
1125 stop = possible_matches->data;
1126 g_list_free(possible_matches);
1134 if (possible_matches != NULL) {
1135 stop = possible_matches->data;
1136 g_list_free(possible_matches);
1142 if (possible_matches) {
1143 promote = possible_matches->data;
1144 g_list_free(possible_matches);
1149 if (possible_matches) {
1150 demote = possible_matches->data;
1151 g_list_free(possible_matches);
1162 if (possible_matches) {
1163 migrate_op = possible_matches->data;
1166 if ((migrate_op != NULL) && (current != NULL)
1168 rc = out->message(out,
"rsc-action-item",
"Migrate", rsc, current,
1172 rc = out->message(out,
"rsc-action-item",
"Reload", rsc, current,
1175 }
else if ((start == NULL)
1177 if ((demote != NULL) && (promote != NULL)
1180 rc = out->message(out,
"rsc-action-item",
"Re-promote", rsc,
1181 current, next, promote, demote);
1185 pcmk__node_name(next));
1189 if ((stop == NULL) || (stop->
reason == NULL)) {
1194 rc = out->message(out,
"rsc-action-item",
"Stop", rsc, current,
1195 NULL, stop, reason_op);
1198 }
else if (moving && current) {
1201 rc = out->message(out,
"rsc-action-item",
1202 (failed?
"Recover" :
"Move"), rsc, current, next,
1206 rc = out->message(out,
"rsc-action-item",
"Recover", rsc, current,
1211 rc = out->message(out,
"rsc-action-item",
"Restart", rsc, current,
1221 g_list_free(possible_matches);
1231 for (GList *iter = rsc->
running_on; iter != NULL; iter = iter->next) {
1237 if (possible_matches) {
1238 stop_op = possible_matches->data;
1239 g_list_free(possible_matches);
1242 if (stop_op != NULL) {
1246 if (stop_op->
reason != NULL) {
1247 reason_op = stop_op;
1251 if (out->message(out,
"rsc-action-item",
"Stop", rsc, node, NULL,
1259 }
else if ((stop != NULL)
1260 && pcmk_all_flags_set(rsc->
flags,
1263 rc = out->message(out,
"rsc-action-item",
"Recover", rsc, current,
1267 }
else if (moving) {
1268 rc = out->message(out,
"rsc-action-item",
"Move", rsc, current, next,
1273 rc = out->message(out,
"rsc-action-item",
"Reload", rsc, current, next,
1276 }
else if ((stop != NULL)
1278 rc = out->message(out,
"rsc-action-item",
"Restart", rsc, current,
1284 rc = out->message(out,
"rsc-action-item",
"Demote", rsc, current,
1285 next, demote, NULL);
1289 rc = out->message(out,
"rsc-action-item",
"Promote", rsc, current,
1290 next, promote, NULL);
1294 rc = out->message(out,
"rsc-action-item",
"Start", rsc, current, next,
1301 PCMK__OUTPUT_ARGS(
"node-action",
"const char *",
"const char *",
"const char *")
1305 const char *task = va_arg(args,
const char *);
1306 const char *node_name = va_arg(args,
const char *);
1307 const char *reason = va_arg(args,
const char *);
1311 }
else if (reason) {
1312 out->list_item(out, NULL,
"%s %s '%s'", task, node_name, reason);
1320 PCMK__OUTPUT_ARGS(
"node-action",
"const char *",
"const char *",
"const char *")
1324 const char *task = va_arg(args,
const char *);
1325 const char *node_name = va_arg(args,
const char *);
1326 const char *reason = va_arg(args,
const char *);
1330 }
else if (reason) {
1344 "const char *",
"bool",
"bool")
1348 uint32_t node_id = va_arg(args, uint32_t);
1349 const char *node_name = va_arg(args,
const char *);
1350 const char *uuid = va_arg(args,
const char *);
1351 const char *state = va_arg(args,
const char *);
1352 bool have_quorum = (bool) va_arg(args,
int);
1353 bool is_remote = (bool) va_arg(args,
int);
1355 return out->info(out,
1356 "Node %" PRIu32
": %s " 1357 "(uuid=%s, state=%s, have_quorum=%s, is_remote=%s)",
1358 node_id, pcmk__s(node_name,
"unknown"),
1359 pcmk__s(uuid,
"unknown"), pcmk__s(state,
"unknown"),
1360 pcmk__btoa(have_quorum), pcmk__btoa(is_remote));
1364 "const char *",
"bool",
"bool")
1368 uint32_t node_id = va_arg(args, uint32_t);
1369 const char *node_name = va_arg(args,
const char *);
1370 const char *uuid = va_arg(args,
const char *);
1371 const char *state = va_arg(args,
const char *);
1372 bool have_quorum = (bool) va_arg(args,
int);
1373 bool is_remote = (bool) va_arg(args,
int);
1394 const char *node = va_arg(args,
const char *);
1395 const char *task = va_arg(args,
const char *);
1396 xmlNodePtr rsc = va_arg(args, xmlNodePtr);
1398 if (out->is_quiet(out)) {
1403 out->list_item(out, NULL,
"Cluster action: %s for %s on %s",
1404 task, pcmk__xe_id(rsc), node);
1406 out->list_item(out, NULL,
"Cluster action: %s on %s", task, node);
1417 const char *node = va_arg(args,
const char *);
1418 const char *task = va_arg(args,
const char *);
1419 xmlNodePtr rsc = va_arg(args, xmlNodePtr);
1421 xmlNodePtr xml_node = NULL;
1423 if (out->is_quiet(out)) {
1443 const char *
target = va_arg(args,
const char *);
1444 const char *op = va_arg(args,
const char *);
1446 if (out->is_quiet(out)) {
1450 out->list_item(out, NULL,
"Fencing %s (%s)",
target, op);
1458 const char *
target = va_arg(args,
const char *);
1459 const char *op = va_arg(args,
const char *);
1461 if (out->is_quiet(out)) {
1476 const char *
name = va_arg(args,
const char *);
1477 const char *value = va_arg(args,
const char *);
1478 xmlNodePtr cib_node = va_arg(args, xmlNodePtr);
1480 xmlChar *node_path = NULL;
1482 if (out->is_quiet(out)) {
1486 node_path = xmlGetNodePath(cib_node);
1488 out->list_item(out, NULL,
"Injecting attribute %s=%s into %s '%s'",
1489 name, value, node_path, pcmk__xe_id(cib_node));
1499 const char *
name = va_arg(args,
const char *);
1500 const char *value = va_arg(args,
const char *);
1501 xmlNodePtr cib_node = va_arg(args, xmlNodePtr);
1503 xmlChar *node_path = NULL;
1505 if (out->is_quiet(out)) {
1509 node_path = xmlGetNodePath(cib_node);
1525 const char *spec = va_arg(args,
const char *);
1527 if (out->is_quiet(out)) {
1531 out->list_item(out, NULL,
"Injecting %s into the configuration", spec);
1539 const char *spec = va_arg(args,
const char *);
1541 if (out->is_quiet(out)) {
1555 const char *quorum = va_arg(args,
const char *);
1556 const char *watchdog = va_arg(args,
const char *);
1558 if (out->is_quiet(out)) {
1562 out->begin_list(out, NULL, NULL,
"Performing Requested Modifications");
1565 out->list_item(out, NULL,
"Setting quorum: %s", quorum);
1569 out->list_item(out, NULL,
"Setting watchdog: %s", watchdog);
1579 const char *quorum = va_arg(args,
const char *);
1580 const char *watchdog = va_arg(args,
const char *);
1582 xmlNodePtr node = NULL;
1584 if (out->is_quiet(out)) {
1606 const char *
action = va_arg(args,
const char *);
1607 const char *node = va_arg(args,
const char *);
1609 if (out->is_quiet(out)) {
1614 out->list_item(out, NULL,
"Bringing node %s online", node);
1617 out->list_item(out, NULL,
"Taking node %s offline", node);
1620 out->list_item(out, NULL,
"Failing node %s", node);
1631 const char *
action = va_arg(args,
const char *);
1632 const char *node = va_arg(args,
const char *);
1634 if (out->is_quiet(out)) {
1649 const char *
action = va_arg(args,
const char *);
1650 const char *ticket = va_arg(args,
const char *);
1652 if (out->is_quiet(out)) {
1657 out->list_item(out, NULL,
"Making ticket %s standby", ticket);
1659 out->list_item(out, NULL,
"%s ticket %s",
action, ticket);
1669 const char *
action = va_arg(args,
const char *);
1670 const char *ticket = va_arg(args,
const char *);
1672 if (out->is_quiet(out)) {
1687 const char *node = va_arg(args,
const char *);
1688 const char *task = va_arg(args,
const char *);
1690 if (out->is_quiet(out)) {
1694 out->list_item(out, NULL,
"Pseudo action: %s%s%s",
1695 task, ((node == NULL)?
"" :
" on "), pcmk__s(node,
""));
1703 const char *node = va_arg(args,
const char *);
1704 const char *task = va_arg(args,
const char *);
1706 xmlNodePtr xml_node = NULL;
1708 if (out->is_quiet(out)) {
1723 "const char *",
"guint")
1727 const char *rsc = va_arg(args,
const char *);
1728 const char *operation = va_arg(args,
const char *);
1729 const char *node = va_arg(args,
const char *);
1730 guint interval_ms = va_arg(args, guint);
1732 if (out->is_quiet(out)) {
1737 out->list_item(out, NULL,
"Resource action: %-15s %s=%u on %s",
1738 rsc, operation, interval_ms, node);
1740 out->list_item(out, NULL,
"Resource action: %-15s %s on %s",
1741 rsc, operation, node);
1748 "const char *",
"guint")
1752 const char *rsc = va_arg(args,
const char *);
1753 const char *operation = va_arg(args,
const char *);
1754 const char *node = va_arg(args,
const char *);
1755 guint interval_ms = va_arg(args, guint);
1757 xmlNodePtr xml_node = NULL;
1759 if (out->is_quiet(out)) {
1770 char *interval_s = pcmk__itoa(interval_ms);
1779 #define CHECK_RC(retcode, retval) \ 1780 if (retval == pcmk_rc_ok) { \ 1781 retcode = pcmk_rc_ok; \ 1785 "enum pcmk_pacemakerd_state",
"crm_exit_t",
1786 "stonith_history_t *",
"enum pcmk__fence_history",
"uint32_t",
1787 "uint32_t",
"const char *",
"GList *",
"GList *")
1797 uint32_t section_opts = va_arg(args, uint32_t);
1798 uint32_t show_opts = va_arg(args, uint32_t);
1799 const char *prefix = va_arg(args,
const char *);
1800 GList *unames = va_arg(args, GList *);
1801 GList *resources = va_arg(args, GList *);
1804 bool already_printed_failure =
false;
1807 section_opts, show_opts));
1830 if (pcmk_any_flags_set(section_opts,
1833 resources, section_opts, show_opts,
1849 if (history_rc == 0) {
1856 CHECK_RC(rc, out->message(out,
"failed-fencing-list",
1857 stonith_history, unames, section_opts,
1862 out->begin_list(out, NULL, NULL,
"Failed Fencing Actions");
1863 out->list_item(out, NULL,
"Failed to get fencing history: %s",
1867 already_printed_failure =
true;
1886 if (history_rc != 0) {
1887 if (!already_printed_failure) {
1889 out->begin_list(out, NULL, NULL,
"Failed Fencing Actions");
1890 out->list_item(out, NULL,
"Failed to get fencing history: %s",
1901 CHECK_RC(rc, out->message(out,
"fencing-list", hp, unames,
1902 section_opts, show_opts,
1912 CHECK_RC(rc, out->message(out,
"pending-fencing-list", hp,
1913 unames, section_opts, show_opts,
1923 "enum pcmk_pacemakerd_state",
"crm_exit_t",
1924 "stonith_history_t *",
"enum pcmk__fence_history",
"uint32_t",
1925 "uint32_t",
"const char *",
"GList *",
"GList *")
1935 uint32_t section_opts = va_arg(args, uint32_t);
1936 uint32_t show_opts = va_arg(args, uint32_t);
1937 const char *prefix = va_arg(args,
const char *);
1938 GList *unames = va_arg(args, GList *);
1939 GList *resources = va_arg(args, GList *);
1941 out->message(out,
"cluster-summary",
scheduler, pcmkd_state, section_opts,
1946 out->message(out,
"node-list",
scheduler->
nodes, unames, resources,
1955 out->message(out,
"resource-list",
scheduler, full_show_opts,
1956 false, unames, resources,
false);
1961 out->message(out,
"node-attribute-list",
scheduler, show_opts,
false,
1968 if (pcmk_any_flags_set(section_opts,
1970 out->message(out,
"node-summary",
scheduler, unames,
1971 resources, section_opts, show_opts,
false);
1979 out->message(out,
"failed-action-list",
scheduler, unames, resources,
1986 out->message(out,
"full-fencing-list", history_rc, stonith_history,
1987 unames, section_opts, show_opts,
false);
1997 out->message(out,
"ban-list",
scheduler, prefix, resources, show_opts,
2005 "enum pcmk_pacemakerd_state",
"crm_exit_t",
2006 "stonith_history_t *",
"enum pcmk__fence_history",
"uint32_t",
2007 "uint32_t",
"const char *",
"GList *",
"GList *")
2017 uint32_t section_opts = va_arg(args, uint32_t);
2018 uint32_t show_opts = va_arg(args, uint32_t);
2019 const char *prefix = va_arg(args,
const char *);
2020 GList *unames = va_arg(args, GList *);
2021 GList *resources = va_arg(args, GList *);
2022 bool already_printed_failure =
false;
2024 out->message(out,
"cluster-summary",
scheduler, pcmkd_state, section_opts,
2029 out->message(out,
"node-list",
scheduler->
nodes, unames, resources,
2035 out->message(out,
"resource-list",
scheduler, show_opts,
true, unames,
2041 out->message(out,
"node-attribute-list",
scheduler, show_opts,
false,
2048 if (pcmk_any_flags_set(section_opts,
2050 out->message(out,
"node-summary",
scheduler, unames,
2051 resources, section_opts, show_opts,
false);
2059 out->message(out,
"failed-action-list",
scheduler, unames, resources,
2066 if (history_rc == 0) {
2073 out->message(out,
"failed-fencing-list", stonith_history,
2074 unames, section_opts, show_opts,
false);
2077 out->begin_list(out, NULL, NULL,
"Failed Fencing Actions");
2078 out->list_item(out, NULL,
"Failed to get fencing history: %s",
2087 if (history_rc != 0) {
2088 if (!already_printed_failure) {
2089 out->begin_list(out, NULL, NULL,
"Failed Fencing Actions");
2090 out->list_item(out, NULL,
"Failed to get fencing history: %s",
2101 out->message(out,
"fencing-list", hp, unames, section_opts,
2111 out->message(out,
"pending-fencing-list", hp, unames,
2112 section_opts, show_opts,
false);
2124 out->message(out,
"ban-list",
scheduler, prefix, resources, show_opts,
2131 #define KV_PAIR(k, v) do { \ 2133 pcmk__g_strcat(s, k "=", pcmk__s(v, ""), " ", NULL); \ 2135 pcmk__g_strcat(s, k "=\"", pcmk__s(v, ""), "\" ", NULL); \ 2140 "const char *",
"const char *",
"bool",
"bool")
2144 const char *scope = va_arg(args,
const char *);
2145 const char *instance = va_arg(args,
const char *);
2146 const char *
name = va_arg(args,
const char *);
2147 const char *value = va_arg(args,
const char *);
2148 const char *
host = va_arg(args,
const char *);
2149 bool quiet = va_arg(args,
int);
2150 bool legacy = va_arg(args,
int);
2152 gchar *value_esc = NULL;
2156 if (value != NULL) {
2158 bool was_quiet = out->is_quiet(out);
2164 out->info(out,
"%s", value);
2166 out->quiet = was_quiet;
2172 s = g_string_sized_new(50);
2179 if (!pcmk__str_empty(scope)) {
2183 if (!pcmk__str_empty(instance)) {
2189 if (!pcmk__str_empty(
host)) {
2199 out->info(out,
"%s", s->str);
2202 g_string_free(s, TRUE);
2207 "const char *",
"const char *",
"bool",
"bool")
2211 const char *scope = va_arg(args,
const char *);
2212 const char *instance = va_arg(args,
const char *);
2213 const char *
name = va_arg(args,
const char *);
2214 const char *value = va_arg(args,
const char *);
2215 const char *
host = va_arg(args,
const char *);
2216 bool quiet G_GNUC_UNUSED = va_arg(args,
int);
2217 bool legacy G_GNUC_UNUSED = va_arg(args,
int);
2219 xmlNodePtr node = NULL;
2226 if (!pcmk__str_empty(scope)) {
2230 if (!pcmk__str_empty(instance)) {
2234 if (!pcmk__str_empty(
host)) {
2245 const char *rule_id = va_arg(args,
const char *);
2246 int result = va_arg(args,
int);
2247 const char *error = va_arg(args,
const char *);
2251 return out->info(out,
"Rule %s is still in effect", rule_id);
2253 return out->info(out,
"Rule %s satisfies conditions", rule_id);
2255 return out->info(out,
"Rule %s is expired", rule_id);
2257 return out->info(out,
"Rule %s has not yet taken effect", rule_id);
2259 return out->info(out,
"Rule %s does not satisfy conditions",
2263 "Could not determine whether rule %s is in effect: %s",
2264 rule_id, ((error != NULL)? error :
"unexpected error"));
2273 const char *rule_id = va_arg(args,
const char *);
2274 int result = va_arg(args,
int);
2275 const char *error = va_arg(args,
const char *);
2294 "Could not determine whether rule %s is in effect: %s",
2295 rule_id, ((error != NULL)? error :
"unexpected error"));
2311 int code = va_arg(args,
int);
2312 const char *
name = va_arg(args,
const char *);
2313 const char *desc = va_arg(args,
const char *);
2315 static int code_width = 0;
2317 if (out->is_quiet(out)) {
2322 if ((
name != NULL) && (desc != NULL)) {
2325 }
else if ((
name != NULL) || (desc != NULL)) {
2335 if (code_width == 0) {
2337 code_width = (int) snprintf(NULL, 0,
"%lld", most_negative);
2340 if ((
name != NULL) && (desc != NULL)) {
2341 static int name_width = 0;
2343 if (name_width == 0) {
2347 name_width = QB_MAX(name_width, len);
2350 return out->info(out,
"% *d: %-*s %s", code_width, code, name_width,
2354 if ((
name != NULL) || (desc != NULL)) {
2355 return out->info(out,
"% *d: %s", code_width, code,
2359 return out->info(out,
"% *d", code_width, code);
2366 int code = va_arg(args,
int);
2367 const char *
name = va_arg(args,
const char *);
2368 const char *desc = va_arg(args,
const char *);
2370 char *code_str = pcmk__itoa(code);
2381 PCMK__OUTPUT_ARGS(
"ticket-attribute",
"const char *",
"const char *",
"const char *")
2385 const char *ticket_id G_GNUC_UNUSED = va_arg(args,
const char *);
2386 const char *
name G_GNUC_UNUSED = va_arg(args,
const char *);
2387 const char *value = va_arg(args,
const char *);
2389 out->info(out,
"%s", value);
2393 PCMK__OUTPUT_ARGS(
"ticket-attribute",
"const char *",
"const char *",
"const char *")
2397 const char *ticket_id = va_arg(args,
const char *);
2398 const char *
name = va_arg(args,
const char *);
2399 const char *value = va_arg(args,
const char *);
2425 xmlNode *constraint_xml = va_arg(args, xmlNode *);
2445 out->info(out,
"Constraints XML:\n");
2451 GString *buf = g_string_sized_new(1024);
2455 g_string_free(buf, TRUE);
2457 child = pcmk__xe_next(child);
2458 }
while (child != NULL);
2460 GString *buf = g_string_sized_new(1024);
2464 g_string_free(buf, TRUE);
2471 add_ticket_element_with_constraints(xmlNode *node,
void *userdata)
2489 add_resource_element(xmlNode *node,
void *userdata)
2503 xmlNode *constraint_xml = va_arg(args, xmlNode *);
2546 add_ticket_element_with_constraints(constraint_xml, out);
2550 add_resource_element(constraint_xml, out);
2561 xmlNode *state_xml = va_arg(args, xmlNode *);
2563 GString *buf = g_string_sized_new(1024);
2565 out->info(out,
"State XML:\n");
2569 g_string_free(buf, TRUE);
2574 add_ticket_element(xmlNode *node,
void *userdata)
2577 xmlNode *ticket_node = NULL;
2588 xmlNode *state_xml = va_arg(args, xmlNode *);
2598 if (state_xml->children != NULL) {
2605 add_ticket_element(state_xml, out);
2613 {
"attribute",
"default", attribute_default },
2614 {
"attribute",
"xml", attribute_xml },
2616 {
"cluster-status",
"html", cluster_status_html },
2617 {
"cluster-status",
"xml", cluster_status_xml },
2618 {
"crmadmin-node",
"default", crmadmin_node },
2619 {
"crmadmin-node",
"text", crmadmin_node_text },
2620 {
"crmadmin-node",
"xml", crmadmin_node_xml },
2621 {
"dc",
"default", dc },
2622 {
"dc",
"text", dc_text },
2623 {
"dc",
"xml", dc_xml },
2624 {
"digests",
"default", digests_text },
2625 {
"digests",
"xml", digests_xml },
2626 {
"health",
"default", health },
2627 {
"health",
"text", health_text },
2628 {
"health",
"xml", health_xml },
2629 {
"inject-attr",
"default", inject_attr },
2630 {
"inject-attr",
"xml", inject_attr_xml },
2631 {
"inject-cluster-action",
"default", inject_cluster_action },
2632 {
"inject-cluster-action",
"xml", inject_cluster_action_xml },
2633 {
"inject-fencing-action",
"default", inject_fencing_action },
2634 {
"inject-fencing-action",
"xml", inject_fencing_action_xml },
2635 {
"inject-modify-config",
"default", inject_modify_config },
2636 {
"inject-modify-config",
"xml", inject_modify_config_xml },
2637 {
"inject-modify-node",
"default", inject_modify_node },
2638 {
"inject-modify-node",
"xml", inject_modify_node_xml },
2639 {
"inject-modify-ticket",
"default", inject_modify_ticket },
2640 {
"inject-modify-ticket",
"xml", inject_modify_ticket_xml },
2641 {
"inject-pseudo-action",
"default", inject_pseudo_action },
2642 {
"inject-pseudo-action",
"xml", inject_pseudo_action_xml },
2643 {
"inject-rsc-action",
"default", inject_rsc_action },
2644 {
"inject-rsc-action",
"xml", inject_rsc_action_xml },
2645 {
"inject-spec",
"default", inject_spec },
2646 {
"inject-spec",
"xml", inject_spec_xml },
2647 {
"locations-and-colocations",
"default", locations_and_colocations },
2648 {
"locations-and-colocations",
"xml", locations_and_colocations_xml },
2649 {
"locations-list",
"default", locations_list },
2650 {
"locations-list",
"xml", locations_list_xml },
2651 {
"node-action",
"default", node_action },
2652 {
"node-action",
"xml", node_action_xml },
2653 {
"node-info",
"default", node_info_default },
2654 {
"node-info",
"xml", node_info_xml },
2655 {
"pacemakerd-health",
"default", pacemakerd_health },
2656 {
"pacemakerd-health",
"html", pacemakerd_health_html },
2657 {
"pacemakerd-health",
"text", pacemakerd_health_text },
2658 {
"pacemakerd-health",
"xml", pacemakerd_health_xml },
2659 {
"profile",
"default", profile_default, },
2660 {
"profile",
"xml", profile_xml },
2662 {
"result-code",
"text", result_code_text },
2663 {
"result-code",
"xml", result_code_xml },
2664 {
"rsc-action",
"default", rsc_action_default },
2665 {
"rsc-action-item",
"default", rsc_action_item },
2666 {
"rsc-action-item",
"xml", rsc_action_item_xml },
2667 {
"rsc-is-colocated-with-list",
"default", rsc_is_colocated_with_list },
2668 {
"rsc-is-colocated-with-list",
"xml", rsc_is_colocated_with_list_xml },
2669 {
"rscs-colocated-with-list",
"default", rscs_colocated_with_list },
2670 {
"rscs-colocated-with-list",
"xml", rscs_colocated_with_list_xml },
2671 {
"rule-check",
"default", rule_check_default },
2672 {
"rule-check",
"xml", rule_check_xml },
2673 {
"ticket-attribute",
"default", ticket_attribute_default },
2674 {
"ticket-attribute",
"xml", ticket_attribute_xml },
2675 {
"ticket-constraints",
"default", ticket_constraints_default },
2676 {
"ticket-constraints",
"xml", ticket_constraints_xml },
2677 {
"ticket-state",
"default", ticket_state_default },
2678 {
"ticket-state",
"xml", ticket_state_xml },
2680 { NULL, NULL, NULL }
#define CRM_CHECK(expr, failure_action)
#define PCMK_XE_PACEMAKERD
xmlNode * pcmk__xml_copy(xmlNode *parent, xmlNode *src)
#define crm_notice(fmt, args...)
#define PCMK_XA_NEXT_ROLE
char * pcmk__xml_escape(const char *text, enum pcmk__xml_escape_type type)
pcmk_scheduler_t * cluster
const char * pcmk_role_text(enum rsc_role_e role)
Get readable description of a resource role.
stonith_history_t * stonith__first_matching_event(stonith_history_t *history, bool(*matching_fn)(stonith_history_t *, void *), void *user_data)
#define PCMK__XE_TICKET_STATE
Control output from tools.
void pcmk__register_messages(pcmk__output_t *out, const pcmk__message_entry_t *table)
int pcmk__xe_copy_attrs(xmlNode *target, const xmlNode *src, uint32_t flags)
#define PCMK_XA_REMOTE_NODE
#define crm_time_log_timeofday
pcmk_resource_t * uber_parent(pcmk_resource_t *rsc)
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.
void pcmk__xml_string(const xmlNode *data, uint32_t options, GString *buffer, int depth)
#define PCMK_XE_CONSTRAINTS
bool pcmk__xml_needs_escape(const char *text, enum pcmk__xml_escape_type type)
#define PCMK_XE_RSC_COLOCATION
#define pcmk__rsc_info(rsc, fmt, args...)
enum rsc_role_e next_role
#define PCMK_XA_WITH_RSC_ROLE
#define PCMK_ACTION_MONITOR
crm_exit_t pcmk_rc2exitc(int rc)
Map a function return code to the most similar exit code.
#define PCMK_XA_HAVE_QUORUM
#define PCMK__XE_XPATH_QUERY
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 PCMK_XE_PSEUDO_ACTION
#define CHECK_RC(retcode, retval)
void pcmk__xe_set_bool_attr(xmlNodePtr node, const char *name, bool value)
#define PCMK_XE_RESULT_CODE
enum crm_exit_e crm_exit_t
#define CRM_LOG_ASSERT(expr)
enum crm_ais_msg_types type
#define PCMK_XE_NODE_ACTION
GList * pe__resource_actions(const pcmk_resource_t *rsc, const pcmk_node_t *node, const char *task, bool require_node)
Find all actions of given type for a resource.
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)
#define PCMK_XA_NODE_PATH
#define PCMK_XE_ATTRIBUTE
Include indentation and newlines.
bool stonith__event_state_pending(stonith_history_t *history, void *user_data)
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)
#define PCMK_XE_RULE_CHECK
void pe__clear_resource_flags_on_all(pcmk_scheduler_t *scheduler, uint64_t flag)
#define PCMK_ACTION_DEMOTE
const char * crm_exit_str(crm_exit_t exit_code)
#define PCMK_XA_LAST_UPDATED
#define PCMK_XE_RSC_ACTION
#define PCMK_XE_RSC_LOCATION
#define PCMK_XA_NODE_NAME
#define PCMK_XE_INJECT_ATTR
void pcmk__unpack_constraints(pcmk_scheduler_t *scheduler)
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
xmlNode * pcmk__xe_first_child(const xmlNode *parent, const char *node_name, const char *attr_n, const char *attr_v)
#define PCMK_XA_DESCRIPTION
void pcmk__g_strcat(GString *buffer,...) G_GNUC_NULL_TERMINATED
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.
struct pe_node_shared_s * details
#define PCMK_ACTION_START
Wrappers for and extensions to libxml2.
PCMK__OUTPUT_ARGS("rsc-action-item", "const char *", "pcmk_resource_t *", "pcmk_node_t *", "pcmk_node_t *", "pcmk_action_t *", "pcmk_action_t *")
xmlNodePtr pcmk__output_create_xml_node(pcmk__output_t *out, const char *name,...) G_GNUC_NULL_TERMINATED
#define PCMK_XE_CONSTRAINT
#define PCMK_XE_INJECT_SPEC
#define pcmk__set_rsc_flags(resource, flags_to_set)
#define pcmk_section_fencing_all
int pcmk__cluster_status_text(pcmk__output_t *out, va_list args)
char * digest_restart_calc
#define PCMK_XE_NODE_INFO
#define crm_time_log_with_timezone
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
pcmk_resource_t * primary
#define PCMK__OUTPUT_LIST_FOOTER(out_obj, retcode)
#define PCMK_XA_NODE_ATTRIBUTE
#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.
int pcmk__xe_foreach_child(xmlNode *xml, const char *child_element_name, int(*handler)(xmlNode *xml, void *userdata), void *userdata)
pcmk_scheduler_t * scheduler
const char * pcmk_pacemakerd_api_daemon_state_enum2text(enum pcmk_pacemakerd_state state)
#define STOP_SANITY_ASSERT(lineno)
GList * find_actions(GList *input, const char *key, const pcmk_node_t *on_node)
char * pcmk__epoch2str(const time_t *source, uint32_t flags)
#define PCMK_ACTION_MIGRATE_FROM
This structure contains everything that makes up a single output formatter.
#define PCMK_XA_ATTRIBUTE
#define PCMK_ACTION_PROMOTE
pcmk_resource_t * dependent
const char * pcmk__pcmkd_state_enum2friendly(enum pcmk_pacemakerd_state state)
#define PCMK_XE_FENCING_ACTION
enum pe_action_flags flags
#define PCMK_XE_MODIFICATIONS
const char * node_attribute
#define PCMK_XE_MODIFY_TICKET
char * digest_secure_calc
Resource role is unknown.
Location constraint object.
#define PCMK_XE_CLUSTER_ACTION
xmlNode * pcmk__xe_create(xmlNode *parent, const char *name)
#define PCMK_XE_MODIFY_NODE
bool stonith__event_state_eq(stonith_history_t *history, void *user_data)
#define PCMK_XE_RESOURCES
#define crm_time_log_date
bool stonith__event_state_neq(stonith_history_t *history, void *user_data)
void pcmk__output_xml_add_node_copy(pcmk__output_t *out, xmlNodePtr node)