75 uint32_t show, uint32_t show_opts,
76 const char *only_node,
const char *only_rsc,
77 const char *neg_location_prefix,
bool simple_output)
79 xmlNode *cib_copy =
copy_xml(current_cib);
84 GList *resources = NULL;
136 out->
message(out,
"cluster-status",
138 stonith_history, fence_history, show, show_opts,
139 neg_location_prefix, unames, resources);
142 g_list_free_full(unames, free);
143 g_list_free_full(resources, free);
146 stonith_history = NULL;
177 show_opts, NULL, NULL, NULL,
false, 0);
222 uint32_t show_opts,
const char *only_node,
const char *only_rsc,
223 const char *neg_location_prefix,
bool simple_output,
224 unsigned int timeout_ms)
226 xmlNode *current_cib = NULL;
230 time_t last_updated = 0;
243 last_updated = time(NULL);
245 switch (pcmkd_state) {
255 out->
message(out,
"pacemakerd-health",
256 NULL, pcmkd_state, NULL, last_updated);
261 stonith = fencing_connect();
269 out->
message(out,
"pacemakerd-health",
270 NULL, pcmkd_state, NULL, last_updated);
276 pcmkd_state, fence_history, show,
277 show_opts, only_node, only_rsc,
278 neg_location_prefix, simple_output);
280 out->
err(out,
"Error outputting status info from the fencer or CIB");
296 int nodes_online = 0;
297 int nodes_standby = 0;
298 int nodes_maintenance = 0;
299 GString *offline_nodes = NULL;
301 bool offline =
false;
302 bool has_warnings =
false;
309 for (GList *iter =
data_set->
nodes; iter != NULL; iter = iter->next) {
319 pcmk__add_word(&offline_nodes, 1024,
"offline node:");
320 pcmk__add_word(&offline_nodes, 0, pe__node_name(node));
327 out->
info(out,
"CLUSTER WARN: %s%s%s",
328 no_dc ?
"No DC" :
"",
329 no_dc && offline ?
", " :
"",
330 (offline? (
const char *) offline_nodes->str :
""));
332 if (offline_nodes != NULL) {
333 g_string_free(offline_nodes, TRUE);
337 char *nodes_standby_s = NULL;
338 char *nodes_maint_s = NULL;
340 if (nodes_standby > 0) {
345 if (nodes_maintenance > 0) {
351 out->
info(out,
"CLUSTER OK: %d node%s online%s%s, " 352 "%d resource instance%s configured",
354 nodes_standby_s != NULL ? nodes_standby_s :
"",
355 nodes_maint_s != NULL ? nodes_maint_s :
"",
358 free(nodes_standby_s);
int pcmk__status(pcmk__output_t *out, cib_t *cib, enum pcmk__fence_history fence_history, uint32_t show, uint32_t show_opts, const char *only_node, const char *only_rsc, const char *neg_location_prefix, bool simple_output, unsigned int timeout_ms)
Control output from tools.
void stonith__register_messages(pcmk__output_t *out)
cib_t * cib_new(void)
Create a new CIB connection object.
int cib__signon_query(pcmk__output_t *out, cib_t **cib, xmlNode **cib_object)
int(* message)(pcmk__output_t *out, const char *message_id,...)
GList * pe__build_rsc_list(pe_working_set_t *data_set, const char *s)
pcmk__fence_history
Control how much of the fencing history is output.
void pe_free_working_set(pe_working_set_t *data_set)
Free a working set.
pe_working_set_t * pe_new_working_set(void)
Create a new working set.
#define pe_flag_no_compat
crm_exit_t pcmk_rc2exitc(int rc)
Map a function return code to the most similar exit code.
int pcmk__pacemakerd_status(pcmk__output_t *out, const char *ipc_name, unsigned int message_timeout_ms, bool show_output, enum pcmk_pacemakerd_state *state)
int(* info)(pcmk__output_t *out, const char *format,...) G_GNUC_PRINTF(2
const char * pcmk_rc_str(int rc)
Get a user-friendly description of a return code.
void cib_delete(cib_t *cib)
Free all memory used by CIB connection.
stonith_t * stonith_api_new(void)
xmlNode * copy_xml(xmlNode *src_node)
int pcmk__output_cluster_status(pcmk__output_t *out, stonith_t *stonith, cib_t *cib, xmlNode *current_cib, enum pcmk_pacemakerd_state pcmkd_state, enum pcmk__fence_history fence_history, uint32_t show, uint32_t show_opts, const char *only_node, const char *only_rsc, const char *neg_location_prefix, bool simple_output)
int pcmk__xml_output_new(pcmk__output_t **out, xmlNodePtr *xml)
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
int(*) int(*) void(* err)(pcmk__output_t *out, const char *format,...) G_GNUC_PRINTF(2
void pcmk__register_lib_messages(pcmk__output_t *out)
pe_working_set_t * data_set
void pcmk__unpack_constraints(pe_working_set_t *data_set)
int pcmk__output_simple_status(pcmk__output_t *out, const pe_working_set_t *data_set)
void pe__register_messages(pcmk__output_t *out)
void free_xml(xmlNode *child)
int(* connect)(stonith_t *st, const char *name, int *stonith_fd)
Connect to the local fencer.
int cib__clean_up_connection(cib_t **cib)
Function and executable result codes.
GList * pe__build_node_name_list(pe_working_set_t *data_set, const char *s)
void stonith_api_delete(stonith_t *st)
char * pcmk__our_nodename
Node name of the local node.
stonith_api_operations_t * cmds
gboolean cluster_status(pe_working_set_t *data_set)
void stonith_history_free(stonith_history_t *history)
This structure contains everything that makes up a single output formatter.
int pcmk__get_fencing_history(stonith_t *st, stonith_history_t **stonith_history, enum pcmk__fence_history fence_history)
Fetch fencing history, optionally reducing it.
#define pe__set_working_set_flags(working_set, flags_to_set)
#define pcmk__plural_s(i)
void pcmk__xml_output_finish(pcmk__output_t *out, xmlNodePtr *xml)
int pcmk_status(xmlNodePtr *xml)
Output cluster status formatted like crm_mon --output-as=xml
gboolean cli_config_update(xmlNode **xml, int *best_version, gboolean to_logs)