26 time_t_string(time_t when) {
49 switch (history->
state) {
51 case st_done:
return "successful";
52 default:
return "pending";
75 const char *later_succeeded, uint32_t show_opts)
77 GString *str = g_string_sized_new(256);
78 char *completed_time = NULL;
81 completed_time = time_t_string(history->
completed);
98 g_string_append(str,
" last");
102 pcmk__add_word(&str, 0, state_str(history));
111 g_string_append(str,
": ");
122 "client=", history->
client,
", origin=", history->
origin,
126 if (completed_time != NULL) {
128 g_string_append(str,
", completed");
130 g_string_append(str,
", last-failed");
132 g_string_append(str,
", last-successful");
137 if (completed_time != NULL) {
144 " (a later attempt from ", later_succeeded,
145 " succeeded)", NULL);
148 free(completed_time);
149 return g_string_free(str, FALSE);
153 "uint32_t",
"uint32_t",
"bool")
158 GList *only_node = va_arg(args, GList *);
159 uint32_t section_opts = va_arg(args, uint32_t);
160 uint32_t show_opts = va_arg(args, uint32_t);
161 bool print_spacer = va_arg(args,
int);
175 out->message(out,
"stonith-event", hp,
178 out->increment_list(out);
191 GList *only_node = va_arg(args, GList *);
192 uint32_t section_opts = va_arg(args, uint32_t);
193 uint32_t show_opts = va_arg(args, uint32_t);
194 bool print_spacer = va_arg(args,
int);
205 out->message(out,
"stonith-event", hp,
206 pcmk_all_flags_set(section_opts,
209 out->increment_list(out);
218 "GList *",
"uint32_t",
"uint32_t",
"bool")
224 GList *only_node = va_arg(args, GList *);
225 uint32_t section_opts = va_arg(args, uint32_t);
226 uint32_t show_opts = va_arg(args, uint32_t);
227 bool print_spacer = va_arg(args,
int);
237 out->message(out,
"stonith-event", hp,
240 out->increment_list(out);
248 "GList *",
"uint32_t",
"uint32_t",
"bool")
254 GList *only_node = va_arg(args, GList *);
255 uint32_t section_opts = va_arg(args, uint32_t);
256 uint32_t show_opts = va_arg(args, uint32_t);
257 bool print_spacer G_GNUC_UNUSED = va_arg(args,
int);
261 if (history_rc == 0) {
268 out->message(out,
"stonith-event", hp,
269 pcmk_all_flags_set(section_opts,
272 out->increment_list(out);
277 char *rc_s = pcmk__itoa(history_rc);
293 const char *
target = va_arg(args,
const char *);
294 time_t when = va_arg(args, time_t);
309 const char *
target = va_arg(args,
const char *);
310 time_t when = va_arg(args, time_t);
324 const char *
target = va_arg(args,
const char *);
325 time_t when = va_arg(args, time_t);
328 char *buf = time_t_string(when);
343 "uint32_t",
"uint32_t",
"bool")
348 GList *only_node = va_arg(args, GList *);
349 uint32_t section_opts = va_arg(args, uint32_t);
350 uint32_t show_opts = va_arg(args, uint32_t);
351 bool print_spacer = va_arg(args,
int);
366 out->message(out,
"stonith-event", hp,
369 out->increment_list(out);
377 "const char *",
"uint32_t")
382 bool full_history = va_arg(args,
int);
383 bool completed_only G_GNUC_UNUSED = va_arg(args,
int);
384 const char *succeeded = va_arg(args,
const char *);
385 uint32_t show_opts = va_arg(args, uint32_t);
390 switch(event->state) {
392 out->list_item(out,
"successful-stonith-event",
"%s", desc);
396 out->list_item(out,
"failed-stonith-event",
"%s", desc);
400 out->list_item(out,
"pending-stonith-event",
"%s", desc);
408 "const char *",
"uint32_t")
413 bool full_history = va_arg(args,
int);
414 bool completed_only = va_arg(args,
int);
415 const char *succeeded = va_arg(args,
const char *);
416 uint32_t show_opts = va_arg(args, uint32_t);
418 if (completed_only) {
432 "const char *",
"uint32_t")
437 bool full_history G_GNUC_UNUSED = va_arg(args,
int);
438 bool completed_only G_GNUC_UNUSED = va_arg(args,
int);
439 const char *succeeded G_GNUC_UNUSED = va_arg(args,
const char *);
440 uint32_t show_opts G_GNUC_UNUSED = va_arg(args, uint32_t);
445 "action", event->action,
446 "target", event->target,
447 "client", event->client,
448 "origin", event->origin,
451 switch (event->state) {
463 char *state = pcmk__itoa(event->state);
465 "extended-status", state,
472 if (event->delegate != NULL) {
477 buf = time_t_string(event->completed);
485 PCMK__OUTPUT_ARGS(
"validate",
"const char *",
"const char *",
"char *",
"char *",
"int")
488 const char *agent = va_arg(args,
const char *);
489 const char *device = va_arg(args,
const char *);
490 char *output = va_arg(args,
char *);
491 char *error_output = va_arg(args,
char *);
492 int rc = va_arg(args,
int);
496 rc ?
"failed" :
"succeeded");
501 rc ?
"failed" :
"succeeded");
506 out->subprocess_output(out, rc, output, error_output);
510 PCMK__OUTPUT_ARGS(
"validate",
"const char *",
"const char *",
"char *",
"char *",
"int")
513 const char *agent = va_arg(args,
const char *);
514 const char *device = va_arg(args,
const char *);
515 char *output = va_arg(args,
char *);
516 char *error_output = va_arg(args,
char *);
517 int rc = va_arg(args,
int);
521 rc ?
"failed" :
"succeeded");
524 rc ?
"failed" :
"succeeded");
527 out->subprocess_output(out, rc, output, error_output);
531 PCMK__OUTPUT_ARGS(
"validate",
"const char *",
"const char *",
"char *",
"char *",
"int")
534 const char *agent = va_arg(args,
const char *);
535 const char *device = va_arg(args,
const char *);
536 char *output = va_arg(args,
char *);
537 char *error_output = va_arg(args,
char *);
538 int rc = va_arg(args,
int);
541 out,
"validate",
"agent", agent,
"valid", pcmk__btoa(rc ==
pcmk_ok),
544 if (device != NULL) {
549 out->subprocess_output(out, rc, output, error_output);
556 {
"failed-fencing-list",
"default", failed_history },
557 {
"fencing-list",
"default", stonith_history },
558 {
"full-fencing-list",
"default", full_history },
559 {
"full-fencing-list",
"xml", full_history_xml },
560 {
"last-fenced",
"html", last_fenced_html },
561 {
"last-fenced",
"log", last_fenced_text },
562 {
"last-fenced",
"text", last_fenced_text },
563 {
"last-fenced",
"xml", last_fenced_xml },
564 {
"pending-fencing-list",
"default", pending_actions },
565 {
"stonith-event",
"html", stonith_event_html },
566 {
"stonith-event",
"log", stonith_event_text },
567 {
"stonith-event",
"text", stonith_event_text },
568 {
"stonith-event",
"xml", stonith_event_xml },
569 {
"validate",
"html", validate_agent_html },
570 {
"validate",
"log", validate_agent_text },
571 {
"validate",
"text", validate_agent_text },
572 {
"validate",
"xml", validate_agent_xml },
void pcmk__output_xml_push_parent(pcmk__output_t *out, xmlNodePtr parent)
struct stonith_history_s * next
Control output from tools.
void pcmk__register_messages(pcmk__output_t *out, const pcmk__message_entry_t *table)
#define crm_time_log_timeofday
struct crm_time_s crm_time_t
const char * stonith__later_succeeded(stonith_history_t *event, stonith_history_t *top_history)
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value.
enum crm_exit_e crm_exit_t
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 void void pcmk__formatted_printf(pcmk__output_t *out, const char *format,...) G_GNUC_PRINTF(2
char * crm_time_as_string(const crm_time_t *dt, int flags)
Formatted output for pacemaker tools.
void crm_time_set_timet(crm_time_t *target, const time_t *source)
const char * stonith_action_str(const char *action)
Turn fence action into a more readable string.
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.
void stonith__register_messages(pcmk__output_t *out)
Wrappers for and extensions to libxml2.
gchar * stonith__history_description(stonith_history_t *history, bool full_history, const char *later_succeeded, uint32_t show_opts)
void pcmk__indented_printf(pcmk__output_t *out, const char *format,...) G_GNUC_PRINTF(2
xmlNodePtr pcmk__output_create_xml_node(pcmk__output_t *out, const char *name,...) G_GNUC_NULL_TERMINATED
#define XML_LRM_ATTR_EXIT_REASON
#define pcmk_section_fencing_all
#define crm_time_log_with_timezone
void pcmk__output_xml_pop_parent(pcmk__output_t *out)
void pcmk__xe_set_props(xmlNodePtr node,...) G_GNUC_NULL_TERMINATED
#define PCMK__OUTPUT_LIST_FOOTER(out_obj, retcode)
#define PCMK__OUTPUT_LIST_HEADER(out_obj, cond, retcode, title...)
crm_time_t * crm_time_new(const char *string)
PCMK__OUTPUT_ARGS("failed-fencing-list", "stonith_history_t *", "GList *", "uint32_t", "uint32_t", "bool")
This structure contains everything that makes up a single output formatter.
#define crm_time_log_date
gboolean pcmk__str_in_list(const gchar *s, const GList *lst, uint32_t flags)
void crm_time_free(crm_time_t *dt)