17 #include <libxml/tree.h> 31 (dependents?
"needs" :
"with"),
46 const char *dependent_role = NULL;
47 const char *primary_role = NULL;
75 for (lpc = list; lpc != NULL; lpc = lpc->next) {
80 for (lpc2 = cons->
nodes; lpc2 != NULL; lpc2 = lpc2->next) {
105 "pcmk_node_t *",
"pcmk_node_t *",
"pcmk_action_t *",
110 const char *change = va_arg(args,
const char *);
119 char *details = NULL;
120 bool same_host =
false;
121 bool same_role =
false;
122 bool need_role =
false;
124 static int rsc_width = 5;
125 static int detail_width = 5;
128 && ((destination != NULL) || (origin != NULL)));
130 if (source == NULL) {
134 len = strlen(rsc->
id);
135 if (len > rsc_width) {
144 if (pcmk__same_node(origin, destination)) {
152 if (need_role && (origin == NULL)) {
156 pcmk__node_name(destination));
158 }
else if (origin == NULL) {
162 }
else if (need_role && (destination == NULL)) {
165 pcmk__node_name(origin));
167 }
else if (destination == NULL) {
171 }
else if (need_role && same_role && same_host) {
174 pcmk__node_name(origin));
176 }
else if (same_role && same_host) {
180 }
else if (need_role && same_role) {
183 pcmk__node_name(destination),
186 }
else if (same_role) {
189 pcmk__node_name(destination));
191 }
else if (same_host) {
195 pcmk__node_name(origin));
201 pcmk__node_name(origin),
203 pcmk__node_name(destination));
206 len = strlen(details);
207 if (len > detail_width) {
211 if ((source->
reason != NULL)
215 }
else if (source->
reason) {
219 reason = strdup(
"blocked");
223 out->list_item(out, NULL,
"%-8s %-*s ( %*s )%s%s",
224 change, rsc_width, rsc->
id, detail_width, details,
225 ((reason == NULL)?
"" :
" "), pcmk__s(reason,
""));
233 "pcmk_node_t *",
"pcmk_node_t *",
"pcmk_action_t *",
238 const char *change = va_arg(args,
const char *);
245 char *change_str = NULL;
247 bool same_host =
false;
248 bool same_role =
false;
249 bool need_role =
false;
253 && ((destination != NULL) || (origin != NULL)));
255 if (source == NULL) {
264 if (pcmk__same_node(origin, destination)) {
272 change_str = g_ascii_strdown(change, -1);
279 if (need_role && (origin == NULL)) {
287 }
else if (origin == NULL) {
291 }
else if (need_role && (destination == NULL)) {
298 }
else if (destination == NULL) {
302 }
else if (need_role && same_role && same_host) {
309 }
else if (same_role && same_host) {
313 }
else if (need_role && same_role) {
321 }
else if (same_role) {
328 }
else if (same_host) {
346 if ((source->
reason != NULL)
353 }
else if (source->
reason != NULL) {
368 bool recursive = va_arg(args,
int);
380 for (GList *lpc = rsc->
rsc_cons; lpc != NULL; lpc = lpc->next) {
385 "Resources %s is colocated with", rsc->
id);
388 out->list_item(out, NULL,
"%s (id=%s - loop)",
393 hdr = colocations_header(cons->
primary, cons,
false);
394 out->list_item(out, NULL,
"%s", hdr);
398 out->begin_list(out, NULL, NULL, NULL);
400 out->message(out,
"locations-list", cons->
primary);
402 out->message(out,
"rsc-is-colocated-with-list",
415 rsc_is_colocated_with_list_xml(
pcmk__output_t *out, va_list args) {
417 bool recursive = va_arg(args,
int);
429 for (GList *lpc = rsc->
rsc_cons; lpc != NULL; lpc = lpc->next) {
433 colocations_xml_node(out, cons->
primary, cons);
437 colocations_xml_node(out, cons->
primary, cons);
438 do_locations_list_xml(out, cons->
primary,
false);
441 out->message(out,
"rsc-is-colocated-with-list",
453 bool recursive = va_arg(args,
int);
466 for (GList *lpc = rsc->
rsc_cons_lhs; lpc != NULL; lpc = lpc->next) {
474 out->list_item(out, NULL,
"%s (id=%s - loop)",
479 hdr = colocations_header(cons->
dependent, cons,
true);
480 out->list_item(out, NULL,
"%s", hdr);
484 out->begin_list(out, NULL, NULL, NULL);
486 out->message(out,
"locations-list", cons->
dependent);
488 out->message(out,
"rscs-colocated-with-list",
503 bool recursive = va_arg(args,
int);
516 for (GList *lpc = rsc->
rsc_cons_lhs; lpc != NULL; lpc = lpc->next) {
520 colocations_xml_node(out, cons->
dependent, cons);
524 colocations_xml_node(out, cons->
dependent, cons);
525 do_locations_list_xml(out, cons->
dependent,
false);
528 out->message(out,
"rscs-colocated-with-list",
545 for (lpc = list; lpc != NULL; lpc = lpc->next) {
550 for (lpc2 = cons->
nodes; lpc2 != NULL; lpc2 = lpc2->next) {
554 out->list_item(out, NULL,
"Node %s (score=%s, id=%s, rsc=%s)",
555 pcmk__node_name(node),
569 return do_locations_list_xml(out, rsc,
true);
578 bool recursive = va_arg(args,
int);
579 bool force = va_arg(args,
int);
588 out->message(out,
"locations-list", rsc);
591 out->message(out,
"rscs-colocated-with-list", rsc, recursive);
594 out->message(out,
"rsc-is-colocated-with-list", rsc, recursive);
604 bool recursive = va_arg(args,
int);
605 bool force = va_arg(args,
int);
615 do_locations_list_xml(out, rsc,
false);
618 out->message(out,
"rscs-colocated-with-list", rsc, recursive);
621 out->message(out,
"rsc-is-colocated-with-list", rsc, recursive);
632 const char *sys_from G_GNUC_UNUSED = va_arg(args,
const char *);
633 const char *host_from = va_arg(args,
const char *);
634 const char *fsa_state = va_arg(args,
const char *);
635 const char *
result = va_arg(args,
const char *);
637 return out->info(out,
"Controller on %s in state %s: %s",
638 pcmk__s(host_from,
"unknown node"),
639 pcmk__s(fsa_state,
"unknown"),
640 pcmk__s(
result,
"unknown result"));
648 if (!out->is_quiet(out)) {
649 return health(out, args);
651 const char *sys_from G_GNUC_UNUSED = va_arg(args,
const char *);
652 const char *host_from G_GNUC_UNUSED = va_arg(args,
const char *);
653 const char *fsa_state = va_arg(args,
const char *);
654 const char *
result G_GNUC_UNUSED = va_arg(args,
const char *);
656 if (fsa_state != NULL) {
670 const char *sys_from = va_arg(args,
const char *);
671 const char *host_from = va_arg(args,
const char *);
672 const char *fsa_state = va_arg(args,
const char *);
673 const char *
result = va_arg(args,
const char *);
684 "enum pcmk_pacemakerd_state",
"const char *",
"time_t")
688 const char *sys_from = va_arg(args,
const char *);
691 const char *state_s = va_arg(args,
const char *);
692 time_t last_updated = va_arg(args, time_t);
694 char *last_updated_s = NULL;
697 if (sys_from == NULL) {
699 sys_from =
"pacemaker-remoted";
705 if (state_s == NULL) {
709 if (last_updated != 0) {
716 rc = out->info(out,
"Status of %s: '%s' (last updated %s)",
718 pcmk__s(last_updated_s,
"at unknown time"));
720 free(last_updated_s);
725 "enum pcmk_pacemakerd_state",
"const char *",
"time_t")
729 const char *sys_from = va_arg(args,
const char *);
732 const char *state_s = va_arg(args,
const char *);
733 time_t last_updated = va_arg(args, time_t);
735 char *last_updated_s = NULL;
738 if (sys_from == NULL) {
740 sys_from =
"pacemaker-remoted";
746 if (state_s == NULL) {
750 if (last_updated != 0) {
759 pcmk__s(last_updated_s,
"at unknown time"));
763 free(last_updated_s);
768 "enum pcmk_pacemakerd_state",
"const char *",
"time_t")
772 if (!out->is_quiet(out)) {
773 return pacemakerd_health(out, args);
775 const char *sys_from G_GNUC_UNUSED = va_arg(args,
const char *);
778 const char *state_s = va_arg(args,
const char *);
779 time_t last_updated G_GNUC_UNUSED = va_arg(args, time_t);
781 if (state_s == NULL) {
790 "enum pcmk_pacemakerd_state",
"const char *",
"time_t")
794 const char *sys_from = va_arg(args,
const char *);
797 const char *state_s = va_arg(args,
const char *);
798 time_t last_updated = va_arg(args, time_t);
800 char *last_updated_s = NULL;
802 if (sys_from == NULL) {
804 sys_from =
"pacemaker-remoted";
810 if (state_s == NULL) {
814 if (last_updated != 0) {
826 free(last_updated_s);
833 const char *xml_file = va_arg(args,
const char *);
834 clock_t start = va_arg(args, clock_t);
835 clock_t end = va_arg(args, clock_t);
837 out->list_item(out, NULL,
"Testing %s ... %.2f secs", xml_file,
838 (end - start) / (
float) CLOCKS_PER_SEC);
846 const char *xml_file = va_arg(args,
const char *);
847 clock_t start = va_arg(args, clock_t);
848 clock_t end = va_arg(args, clock_t);
850 char *duration = pcmk__ftoa((end - start) / (
float) CLOCKS_PER_SEC);
865 const char *dc = va_arg(args,
const char *);
867 return out->info(out,
"Designated Controller is: %s",
868 pcmk__s(dc,
"not yet elected"));
875 if (!out->is_quiet(out)) {
876 return dc(out, args);
878 const char *dc = va_arg(args,
const char *);
893 const char *dc = va_arg(args,
const char *);
902 "const char *",
"bool")
906 const char *
type = va_arg(args,
const char *);
907 const char *
name = va_arg(args,
const char *);
908 const char *
id = va_arg(args,
const char *);
909 bool bash_export = va_arg(args,
int);
912 return out->info(out,
"export %s=%s",
913 pcmk__s(
name,
"<null>"), pcmk__s(
id,
""));
915 return out->info(out,
"%s node: %s (%s)",
type ?
type :
"cluster",
916 pcmk__s(
name,
"<null>"), pcmk__s(
id,
"<null>"));
921 "const char *",
"bool")
925 if (!out->is_quiet(out)) {
926 return crmadmin_node(out, args);
928 const char *
type G_GNUC_UNUSED = va_arg(args,
const char *);
929 const char *
name = va_arg(args,
const char *);
930 const char *
id G_GNUC_UNUSED = va_arg(args,
const char *);
931 bool bash_export G_GNUC_UNUSED = va_arg(args,
int);
939 "const char *",
"bool")
943 const char *
type = va_arg(args,
const char *);
944 const char *
name = va_arg(args,
const char *);
945 const char *
id = va_arg(args,
const char *);
946 bool bash_export G_GNUC_UNUSED = va_arg(args,
int);
957 "const char *",
"guint",
"const pcmk__op_digest_t *")
963 const char *task = va_arg(args,
const char *);
964 guint interval_ms = va_arg(args, guint);
967 char *action_desc = NULL;
968 const char *rsc_desc =
"unknown resource";
969 const char *node_desc =
"unknown node";
971 if (interval_ms != 0) {
973 ((task == NULL)?
"unknown" : task));
975 action_desc = strdup(
"probe action");
978 ((task == NULL)?
"unknown" : task));
980 if ((rsc != NULL) && (rsc->
id != NULL)) {
986 out->begin_list(out, NULL, NULL,
"Digests for %s %s on %s",
987 rsc_desc, action_desc, node_desc);
990 if (digests == NULL) {
991 out->list_item(out, NULL,
"none");
996 out->list_item(out, NULL,
"%s (all parameters)",
1000 out->list_item(out, NULL,
"%s (non-private parameters)",
1004 out->list_item(out, NULL,
"%s (non-reloadable parameters)",
1012 add_digest_xml(xmlNode *
parent,
const char *
type,
const char *digest,
1013 xmlNode *digest_source)
1015 if (digest != NULL) {
1025 "const char *",
"guint",
"const pcmk__op_digest_t *")
1031 const char *task = va_arg(args,
const char *);
1032 guint interval_ms = va_arg(args, guint);
1036 xmlNode *xml = NULL;
1046 if (digests != NULL) {
1057 #define STOP_SANITY_ASSERT(lineno) do { \ 1058 if ((current != NULL) && current->details->unclean) { \ 1060 } else if (stop == NULL) { \ 1061 crm_err("%s:%d: No stop action exists for %s", \ 1062 __func__, lineno, rsc->id); \ 1063 pcmk__assert(stop != NULL); \ 1064 } else if (pcmk_is_set(stop->flags, pcmk_action_optional)) { \ 1065 crm_err("%s:%d: Action %s is still optional", \ 1066 __func__, lineno, stop->uuid); \ 1067 pcmk__assert(!pcmk_is_set(stop->flags, pcmk_action_optional)); \ 1080 GList *possible_matches = NULL;
1083 bool moving =
false;
1093 || (current == NULL && next == NULL)) {
1098 (managed?
"" :
" unmanaged"));
1102 moving = (current != NULL) && (next != NULL)
1103 && !pcmk__same_node(current, next);
1107 if (possible_matches) {
1108 start = possible_matches->data;
1109 g_list_free(possible_matches);
1116 start_node = current;
1120 if (possible_matches) {
1121 stop = possible_matches->data;
1122 g_list_free(possible_matches);
1130 if (possible_matches != NULL) {
1131 stop = possible_matches->data;
1132 g_list_free(possible_matches);
1138 if (possible_matches) {
1139 promote = possible_matches->data;
1140 g_list_free(possible_matches);
1145 if (possible_matches) {
1146 demote = possible_matches->data;
1147 g_list_free(possible_matches);
1158 if (possible_matches) {
1159 migrate_op = possible_matches->data;
1162 if ((migrate_op != NULL) && (current != NULL)
1164 rc = out->message(out,
"rsc-action-item",
"Migrate", rsc, current,
1168 rc = out->message(out,
"rsc-action-item",
"Reload", rsc, current,
1171 }
else if ((start == NULL)
1173 if ((demote != NULL) && (promote != NULL)
1176 rc = out->message(out,
"rsc-action-item",
"Re-promote", rsc,
1177 current, next, promote, demote);
1181 pcmk__node_name(next));
1185 if ((stop == NULL) || (stop->
reason == NULL)) {
1190 rc = out->message(out,
"rsc-action-item",
"Stop", rsc, current,
1191 NULL, stop, reason_op);
1194 }
else if (moving && current) {
1197 rc = out->message(out,
"rsc-action-item",
1198 (failed?
"Recover" :
"Move"), rsc, current, next,
1202 rc = out->message(out,
"rsc-action-item",
"Recover", rsc, current,
1207 rc = out->message(out,
"rsc-action-item",
"Restart", rsc, current,
1217 g_list_free(possible_matches);
1227 for (GList *iter = rsc->
running_on; iter != NULL; iter = iter->next) {
1233 if (possible_matches) {
1234 stop_op = possible_matches->data;
1235 g_list_free(possible_matches);
1238 if (stop_op != NULL) {
1242 if (stop_op->
reason != NULL) {
1243 reason_op = stop_op;
1247 if (out->message(out,
"rsc-action-item",
"Stop", rsc, node, NULL,
1255 }
else if ((stop != NULL)
1256 && pcmk_all_flags_set(rsc->
flags,
1259 rc = out->message(out,
"rsc-action-item",
"Recover", rsc, current,
1263 }
else if (moving) {
1264 rc = out->message(out,
"rsc-action-item",
"Move", rsc, current, next,
1269 rc = out->message(out,
"rsc-action-item",
"Reload", rsc, current, next,
1272 }
else if ((stop != NULL)
1274 rc = out->message(out,
"rsc-action-item",
"Restart", rsc, current,
1280 rc = out->message(out,
"rsc-action-item",
"Demote", rsc, current,
1281 next, demote, NULL);
1285 rc = out->message(out,
"rsc-action-item",
"Promote", rsc, current,
1286 next, promote, NULL);
1290 rc = out->message(out,
"rsc-action-item",
"Start", rsc, current, next,
1297 PCMK__OUTPUT_ARGS(
"node-action",
"const char *",
"const char *",
"const char *")
1301 const char *task = va_arg(args,
const char *);
1302 const char *node_name = va_arg(args,
const char *);
1303 const char *reason = va_arg(args,
const char *);
1307 }
else if (reason) {
1308 out->list_item(out, NULL,
"%s %s '%s'", task, node_name, reason);
1316 PCMK__OUTPUT_ARGS(
"node-action",
"const char *",
"const char *",
"const char *")
1320 const char *task = va_arg(args,
const char *);
1321 const char *node_name = va_arg(args,
const char *);
1322 const char *reason = va_arg(args,
const char *);
1326 }
else if (reason) {
1340 "const char *",
"bool",
"bool")
1344 uint32_t node_id = va_arg(args, uint32_t);
1345 const char *node_name = va_arg(args,
const char *);
1346 const char *uuid = va_arg(args,
const char *);
1347 const char *state = va_arg(args,
const char *);
1348 bool have_quorum = (bool) va_arg(args,
int);
1349 bool is_remote = (bool) va_arg(args,
int);
1351 return out->info(out,
1352 "Node %" PRIu32
": %s " 1353 "(uuid=%s, state=%s, have_quorum=%s, is_remote=%s)",
1354 node_id, pcmk__s(node_name,
"unknown"),
1355 pcmk__s(uuid,
"unknown"), pcmk__s(state,
"unknown"),
1356 pcmk__btoa(have_quorum), pcmk__btoa(is_remote));
1360 "const char *",
"bool",
"bool")
1364 uint32_t node_id = va_arg(args, uint32_t);
1365 const char *node_name = va_arg(args,
const char *);
1366 const char *uuid = va_arg(args,
const char *);
1367 const char *state = va_arg(args,
const char *);
1368 bool have_quorum = (bool) va_arg(args,
int);
1369 bool is_remote = (bool) va_arg(args,
int);
1390 const char *node = va_arg(args,
const char *);
1391 const char *task = va_arg(args,
const char *);
1392 xmlNodePtr rsc = va_arg(args, xmlNodePtr);
1394 if (out->is_quiet(out)) {
1399 out->list_item(out, NULL,
"Cluster action: %s for %s on %s",
1400 task, pcmk__xe_id(rsc), node);
1402 out->list_item(out, NULL,
"Cluster action: %s on %s", task, node);
1413 const char *node = va_arg(args,
const char *);
1414 const char *task = va_arg(args,
const char *);
1415 xmlNodePtr rsc = va_arg(args, xmlNodePtr);
1417 xmlNodePtr xml_node = NULL;
1419 if (out->is_quiet(out)) {
1439 const char *
target = va_arg(args,
const char *);
1440 const char *op = va_arg(args,
const char *);
1442 if (out->is_quiet(out)) {
1446 out->list_item(out, NULL,
"Fencing %s (%s)",
target, op);
1454 const char *
target = va_arg(args,
const char *);
1455 const char *op = va_arg(args,
const char *);
1457 if (out->is_quiet(out)) {
1472 const char *
name = va_arg(args,
const char *);
1473 const char *value = va_arg(args,
const char *);
1474 xmlNodePtr cib_node = va_arg(args, xmlNodePtr);
1476 xmlChar *node_path = NULL;
1478 if (out->is_quiet(out)) {
1482 node_path = xmlGetNodePath(cib_node);
1484 out->list_item(out, NULL,
"Injecting attribute %s=%s into %s '%s'",
1485 name, value, node_path, pcmk__xe_id(cib_node));
1495 const char *
name = va_arg(args,
const char *);
1496 const char *value = va_arg(args,
const char *);
1497 xmlNodePtr cib_node = va_arg(args, xmlNodePtr);
1499 xmlChar *node_path = NULL;
1501 if (out->is_quiet(out)) {
1505 node_path = xmlGetNodePath(cib_node);
1521 const char *spec = va_arg(args,
const char *);
1523 if (out->is_quiet(out)) {
1527 out->list_item(out, NULL,
"Injecting %s into the configuration", spec);
1535 const char *spec = va_arg(args,
const char *);
1537 if (out->is_quiet(out)) {
1551 const char *quorum = va_arg(args,
const char *);
1552 const char *watchdog = va_arg(args,
const char *);
1554 if (out->is_quiet(out)) {
1558 out->begin_list(out, NULL, NULL,
"Performing Requested Modifications");
1561 out->list_item(out, NULL,
"Setting quorum: %s", quorum);
1565 out->list_item(out, NULL,
"Setting watchdog: %s", watchdog);
1575 const char *quorum = va_arg(args,
const char *);
1576 const char *watchdog = va_arg(args,
const char *);
1578 xmlNodePtr node = NULL;
1580 if (out->is_quiet(out)) {
1602 const char *
action = va_arg(args,
const char *);
1603 const char *node = va_arg(args,
const char *);
1605 if (out->is_quiet(out)) {
1610 out->list_item(out, NULL,
"Bringing node %s online", node);
1613 out->list_item(out, NULL,
"Taking node %s offline", node);
1616 out->list_item(out, NULL,
"Failing node %s", node);
1627 const char *
action = va_arg(args,
const char *);
1628 const char *node = va_arg(args,
const char *);
1630 if (out->is_quiet(out)) {
1645 const char *
action = va_arg(args,
const char *);
1646 const char *ticket = va_arg(args,
const char *);
1648 if (out->is_quiet(out)) {
1653 out->list_item(out, NULL,
"Making ticket %s standby", ticket);
1655 out->list_item(out, NULL,
"%s ticket %s",
action, ticket);
1665 const char *
action = va_arg(args,
const char *);
1666 const char *ticket = va_arg(args,
const char *);
1668 if (out->is_quiet(out)) {
1683 const char *node = va_arg(args,
const char *);
1684 const char *task = va_arg(args,
const char *);
1686 if (out->is_quiet(out)) {
1690 out->list_item(out, NULL,
"Pseudo action: %s%s%s",
1691 task, ((node == NULL)?
"" :
" on "), pcmk__s(node,
""));
1699 const char *node = va_arg(args,
const char *);
1700 const char *task = va_arg(args,
const char *);
1702 xmlNodePtr xml_node = NULL;
1704 if (out->is_quiet(out)) {
1719 "const char *",
"guint")
1723 const char *rsc = va_arg(args,
const char *);
1724 const char *operation = va_arg(args,
const char *);
1725 const char *node = va_arg(args,
const char *);
1726 guint interval_ms = va_arg(args, guint);
1728 if (out->is_quiet(out)) {
1733 out->list_item(out, NULL,
"Resource action: %-15s %s=%u on %s",
1734 rsc, operation, interval_ms, node);
1736 out->list_item(out, NULL,
"Resource action: %-15s %s on %s",
1737 rsc, operation, node);
1744 "const char *",
"guint")
1748 const char *rsc = va_arg(args,
const char *);
1749 const char *operation = va_arg(args,
const char *);
1750 const char *node = va_arg(args,
const char *);
1751 guint interval_ms = va_arg(args, guint);
1753 xmlNodePtr xml_node = NULL;
1755 if (out->is_quiet(out)) {
1766 char *interval_s = pcmk__itoa(interval_ms);
1775 #define CHECK_RC(retcode, retval) \ 1776 if (retval == pcmk_rc_ok) { \ 1777 retcode = pcmk_rc_ok; \ 1781 "enum pcmk_pacemakerd_state",
"crm_exit_t",
1782 "stonith_history_t *",
"enum pcmk__fence_history",
"uint32_t",
1783 "uint32_t",
"const char *",
"GList *",
"GList *")
1793 uint32_t section_opts = va_arg(args, uint32_t);
1794 uint32_t show_opts = va_arg(args, uint32_t);
1795 const char *prefix = va_arg(args,
const char *);
1796 GList *unames = va_arg(args, GList *);
1797 GList *resources = va_arg(args, GList *);
1800 bool already_printed_failure =
false;
1803 section_opts, show_opts));
1826 if (pcmk_any_flags_set(section_opts,
1829 resources, section_opts, show_opts,
1845 if (history_rc == 0) {
1852 CHECK_RC(rc, out->message(out,
"failed-fencing-list",
1853 stonith_history, unames, section_opts,
1858 out->begin_list(out, NULL, NULL,
"Failed Fencing Actions");
1859 out->list_item(out, NULL,
"Failed to get fencing history: %s",
1863 already_printed_failure =
true;
1882 if (history_rc != 0) {
1883 if (!already_printed_failure) {
1885 out->begin_list(out, NULL, NULL,
"Failed Fencing Actions");
1886 out->list_item(out, NULL,
"Failed to get fencing history: %s",
1897 CHECK_RC(rc, out->message(out,
"fencing-list", hp, unames,
1898 section_opts, show_opts,
1908 CHECK_RC(rc, out->message(out,
"pending-fencing-list", hp,
1909 unames, section_opts, show_opts,
1919 "enum pcmk_pacemakerd_state",
"crm_exit_t",
1920 "stonith_history_t *",
"enum pcmk__fence_history",
"uint32_t",
1921 "uint32_t",
"const char *",
"GList *",
"GList *")
1931 uint32_t section_opts = va_arg(args, uint32_t);
1932 uint32_t show_opts = va_arg(args, uint32_t);
1933 const char *prefix = va_arg(args,
const char *);
1934 GList *unames = va_arg(args, GList *);
1935 GList *resources = va_arg(args, GList *);
1937 out->message(out,
"cluster-summary",
scheduler, pcmkd_state, section_opts,
1942 out->message(out,
"node-list",
scheduler->
nodes, unames, resources,
1951 out->message(out,
"resource-list",
scheduler, full_show_opts,
1952 false, unames, resources,
false);
1957 out->message(out,
"node-attribute-list",
scheduler, show_opts,
false,
1964 if (pcmk_any_flags_set(section_opts,
1966 out->message(out,
"node-summary",
scheduler, unames,
1967 resources, section_opts, show_opts,
false);
1975 out->message(out,
"failed-action-list",
scheduler, unames, resources,
1982 out->message(out,
"full-fencing-list", history_rc, stonith_history,
1983 unames, section_opts, show_opts,
false);
1993 out->message(out,
"ban-list",
scheduler, prefix, resources, show_opts,
2001 "enum pcmk_pacemakerd_state",
"crm_exit_t",
2002 "stonith_history_t *",
"enum pcmk__fence_history",
"uint32_t",
2003 "uint32_t",
"const char *",
"GList *",
"GList *")
2013 uint32_t section_opts = va_arg(args, uint32_t);
2014 uint32_t show_opts = va_arg(args, uint32_t);
2015 const char *prefix = va_arg(args,
const char *);
2016 GList *unames = va_arg(args, GList *);
2017 GList *resources = va_arg(args, GList *);
2018 bool already_printed_failure =
false;
2020 out->message(out,
"cluster-summary",
scheduler, pcmkd_state, section_opts,
2025 out->message(out,
"node-list",
scheduler->
nodes, unames, resources,
2031 out->message(out,
"resource-list",
scheduler, show_opts,
true, unames,
2037 out->message(out,
"node-attribute-list",
scheduler, show_opts,
false,
2044 if (pcmk_any_flags_set(section_opts,
2046 out->message(out,
"node-summary",
scheduler, unames,
2047 resources, section_opts, show_opts,
false);
2055 out->message(out,
"failed-action-list",
scheduler, unames, resources,
2062 if (history_rc == 0) {
2069 out->message(out,
"failed-fencing-list", stonith_history,
2070 unames, section_opts, show_opts,
false);
2073 out->begin_list(out, NULL, NULL,
"Failed Fencing Actions");
2074 out->list_item(out, NULL,
"Failed to get fencing history: %s",
2083 if (history_rc != 0) {
2084 if (!already_printed_failure) {
2085 out->begin_list(out, NULL, NULL,
"Failed Fencing Actions");
2086 out->list_item(out, NULL,
"Failed to get fencing history: %s",
2097 out->message(out,
"fencing-list", hp, unames, section_opts,
2107 out->message(out,
"pending-fencing-list", hp, unames,
2108 section_opts, show_opts,
false);
2120 out->message(out,
"ban-list",
scheduler, prefix, resources, show_opts,
2127 #define KV_PAIR(k, v) do { \ 2129 pcmk__g_strcat(s, k "=", pcmk__s(v, ""), " ", NULL); \ 2131 pcmk__g_strcat(s, k "=\"", pcmk__s(v, ""), "\" ", NULL); \ 2136 "const char *",
"const char *",
"bool",
"bool")
2140 const char *scope = va_arg(args,
const char *);
2141 const char *instance = va_arg(args,
const char *);
2142 const char *
name = va_arg(args,
const char *);
2143 const char *value = va_arg(args,
const char *);
2144 const char *
host = va_arg(args,
const char *);
2145 bool quiet = va_arg(args,
int);
2146 bool legacy = va_arg(args,
int);
2148 gchar *value_esc = NULL;
2152 if (value != NULL) {
2154 bool was_quiet = out->is_quiet(out);
2160 out->info(out,
"%s", value);
2162 out->quiet = was_quiet;
2168 s = g_string_sized_new(50);
2175 if (!pcmk__str_empty(scope)) {
2179 if (!pcmk__str_empty(instance)) {
2185 if (!pcmk__str_empty(
host)) {
2195 out->info(out,
"%s", s->str);
2198 g_string_free(s, TRUE);
2203 "const char *",
"const char *",
"bool",
"bool")
2207 const char *scope = va_arg(args,
const char *);
2208 const char *instance = va_arg(args,
const char *);
2209 const char *
name = va_arg(args,
const char *);
2210 const char *value = va_arg(args,
const char *);
2211 const char *
host = va_arg(args,
const char *);
2212 bool quiet G_GNUC_UNUSED = va_arg(args,
int);
2213 bool legacy G_GNUC_UNUSED = va_arg(args,
int);
2215 xmlNodePtr node = NULL;
2222 if (!pcmk__str_empty(scope)) {
2226 if (!pcmk__str_empty(instance)) {
2230 if (!pcmk__str_empty(
host)) {
2241 const char *rule_id = va_arg(args,
const char *);
2242 int result = va_arg(args,
int);
2243 const char *error = va_arg(args,
const char *);
2247 return out->info(out,
"Rule %s is still in effect", rule_id);
2249 return out->info(out,
"Rule %s satisfies conditions", rule_id);
2251 return out->info(out,
"Rule %s is expired", rule_id);
2253 return out->info(out,
"Rule %s has not yet taken effect", rule_id);
2255 return out->info(out,
"Rule %s does not satisfy conditions",
2259 "Could not determine whether rule %s is in effect: %s",
2260 rule_id, ((error != NULL)? error :
"unexpected error"));
2269 const char *rule_id = va_arg(args,
const char *);
2270 int result = va_arg(args,
int);
2271 const char *error = va_arg(args,
const char *);
2290 "Could not determine whether rule %s is in effect: %s",
2291 rule_id, ((error != NULL)? error :
"unexpected error"));
2307 int code = va_arg(args,
int);
2308 const char *
name = va_arg(args,
const char *);
2309 const char *desc = va_arg(args,
const char *);
2311 static int code_width = 0;
2313 if (out->is_quiet(out)) {
2318 if ((
name != NULL) && (desc != NULL)) {
2321 }
else if ((
name != NULL) || (desc != NULL)) {
2331 if (code_width == 0) {
2333 code_width = (int) snprintf(NULL, 0,
"%lld", most_negative);
2336 if ((
name != NULL) && (desc != NULL)) {
2337 static int name_width = 0;
2339 if (name_width == 0) {
2343 name_width = QB_MAX(name_width, len);
2346 return out->info(out,
"% *d: %-*s %s", code_width, code, name_width,
2350 if ((
name != NULL) || (desc != NULL)) {
2351 return out->info(out,
"% *d: %s", code_width, code,
2355 return out->info(out,
"% *d", code_width, code);
2362 int code = va_arg(args,
int);
2363 const char *
name = va_arg(args,
const char *);
2364 const char *desc = va_arg(args,
const char *);
2366 char *code_str = pcmk__itoa(code);
2377 PCMK__OUTPUT_ARGS(
"ticket-attribute",
"const char *",
"const char *",
"const char *")
2381 const char *ticket_id G_GNUC_UNUSED = va_arg(args,
const char *);
2382 const char *
name G_GNUC_UNUSED = va_arg(args,
const char *);
2383 const char *value = va_arg(args,
const char *);
2385 out->info(out,
"%s", value);
2389 PCMK__OUTPUT_ARGS(
"ticket-attribute",
"const char *",
"const char *",
"const char *")
2393 const char *ticket_id = va_arg(args,
const char *);
2394 const char *
name = va_arg(args,
const char *);
2395 const char *value = va_arg(args,
const char *);
2421 xmlNode *constraint_xml = va_arg(args, xmlNode *);
2441 out->info(out,
"Constraints XML:\n");
2447 GString *buf = g_string_sized_new(1024);
2451 g_string_free(buf, TRUE);
2453 child = pcmk__xe_next(child);
2454 }
while (child != NULL);
2456 GString *buf = g_string_sized_new(1024);
2460 g_string_free(buf, TRUE);
2467 add_ticket_element_with_constraints(xmlNode *node,
void *userdata)
2485 add_resource_element(xmlNode *node,
void *userdata)
2499 xmlNode *constraint_xml = va_arg(args, xmlNode *);
2542 add_ticket_element_with_constraints(constraint_xml, out);
2546 add_resource_element(constraint_xml, out);
2557 xmlNode *state_xml = va_arg(args, xmlNode *);
2559 GString *buf = g_string_sized_new(1024);
2561 out->info(out,
"State XML:\n");
2565 g_string_free(buf, TRUE);
2570 add_ticket_element(xmlNode *node,
void *userdata)
2573 xmlNode *ticket_node = NULL;
2584 xmlNode *state_xml = va_arg(args, xmlNode *);
2594 if (state_xml->children != NULL) {
2601 add_ticket_element(state_xml, out);
2609 {
"attribute",
"default", attribute_default },
2610 {
"attribute",
"xml", attribute_xml },
2612 {
"cluster-status",
"html", cluster_status_html },
2613 {
"cluster-status",
"xml", cluster_status_xml },
2614 {
"crmadmin-node",
"default", crmadmin_node },
2615 {
"crmadmin-node",
"text", crmadmin_node_text },
2616 {
"crmadmin-node",
"xml", crmadmin_node_xml },
2617 {
"dc",
"default", dc },
2618 {
"dc",
"text", dc_text },
2619 {
"dc",
"xml", dc_xml },
2620 {
"digests",
"default", digests_text },
2621 {
"digests",
"xml", digests_xml },
2622 {
"health",
"default", health },
2623 {
"health",
"text", health_text },
2624 {
"health",
"xml", health_xml },
2625 {
"inject-attr",
"default", inject_attr },
2626 {
"inject-attr",
"xml", inject_attr_xml },
2627 {
"inject-cluster-action",
"default", inject_cluster_action },
2628 {
"inject-cluster-action",
"xml", inject_cluster_action_xml },
2629 {
"inject-fencing-action",
"default", inject_fencing_action },
2630 {
"inject-fencing-action",
"xml", inject_fencing_action_xml },
2631 {
"inject-modify-config",
"default", inject_modify_config },
2632 {
"inject-modify-config",
"xml", inject_modify_config_xml },
2633 {
"inject-modify-node",
"default", inject_modify_node },
2634 {
"inject-modify-node",
"xml", inject_modify_node_xml },
2635 {
"inject-modify-ticket",
"default", inject_modify_ticket },
2636 {
"inject-modify-ticket",
"xml", inject_modify_ticket_xml },
2637 {
"inject-pseudo-action",
"default", inject_pseudo_action },
2638 {
"inject-pseudo-action",
"xml", inject_pseudo_action_xml },
2639 {
"inject-rsc-action",
"default", inject_rsc_action },
2640 {
"inject-rsc-action",
"xml", inject_rsc_action_xml },
2641 {
"inject-spec",
"default", inject_spec },
2642 {
"inject-spec",
"xml", inject_spec_xml },
2643 {
"locations-and-colocations",
"default", locations_and_colocations },
2644 {
"locations-and-colocations",
"xml", locations_and_colocations_xml },
2645 {
"locations-list",
"default", locations_list },
2646 {
"locations-list",
"xml", locations_list_xml },
2647 {
"node-action",
"default", node_action },
2648 {
"node-action",
"xml", node_action_xml },
2649 {
"node-info",
"default", node_info_default },
2650 {
"node-info",
"xml", node_info_xml },
2651 {
"pacemakerd-health",
"default", pacemakerd_health },
2652 {
"pacemakerd-health",
"html", pacemakerd_health_html },
2653 {
"pacemakerd-health",
"text", pacemakerd_health_text },
2654 {
"pacemakerd-health",
"xml", pacemakerd_health_xml },
2655 {
"profile",
"default", profile_default, },
2656 {
"profile",
"xml", profile_xml },
2658 {
"result-code",
"text", result_code_text },
2659 {
"result-code",
"xml", result_code_xml },
2660 {
"rsc-action",
"default", rsc_action_default },
2661 {
"rsc-action-item",
"default", rsc_action_item },
2662 {
"rsc-action-item",
"xml", rsc_action_item_xml },
2663 {
"rsc-is-colocated-with-list",
"default", rsc_is_colocated_with_list },
2664 {
"rsc-is-colocated-with-list",
"xml", rsc_is_colocated_with_list_xml },
2665 {
"rscs-colocated-with-list",
"default", rscs_colocated_with_list },
2666 {
"rscs-colocated-with-list",
"xml", rscs_colocated_with_list_xml },
2667 {
"rule-check",
"default", rule_check_default },
2668 {
"rule-check",
"xml", rule_check_xml },
2669 {
"ticket-attribute",
"default", ticket_attribute_default },
2670 {
"ticket-attribute",
"xml", ticket_attribute_xml },
2671 {
"ticket-constraints",
"default", ticket_constraints_default },
2672 {
"ticket-constraints",
"xml", ticket_constraints_xml },
2673 {
"ticket-state",
"default", ticket_state_default },
2674 {
"ticket-state",
"xml", ticket_state_xml },
2676 { 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
pcmk_resource_t * primary
#define pcmk__assert(expr)
#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)