17 #include <libxml/tree.h> 31 (dependents?
"needs" :
"with"),
44 xmlNodePtr node = NULL;
55 xmlSetProp(node, (
pcmkXmlStr)
"node-attribute",
78 for (lpc = list; lpc != NULL; lpc = lpc->next) {
83 for (lpc2 = cons->
node_list_rh; lpc2 != NULL; lpc2 = lpc2->next) {
108 "pcmk_node_t *",
"pcmk_node_t *",
"pcmk_action_t *",
113 const char *change = va_arg(args,
const char *);
122 char *details = NULL;
123 bool same_host =
false;
124 bool same_role =
false;
125 bool need_role =
false;
127 static int rsc_width = 5;
128 static int detail_width = 5;
131 CRM_ASSERT(destination != NULL || origin != NULL);
133 if (source == NULL) {
137 len = strlen(rsc->
id);
138 if (len > rsc_width) {
147 if (pe__same_node(origin, destination)) {
155 if (need_role && (origin == NULL)) {
159 pe__node_name(destination));
161 }
else if (origin == NULL) {
165 }
else if (need_role && (destination == NULL)) {
168 pe__node_name(origin));
170 }
else if (destination == NULL) {
174 }
else if (need_role && same_role && same_host) {
177 pe__node_name(origin));
179 }
else if (same_role && same_host) {
183 }
else if (need_role && same_role) {
186 pe__node_name(destination),
189 }
else if (same_role) {
192 pe__node_name(destination));
194 }
else if (same_host) {
198 pe__node_name(origin));
203 pe__node_name(origin),
205 pe__node_name(destination));
208 len = strlen(details);
209 if (len > detail_width) {
213 if ((source->
reason != NULL)
217 }
else if (source->
reason) {
221 reason = strdup(
"blocked");
225 out->list_item(out, NULL,
"%-8s %-*s ( %*s )%s%s",
226 change, rsc_width, rsc->
id, detail_width, details,
227 ((reason == NULL)?
"" :
" "), pcmk__s(reason,
""));
235 "pcmk_node_t *",
"pcmk_node_t *",
"pcmk_action_t *",
240 const char *change = va_arg(args,
const char *);
247 char *change_str = NULL;
249 bool same_host =
false;
250 bool same_role =
false;
251 bool need_role =
false;
255 CRM_ASSERT(destination != NULL || origin != NULL);
257 if (source == NULL) {
266 if (pe__same_node(origin, destination)) {
274 change_str = g_ascii_strdown(change, -1);
276 "action", change_str,
281 if (need_role && (origin == NULL)) {
289 }
else if (origin == NULL) {
293 }
else if (need_role && (destination == NULL)) {
300 }
else if (destination == NULL) {
304 }
else if (need_role && same_role && same_host) {
311 }
else if (same_role && same_host) {
315 }
else if (need_role && same_role) {
323 }
else if (same_role) {
330 }
else if (same_host) {
348 if ((source->
reason != NULL)
355 }
else if (source->
reason != NULL) {
370 bool recursive = va_arg(args,
int);
382 for (GList *lpc = rsc->
rsc_cons; lpc != NULL; lpc = lpc->next) {
387 "Resources %s is colocated with", rsc->
id);
390 out->list_item(out, NULL,
"%s (id=%s - loop)",
395 hdr = colocations_header(cons->
primary, cons,
false);
396 out->list_item(out, NULL,
"%s", hdr);
400 out->begin_list(out, NULL, NULL, NULL);
402 out->message(out,
"locations-list", cons->
primary);
404 out->message(out,
"rsc-is-colocated-with-list",
417 rsc_is_colocated_with_list_xml(
pcmk__output_t *out, va_list args) {
419 bool recursive = va_arg(args,
int);
431 for (GList *lpc = rsc->
rsc_cons; lpc != NULL; lpc = lpc->next) {
435 colocations_xml_node(out, cons->
primary, cons);
439 colocations_xml_node(out, cons->
primary, cons);
440 do_locations_list_xml(out, cons->
primary,
false);
443 out->message(out,
"rsc-is-colocated-with-list",
455 bool recursive = va_arg(args,
int);
468 for (GList *lpc = rsc->
rsc_cons_lhs; lpc != NULL; lpc = lpc->next) {
476 out->list_item(out, NULL,
"%s (id=%s - loop)",
481 hdr = colocations_header(cons->
dependent, cons,
true);
482 out->list_item(out, NULL,
"%s", hdr);
486 out->begin_list(out, NULL, NULL, NULL);
488 out->message(out,
"locations-list", cons->
dependent);
490 out->message(out,
"rscs-colocated-with-list",
505 bool recursive = va_arg(args,
int);
518 for (GList *lpc = rsc->
rsc_cons_lhs; lpc != NULL; lpc = lpc->next) {
522 colocations_xml_node(out, cons->
dependent, cons);
526 colocations_xml_node(out, cons->
dependent, cons);
527 do_locations_list_xml(out, cons->
dependent,
false);
530 out->message(out,
"rscs-colocated-with-list",
547 for (lpc = list; lpc != NULL; lpc = lpc->next) {
552 for (lpc2 = cons->
node_list_rh; lpc2 != NULL; lpc2 = lpc2->next) {
556 out->list_item(out, NULL,
"Node %s (score=%s, id=%s, rsc=%s)",
571 return do_locations_list_xml(out, rsc,
true);
580 bool recursive = va_arg(args,
int);
581 bool force = va_arg(args,
int);
590 out->message(out,
"locations-list", rsc);
593 out->message(out,
"rscs-colocated-with-list", rsc, recursive);
596 out->message(out,
"rsc-is-colocated-with-list", rsc, recursive);
606 bool recursive = va_arg(args,
int);
607 bool force = va_arg(args,
int);
617 do_locations_list_xml(out, rsc,
false);
620 out->message(out,
"rscs-colocated-with-list", rsc, recursive);
623 out->message(out,
"rsc-is-colocated-with-list", rsc, recursive);
634 const char *sys_from G_GNUC_UNUSED = va_arg(args,
const char *);
635 const char *host_from = va_arg(args,
const char *);
636 const char *fsa_state = va_arg(args,
const char *);
637 const char *
result = va_arg(args,
const char *);
639 return out->info(out,
"Controller on %s in state %s: %s",
640 pcmk__s(host_from,
"unknown node"),
641 pcmk__s(fsa_state,
"unknown"),
642 pcmk__s(
result,
"unknown result"));
650 if (!out->is_quiet(out)) {
651 return health(out, args);
653 const char *sys_from G_GNUC_UNUSED = va_arg(args,
const char *);
654 const char *host_from G_GNUC_UNUSED = va_arg(args,
const char *);
655 const char *fsa_state = va_arg(args,
const char *);
656 const char *
result G_GNUC_UNUSED = va_arg(args,
const char *);
658 if (fsa_state != NULL) {
672 const char *sys_from = va_arg(args,
const char *);
673 const char *host_from = va_arg(args,
const char *);
674 const char *fsa_state = va_arg(args,
const char *);
675 const char *
result = va_arg(args,
const char *);
678 "node_name", pcmk__s(host_from,
""),
679 "state", pcmk__s(fsa_state,
""),
680 "result", pcmk__s(
result,
""),
686 "enum pcmk_pacemakerd_state",
"const char *",
"time_t")
690 const char *sys_from = va_arg(args,
const char *);
693 const char *state_s = va_arg(args,
const char *);
694 time_t last_updated = va_arg(args, time_t);
696 char *last_updated_s = NULL;
699 if (sys_from == NULL) {
701 sys_from =
"pacemaker-remoted";
707 if (state_s == NULL) {
711 if (last_updated != 0) {
718 rc = out->info(out,
"Status of %s: '%s' (last updated %s)",
720 pcmk__s(last_updated_s,
"at unknown time"));
722 free(last_updated_s);
727 "enum pcmk_pacemakerd_state",
"const char *",
"time_t")
731 const char *sys_from = va_arg(args,
const char *);
734 const char *state_s = va_arg(args,
const char *);
735 time_t last_updated = va_arg(args, time_t);
737 char *last_updated_s = NULL;
740 if (sys_from == NULL) {
742 sys_from =
"pacemaker-remoted";
748 if (state_s == NULL) {
752 if (last_updated != 0) {
761 pcmk__s(last_updated_s,
"at unknown time"));
765 free(last_updated_s);
770 "enum pcmk_pacemakerd_state",
"const char *",
"time_t")
774 if (!out->is_quiet(out)) {
775 return pacemakerd_health(out, args);
777 const char *sys_from G_GNUC_UNUSED = va_arg(args,
const char *);
780 const char *state_s = va_arg(args,
const char *);
781 time_t last_updated G_GNUC_UNUSED = va_arg(args, time_t);
783 if (state_s == NULL) {
792 "enum pcmk_pacemakerd_state",
"const char *",
"time_t")
796 const char *sys_from = va_arg(args,
const char *);
799 const char *state_s = va_arg(args,
const char *);
800 time_t last_updated = va_arg(args, time_t);
802 char *last_updated_s = NULL;
804 if (sys_from == NULL) {
806 sys_from =
"pacemaker-remoted";
812 if (state_s == NULL) {
816 if (last_updated != 0) {
824 "sys_from", sys_from,
826 "last_updated", last_updated_s,
828 free(last_updated_s);
835 const char *xml_file = va_arg(args,
const char *);
836 clock_t start = va_arg(args, clock_t);
837 clock_t end = va_arg(args, clock_t);
839 out->list_item(out, NULL,
"Testing %s ... %.2f secs", xml_file,
840 (end - start) / (
float) CLOCKS_PER_SEC);
848 const char *xml_file = va_arg(args,
const char *);
849 clock_t start = va_arg(args, clock_t);
850 clock_t end = va_arg(args, clock_t);
852 char *duration = pcmk__ftoa((end - start) / (
float) CLOCKS_PER_SEC);
856 "duration", duration,
867 const char *dc = va_arg(args,
const char *);
869 return out->info(out,
"Designated Controller is: %s",
870 pcmk__s(dc,
"not yet elected"));
877 if (!out->is_quiet(out)) {
878 return dc(out, args);
880 const char *dc = va_arg(args,
const char *);
895 const char *dc = va_arg(args,
const char *);
898 "node_name", pcmk__s(dc,
""),
904 "const char *",
"bool")
908 const char *
type = va_arg(args,
const char *);
909 const char *
name = va_arg(args,
const char *);
910 const char *
id = va_arg(args,
const char *);
911 bool bash_export = va_arg(args,
int);
914 return out->info(out,
"export %s=%s",
915 pcmk__s(
name,
"<null>"), pcmk__s(
id,
""));
917 return out->info(out,
"%s node: %s (%s)",
type ?
type :
"cluster",
918 pcmk__s(
name,
"<null>"), pcmk__s(
id,
"<null>"));
923 "const char *",
"bool")
927 if (!out->is_quiet(out)) {
928 return crmadmin_node(out, args);
930 const char *
type G_GNUC_UNUSED = va_arg(args,
const char *);
931 const char *
name = va_arg(args,
const char *);
932 const char *
id G_GNUC_UNUSED = va_arg(args,
const char *);
933 bool bash_export G_GNUC_UNUSED = va_arg(args,
int);
941 "const char *",
"bool")
945 const char *
type = va_arg(args,
const char *);
946 const char *
name = va_arg(args,
const char *);
947 const char *
id = va_arg(args,
const char *);
948 bool bash_export G_GNUC_UNUSED = va_arg(args,
int);
952 "name", pcmk__s(
name,
""),
953 "id", pcmk__s(
id,
""),
959 "const char *",
"guint",
"const op_digest_cache_t *")
965 const char *task = va_arg(args,
const char *);
966 guint interval_ms = va_arg(args, guint);
969 char *action_desc = NULL;
970 const char *rsc_desc =
"unknown resource";
971 const char *node_desc =
"unknown node";
973 if (interval_ms != 0) {
975 ((task == NULL)?
"unknown" : task));
977 action_desc = strdup(
"probe action");
980 ((task == NULL)?
"unknown" : task));
982 if ((rsc != NULL) && (rsc->
id != NULL)) {
988 out->begin_list(out, NULL, NULL,
"Digests for %s %s on %s",
989 rsc_desc, action_desc, node_desc);
992 if (digests == NULL) {
993 out->list_item(out, NULL,
"none");
998 out->list_item(out, NULL,
"%s (all parameters)",
1002 out->list_item(out, NULL,
"%s (non-private parameters)",
1006 out->list_item(out, NULL,
"%s (non-reloadable parameters)",
1014 add_digest_xml(xmlNode *
parent,
const char *
type,
const char *digest,
1015 xmlNode *digest_source)
1017 if (digest != NULL) {
1022 if (digest_source != NULL) {
1029 "const char *",
"guint",
"const op_digest_cache_t *")
1035 const char *task = va_arg(args,
const char *);
1036 guint interval_ms = va_arg(args, guint);
1040 xmlNode *xml = NULL;
1043 "resource", pcmk__s(rsc->
id,
""),
1046 "task", pcmk__s(task,
""),
1047 "interval", interval_s,
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 && !pe__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);
1188 if ((stop == NULL) || (stop->
reason == NULL)) {
1193 rc = out->message(out,
"rsc-action-item",
"Stop", rsc, current,
1194 NULL, stop, reason_op);
1197 }
else if (moving && current) {
1200 rc = out->message(out,
"rsc-action-item",
1201 (failed?
"Recover" :
"Move"), rsc, current, next,
1205 rc = out->message(out,
"rsc-action-item",
"Recover", rsc, current,
1210 rc = out->message(out,
"rsc-action-item",
"Restart", rsc, current,
1220 g_list_free(possible_matches);
1230 for (GList *iter = rsc->
running_on; iter != NULL; iter = iter->next) {
1236 if (possible_matches) {
1237 stop_op = possible_matches->data;
1238 g_list_free(possible_matches);
1241 if (stop_op != NULL) {
1245 if (stop_op->
reason != NULL) {
1246 reason_op = stop_op;
1250 if (out->message(out,
"rsc-action-item",
"Stop", rsc, node, NULL,
1258 }
else if ((stop != NULL)
1259 && pcmk_all_flags_set(rsc->
flags,
1262 rc = out->message(out,
"rsc-action-item",
"Recover", rsc, current,
1266 }
else if (moving) {
1267 rc = out->message(out,
"rsc-action-item",
"Move", rsc, current, next,
1272 rc = out->message(out,
"rsc-action-item",
"Reload", rsc, current, next,
1275 }
else if ((stop != NULL)
1277 rc = out->message(out,
"rsc-action-item",
"Restart", rsc, current,
1283 rc = out->message(out,
"rsc-action-item",
"Demote", rsc, current,
1284 next, demote, NULL);
1288 rc = out->message(out,
"rsc-action-item",
"Promote", rsc, current,
1289 next, promote, NULL);
1293 rc = out->message(out,
"rsc-action-item",
"Start", rsc, current, next,
1300 PCMK__OUTPUT_ARGS(
"node-action",
"const char *",
"const char *",
"const char *")
1304 const char *task = va_arg(args,
const char *);
1305 const char *node_name = va_arg(args,
const char *);
1306 const char *reason = va_arg(args,
const char *);
1310 }
else if (reason) {
1311 out->list_item(out, NULL,
"%s %s '%s'", task, node_name, reason);
1319 PCMK__OUTPUT_ARGS(
"node-action",
"const char *",
"const char *",
"const char *")
1323 const char *task = va_arg(args,
const char *);
1324 const char *node_name = va_arg(args,
const char *);
1325 const char *reason = va_arg(args,
const char *);
1329 }
else if (reason) {
1343 "const char *",
"bool",
"bool")
1347 uint32_t node_id = va_arg(args, uint32_t);
1348 const char *node_name = va_arg(args,
const char *);
1349 const char *uuid = va_arg(args,
const char *);
1350 const char *state = va_arg(args,
const char *);
1351 bool have_quorum = (bool) va_arg(args,
int);
1352 bool is_remote = (bool) va_arg(args,
int);
1354 return out->info(out,
1355 "Node %" PRIu32
": %s " 1356 "(uuid=%s, state=%s, have_quorum=%s, is_remote=%s)",
1357 node_id, pcmk__s(node_name,
"unknown"),
1358 pcmk__s(uuid,
"unknown"), pcmk__s(state,
"unknown"),
1359 pcmk__btoa(have_quorum), pcmk__btoa(is_remote));
1363 "const char *",
"bool",
"bool")
1367 uint32_t node_id = va_arg(args, uint32_t);
1368 const char *node_name = va_arg(args,
const char *);
1369 const char *uuid = va_arg(args,
const char *);
1370 const char *state = va_arg(args,
const char *);
1371 bool have_quorum = (bool) va_arg(args,
int);
1372 bool is_remote = (bool) va_arg(args,
int);
1393 const char *node = va_arg(args,
const char *);
1394 const char *task = va_arg(args,
const char *);
1395 xmlNodePtr rsc = va_arg(args, xmlNodePtr);
1397 if (out->is_quiet(out)) {
1402 out->list_item(out, NULL,
"Cluster action: %s for %s on %s",
1403 task,
ID(rsc), node);
1405 out->list_item(out, NULL,
"Cluster action: %s on %s", task, node);
1416 const char *node = va_arg(args,
const char *);
1417 const char *task = va_arg(args,
const char *);
1418 xmlNodePtr rsc = va_arg(args, xmlNodePtr);
1420 xmlNodePtr xml_node = NULL;
1422 if (out->is_quiet(out)) {
1442 const char *
target = va_arg(args,
const char *);
1443 const char *op = va_arg(args,
const char *);
1445 if (out->is_quiet(out)) {
1449 out->list_item(out, NULL,
"Fencing %s (%s)",
target, op);
1457 const char *
target = va_arg(args,
const char *);
1458 const char *op = va_arg(args,
const char *);
1460 if (out->is_quiet(out)) {
1475 const char *
name = va_arg(args,
const char *);
1476 const char *value = va_arg(args,
const char *);
1477 xmlNodePtr cib_node = va_arg(args, xmlNodePtr);
1479 xmlChar *node_path = NULL;
1481 if (out->is_quiet(out)) {
1485 node_path = xmlGetNodePath(cib_node);
1487 out->list_item(out, NULL,
"Injecting attribute %s=%s into %s '%s'",
1488 name, value, node_path,
ID(cib_node));
1498 const char *
name = va_arg(args,
const char *);
1499 const char *value = va_arg(args,
const char *);
1500 xmlNodePtr cib_node = va_arg(args, xmlNodePtr);
1502 xmlChar *node_path = NULL;
1504 if (out->is_quiet(out)) {
1508 node_path = xmlGetNodePath(cib_node);
1513 "node_path", node_path,
1514 "cib_node",
ID(cib_node),
1524 const char *spec = va_arg(args,
const char *);
1526 if (out->is_quiet(out)) {
1530 out->list_item(out, NULL,
"Injecting %s into the configuration", spec);
1538 const char *spec = va_arg(args,
const char *);
1540 if (out->is_quiet(out)) {
1554 const char *quorum = va_arg(args,
const char *);
1555 const char *watchdog = va_arg(args,
const char *);
1557 if (out->is_quiet(out)) {
1561 out->begin_list(out, NULL, NULL,
"Performing Requested Modifications");
1564 out->list_item(out, NULL,
"Setting quorum: %s", quorum);
1568 out->list_item(out, NULL,
"Setting watchdog: %s", watchdog);
1578 const char *quorum = va_arg(args,
const char *);
1579 const char *watchdog = va_arg(args,
const char *);
1581 xmlNodePtr node = NULL;
1583 if (out->is_quiet(out)) {
1604 const char *
action = va_arg(args,
const char *);
1605 const char *node = va_arg(args,
const char *);
1607 if (out->is_quiet(out)) {
1612 out->list_item(out, NULL,
"Bringing node %s online", node);
1615 out->list_item(out, NULL,
"Taking node %s offline", node);
1618 out->list_item(out, NULL,
"Failing node %s", node);
1629 const char *
action = va_arg(args,
const char *);
1630 const char *node = va_arg(args,
const char *);
1632 if (out->is_quiet(out)) {
1647 const char *
action = va_arg(args,
const char *);
1648 const char *ticket = va_arg(args,
const char *);
1650 if (out->is_quiet(out)) {
1655 out->list_item(out, NULL,
"Making ticket %s standby", ticket);
1657 out->list_item(out, NULL,
"%s ticket %s",
action, ticket);
1667 const char *
action = va_arg(args,
const char *);
1668 const char *ticket = va_arg(args,
const char *);
1670 if (out->is_quiet(out)) {
1685 const char *node = va_arg(args,
const char *);
1686 const char *task = va_arg(args,
const char *);
1688 if (out->is_quiet(out)) {
1692 out->list_item(out, NULL,
"Pseudo action: %s%s%s",
1693 task, ((node == NULL)?
"" :
" on "), pcmk__s(node,
""));
1701 const char *node = va_arg(args,
const char *);
1702 const char *task = va_arg(args,
const char *);
1704 xmlNodePtr xml_node = NULL;
1706 if (out->is_quiet(out)) {
1721 "const char *",
"guint")
1725 const char *rsc = va_arg(args,
const char *);
1726 const char *operation = va_arg(args,
const char *);
1727 const char *node = va_arg(args,
const char *);
1728 guint interval_ms = va_arg(args, guint);
1730 if (out->is_quiet(out)) {
1735 out->list_item(out, NULL,
"Resource action: %-15s %s=%u on %s",
1736 rsc, operation, interval_ms, node);
1738 out->list_item(out, NULL,
"Resource action: %-15s %s on %s",
1739 rsc, operation, node);
1746 "const char *",
"guint")
1750 const char *rsc = va_arg(args,
const char *);
1751 const char *operation = va_arg(args,
const char *);
1752 const char *node = va_arg(args,
const char *);
1753 guint interval_ms = va_arg(args, guint);
1755 xmlNodePtr xml_node = NULL;
1757 if (out->is_quiet(out)) {
1768 char *interval_s = pcmk__itoa(interval_ms);
1777 #define CHECK_RC(retcode, retval) \ 1778 if (retval == pcmk_rc_ok) { \ 1779 retcode = pcmk_rc_ok; \ 1783 "enum pcmk_pacemakerd_state",
"crm_exit_t",
1784 "stonith_history_t *",
"enum pcmk__fence_history",
"uint32_t",
1785 "uint32_t",
"const char *",
"GList *",
"GList *")
1795 uint32_t section_opts = va_arg(args, uint32_t);
1796 uint32_t show_opts = va_arg(args, uint32_t);
1797 const char *prefix = va_arg(args,
const char *);
1798 GList *unames = va_arg(args, GList *);
1799 GList *resources = va_arg(args, GList *);
1802 bool already_printed_failure =
false;
1805 section_opts, show_opts));
1828 if (pcmk_any_flags_set(section_opts,
1831 resources, section_opts, show_opts,
1847 if (history_rc == 0) {
1854 CHECK_RC(rc, out->message(out,
"failed-fencing-list",
1855 stonith_history, unames, section_opts,
1860 out->begin_list(out, NULL, NULL,
"Failed Fencing Actions");
1861 out->list_item(out, NULL,
"Failed to get fencing history: %s",
1865 already_printed_failure =
true;
1884 if (history_rc != 0) {
1885 if (!already_printed_failure) {
1887 out->begin_list(out, NULL, NULL,
"Failed Fencing Actions");
1888 out->list_item(out, NULL,
"Failed to get fencing history: %s",
1899 CHECK_RC(rc, out->message(out,
"fencing-list", hp, unames,
1900 section_opts, show_opts,
1910 CHECK_RC(rc, out->message(out,
"pending-fencing-list", hp,
1911 unames, section_opts, show_opts,
1921 "enum pcmk_pacemakerd_state",
"crm_exit_t",
1922 "stonith_history_t *",
"enum pcmk__fence_history",
"uint32_t",
1923 "uint32_t",
"const char *",
"GList *",
"GList *")
1933 uint32_t section_opts = va_arg(args, uint32_t);
1934 uint32_t show_opts = va_arg(args, uint32_t);
1935 const char *prefix = va_arg(args,
const char *);
1936 GList *unames = va_arg(args, GList *);
1937 GList *resources = va_arg(args, GList *);
1939 out->message(out,
"cluster-summary",
scheduler, pcmkd_state, section_opts,
1944 out->message(out,
"node-list",
scheduler->
nodes, unames, resources,
1953 out->message(out,
"resource-list",
scheduler, full_show_opts,
1954 false, unames, resources,
false);
1959 out->message(out,
"node-attribute-list",
scheduler, show_opts,
false,
1966 if (pcmk_any_flags_set(section_opts,
1968 out->message(out,
"node-summary",
scheduler, unames,
1969 resources, section_opts, show_opts,
false);
1977 out->message(out,
"failed-action-list",
scheduler, unames, resources,
1984 out->message(out,
"full-fencing-list", history_rc, stonith_history,
1985 unames, section_opts, show_opts,
false);
1990 out->message(out,
"ticket-list",
scheduler,
false);
1995 out->message(out,
"ban-list",
scheduler, prefix, resources, show_opts,
2003 "enum pcmk_pacemakerd_state",
"crm_exit_t",
2004 "stonith_history_t *",
"enum pcmk__fence_history",
"uint32_t",
2005 "uint32_t",
"const char *",
"GList *",
"GList *")
2015 uint32_t section_opts = va_arg(args, uint32_t);
2016 uint32_t show_opts = va_arg(args, uint32_t);
2017 const char *prefix = va_arg(args,
const char *);
2018 GList *unames = va_arg(args, GList *);
2019 GList *resources = va_arg(args, GList *);
2020 bool already_printed_failure =
false;
2022 out->message(out,
"cluster-summary",
scheduler, pcmkd_state, section_opts,
2027 out->message(out,
"node-list",
scheduler->
nodes, unames, resources,
2033 out->message(out,
"resource-list",
scheduler, show_opts,
true, unames,
2039 out->message(out,
"node-attribute-list",
scheduler, show_opts,
false,
2046 if (pcmk_any_flags_set(section_opts,
2048 out->message(out,
"node-summary",
scheduler, unames,
2049 resources, section_opts, show_opts,
false);
2057 out->message(out,
"failed-action-list",
scheduler, unames, resources,
2064 if (history_rc == 0) {
2071 out->message(out,
"failed-fencing-list", stonith_history,
2072 unames, section_opts, show_opts,
false);
2075 out->begin_list(out, NULL, NULL,
"Failed Fencing Actions");
2076 out->list_item(out, NULL,
"Failed to get fencing history: %s",
2085 if (history_rc != 0) {
2086 if (!already_printed_failure) {
2087 out->begin_list(out, NULL, NULL,
"Failed Fencing Actions");
2088 out->list_item(out, NULL,
"Failed to get fencing history: %s",
2099 out->message(out,
"fencing-list", hp, unames, section_opts,
2109 out->message(out,
"pending-fencing-list", hp, unames,
2110 section_opts, show_opts,
false);
2117 out->message(out,
"ticket-list",
scheduler,
false);
2122 out->message(out,
"ban-list",
scheduler, prefix, resources, show_opts,
2130 "const char *",
"const char *")
2134 const char *scope = va_arg(args,
const char *);
2135 const char *instance = va_arg(args,
const char *);
2136 const char *
name = va_arg(args,
const char *);
2137 const char *value = va_arg(args,
const char *);
2138 const char *
host = va_arg(args,
const char *);
2140 GString *s = g_string_sized_new(50);
2142 if (!pcmk__str_empty(scope)) {
2146 if (!pcmk__str_empty(instance)) {
2152 if (!pcmk__str_empty(
host)) {
2158 out->info(out,
"%s", s->str);
2159 g_string_free(s, TRUE);
2165 "const char *",
"const char *")
2169 const char *scope = va_arg(args,
const char *);
2170 const char *instance = va_arg(args,
const char *);
2171 const char *
name = va_arg(args,
const char *);
2172 const char *value = va_arg(args,
const char *);
2173 const char *
host = va_arg(args,
const char *);
2175 xmlNodePtr node = NULL;
2179 "value", value ? value :
"",
2182 if (!pcmk__str_empty(scope)) {
2186 if (!pcmk__str_empty(instance)) {
2190 if (!pcmk__str_empty(
host)) {
2201 const char *rule_id = va_arg(args,
const char *);
2202 int result = va_arg(args,
int);
2203 const char *error = va_arg(args,
const char *);
2207 return out->info(out,
"Rule %s is still in effect", rule_id);
2209 return out->info(out,
"Rule %s satisfies conditions", rule_id);
2211 return out->info(out,
"Rule %s is expired", rule_id);
2213 return out->info(out,
"Rule %s has not yet taken effect", rule_id);
2215 return out->info(out,
"Rule %s does not satisfy conditions",
2219 "Could not determine whether rule %s is in effect: %s",
2220 rule_id, ((error != NULL)? error :
"unexpected error"));
2229 const char *rule_id = va_arg(args,
const char *);
2230 int result = va_arg(args,
int);
2231 const char *error = va_arg(args,
const char *);
2250 "Could not determine whether rule %s is in effect: %s",
2251 rule_id, ((error != NULL)? error :
"unexpected error"));
2267 int code = va_arg(args,
int);
2268 const char *
name = va_arg(args,
const char *);
2269 const char *desc = va_arg(args,
const char *);
2271 static int code_width = 0;
2273 if (out->is_quiet(out)) {
2278 if ((
name != NULL) && (desc != NULL)) {
2281 }
else if ((
name != NULL) || (desc != NULL)) {
2291 if (code_width == 0) {
2293 code_width = (int) snprintf(NULL, 0,
"%lld", most_negative);
2296 if ((
name != NULL) && (desc != NULL)) {
2297 static int name_width = 0;
2299 if (name_width == 0) {
2303 name_width = QB_MAX(name_width, len);
2306 return out->info(out,
"% *d: %-*s %s", code_width, code, name_width,
2310 if ((
name != NULL) || (desc != NULL)) {
2311 return out->info(out,
"% *d: %s", code_width, code,
2315 return out->info(out,
"% *d", code_width, code);
2322 int code = va_arg(args,
int);
2323 const char *
name = va_arg(args,
const char *);
2324 const char *desc = va_arg(args,
const char *);
2326 char *code_str = pcmk__itoa(code);
2338 {
"attribute",
"default", attribute_default },
2339 {
"attribute",
"xml", attribute_xml },
2341 {
"cluster-status",
"html", cluster_status_html },
2342 {
"cluster-status",
"xml", cluster_status_xml },
2343 {
"crmadmin-node",
"default", crmadmin_node },
2344 {
"crmadmin-node",
"text", crmadmin_node_text },
2345 {
"crmadmin-node",
"xml", crmadmin_node_xml },
2346 {
"dc",
"default", dc },
2347 {
"dc",
"text", dc_text },
2348 {
"dc",
"xml", dc_xml },
2349 {
"digests",
"default", digests_text },
2350 {
"digests",
"xml", digests_xml },
2351 {
"health",
"default", health },
2352 {
"health",
"text", health_text },
2353 {
"health",
"xml", health_xml },
2354 {
"inject-attr",
"default", inject_attr },
2355 {
"inject-attr",
"xml", inject_attr_xml },
2356 {
"inject-cluster-action",
"default", inject_cluster_action },
2357 {
"inject-cluster-action",
"xml", inject_cluster_action_xml },
2358 {
"inject-fencing-action",
"default", inject_fencing_action },
2359 {
"inject-fencing-action",
"xml", inject_fencing_action_xml },
2360 {
"inject-modify-config",
"default", inject_modify_config },
2361 {
"inject-modify-config",
"xml", inject_modify_config_xml },
2362 {
"inject-modify-node",
"default", inject_modify_node },
2363 {
"inject-modify-node",
"xml", inject_modify_node_xml },
2364 {
"inject-modify-ticket",
"default", inject_modify_ticket },
2365 {
"inject-modify-ticket",
"xml", inject_modify_ticket_xml },
2366 {
"inject-pseudo-action",
"default", inject_pseudo_action },
2367 {
"inject-pseudo-action",
"xml", inject_pseudo_action_xml },
2368 {
"inject-rsc-action",
"default", inject_rsc_action },
2369 {
"inject-rsc-action",
"xml", inject_rsc_action_xml },
2370 {
"inject-spec",
"default", inject_spec },
2371 {
"inject-spec",
"xml", inject_spec_xml },
2372 {
"locations-list",
"default", locations_list },
2373 {
"locations-list",
"xml", locations_list_xml },
2374 {
"node-action",
"default", node_action },
2375 {
"node-action",
"xml", node_action_xml },
2376 {
"node-info",
"default", node_info_default },
2377 {
"node-info",
"xml", node_info_xml },
2378 {
"pacemakerd-health",
"default", pacemakerd_health },
2379 {
"pacemakerd-health",
"html", pacemakerd_health_html },
2380 {
"pacemakerd-health",
"text", pacemakerd_health_text },
2381 {
"pacemakerd-health",
"xml", pacemakerd_health_xml },
2382 {
"profile",
"default", profile_default, },
2383 {
"profile",
"xml", profile_xml },
2384 {
"result-code",
"none", result_code_none },
2385 {
"result-code",
"text", result_code_text },
2386 {
"result-code",
"xml", result_code_xml },
2387 {
"rsc-action",
"default", rsc_action_default },
2388 {
"rsc-action-item",
"default", rsc_action_item },
2389 {
"rsc-action-item",
"xml", rsc_action_item_xml },
2390 {
"rsc-is-colocated-with-list",
"default", rsc_is_colocated_with_list },
2391 {
"rsc-is-colocated-with-list",
"xml", rsc_is_colocated_with_list_xml },
2392 {
"rscs-colocated-with-list",
"default", rscs_colocated_with_list },
2393 {
"rscs-colocated-with-list",
"xml", rscs_colocated_with_list_xml },
2394 {
"rule-check",
"default", rule_check_default },
2395 {
"rule-check",
"xml", rule_check_xml },
2396 {
"locations-and-colocations",
"default", locations_and_colocations },
2397 {
"locations-and-colocations",
"xml", locations_and_colocations_xml },
2399 { NULL, NULL, NULL }
#define CRM_CHECK(expr, failure_action)
#define crm_notice(fmt, args...)
xmlNode * failed
History entries of failed actions.
pcmk_scheduler_t * cluster
Cluster that resource is part of.
stonith_history_t * stonith__first_matching_event(stonith_history_t *history, bool(*matching_fn)(stonith_history_t *, void *), void *user_data)
Whether action should not be executed.
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_resource_t * uber_parent(pcmk_resource_t *rsc)
pcmk__fence_history
Control how much of the fencing history is output.
enum rsc_role_e role
Resource's current role.
enum rsc_role_e next_role
Resource's scheduled next role.
Implementation of pcmk_action_t.
#define PCMK_ACTION_MONITOR
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)
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
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)
Implementation of pcmk_scheduler_t.
void pcmk__register_lib_messages(pcmk__output_t *out)
char * reason
Readable description of why action is needed.
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
GList * nodes
Nodes in cluster.
#define PCMK__OUTPUT_SPACER_IF(out_obj, cond)
const char * role2text(enum rsc_role_e role)
void pe__clear_resource_flags_on_all(pcmk_scheduler_t *scheduler, uint64_t flag)
#define PCMK_ACTION_DEMOTE
int weight
Node score for a given resource.
const char * crm_exit_str(crm_exit_t exit_code)
Implementation of pcmk_resource_t.
void pcmk__unpack_constraints(pcmk_scheduler_t *scheduler)
#define XML_CONS_TAG_RSC_LOCATION
Whether resource is considered failed.
Whether resource must be stopped (instead of demoted) if it is failed.
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
Whether resource is multiply active with recovery set to stop_unexpected.
#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
Basic node information.
#define PCMK_ACTION_START
#define XML_ATTR_HAVE_QUORUM
unsigned long long flags
Group of enum pcmk_rsc_flags.
const char * uname
Node name in cluster.
PCMK__OUTPUT_ARGS("rsc-action-item", "const char *", "pcmk_resource_t *", "pcmk_node_t *", "pcmk_node_t *", "pcmk_action_t *", "pcmk_action_t *")
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 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
Flag for non-scheduler code to use to detect recursion loops.
Implementation of pcmk_node_t.
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__OUTPUT_LIST_HEADER(out_obj, cond, retcode, title...)
pcmk__action_result_t result
Whether action is runnable.
const char * pcmk_rc_name(int rc)
Get a return code constant name as a string.
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_ACTION_PROMOTE
pcmk_resource_t * dependent
const char * pcmk__pcmkd_state_enum2friendly(enum pcmk_pacemakerd_state state)
GList * running_on
Nodes where resource may be active.
enum pe_action_flags flags
Group of enum pe_action_flags.
Whether a reload action has been scheduled for resource.
const char * node_attribute
Resource role is unknown.
Whether resource is managed.
bool stonith__event_state_eq(stonith_history_t *history, void *user_data)
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...)
char * id
Resource ID in configuration.