42 out->
err(out,
"Could not connect to the CIB: %s",
47 rc = cib->
cmds->
query(cib, NULL, current_cib,
76 void *event_data,
void *user_data)
90 reply->
data.
ping.last_good != (time_t) 0 &&
104 if (pacemakerd_api == NULL) {
105 out->
err(out,
"Could not connect to pacemakerd: %s",
116 out->
err(out,
"Could not connect to pacemakerd: %s",
141 uint32_t show, uint32_t show_opts,
char *only_node,
142 char *only_rsc,
char *neg_location_prefix,
bool simple_output)
144 xmlNode *cib_copy =
copy_xml(current_cib);
148 GList *unames = NULL;
149 GList *resources = NULL;
192 stonith_history, fence_history, show, show_opts,
193 neg_location_prefix, unames, resources);
196 g_list_free_full(unames, free);
197 g_list_free_full(resources, free);
200 stonith_history = NULL;
231 show_opts, NULL, NULL, NULL,
false);
240 uint32_t show, uint32_t show_opts,
char *only_node,
char *only_rsc,
241 char *neg_location_prefix,
bool simple_output)
243 xmlNode *current_cib = NULL;
255 rc = pacemakerd_status(out);
264 st = fencing_connect();
271 rc = cib_connect(out, cib, ¤t_cib);
277 only_node, only_rsc, neg_location_prefix, simple_output);
298 int nodes_online = 0;
299 int nodes_standby = 0;
300 int nodes_maintenance = 0;
301 char *offline_nodes = NULL;
302 size_t offline_nodes_len = 0;
304 bool offline =
false;
305 bool has_warnings =
false;
312 for (GList *iter =
data_set->
nodes; iter != NULL; iter = iter->next) {
324 pcmk__add_word(&offline_nodes, &offline_nodes_len, s);
332 out->
info(out,
"CLUSTER WARN: %s%s%s",
333 no_dc ?
"No DC" :
"",
334 no_dc && offline ?
", " :
"",
335 (offline? offline_nodes :
""));
338 char *nodes_standby_s = NULL;
339 char *nodes_maint_s = NULL;
341 if (nodes_standby > 0) {
346 if (nodes_maintenance > 0) {
352 out->
info(out,
"CLUSTER OK: %d node%s online%s%s, " 353 "%d resource instance%s configured",
355 nodes_standby_s != NULL ? nodes_standby_s :
"",
356 nodes_maint_s != NULL ? nodes_maint_s :
"",
359 free(nodes_standby_s);
#define CRM_CHECK(expr, failure_action)
Control output from tools.
void stonith__register_messages(pcmk__output_t *out)
int pcmk_connect_ipc(pcmk_ipc_api_t *api, enum pcmk_ipc_dispatch dispatch_type)
Connect to a Pacemaker daemon via IPC.
int pcmk__status(pcmk__output_t *out, cib_t *cib, enum pcmk__fence_history fence_history, uint32_t show, uint32_t show_opts, char *only_node, char *only_rsc, char *neg_location_prefix, bool simple_output)
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.
int pcmk_new_ipc_api(pcmk_ipc_api_t **api, enum pcmk_ipc_server server)
Create a new object for using Pacemaker daemon IPC.
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.
struct pcmk_pacemakerd_api_reply_t::@4::@5 ping
enum crm_exit_e crm_exit_t
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)
int pcmk__out_prologue(pcmk__output_t **out, xmlNodePtr *xml)
xmlNode * copy_xml(xmlNode *src_node)
void pe_reset_working_set(pe_working_set_t *data_set)
Reset a working set to default state without freeing it.
enum pcmk_pacemakerd_api_reply reply_type
union pcmk_pacemakerd_api_reply_t::@4 data
cib_api_operations_t * cmds
int(* signon)(cib_t *cib, const char *name, enum cib_conn_type type)
#define crm_trace(fmt, args...)
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(*) 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(* query)(cib_t *cib, const char *section, xmlNode **output_data, int call_options)
int(* disconnect)(stonith_t *st)
Disconnect from the local stonith daemon.
int pcmk__output_simple_status(pcmk__output_t *out, pe_working_set_t *data_set)
int pcmk_legacy2rc(int legacy_rc)
void pe__register_messages(pcmk__output_t *out)
int(* connect)(stonith_t *st, const char *name, int *stonith_fd)
Connect to the local stonith daemon.
void pcmk__out_epilogue(pcmk__output_t *out, xmlNodePtr *xml, int retval)
int cib__clean_up_connection(cib_t **cib)
Function and executable result codes.
int pcmk_pacemakerd_api_ping(pcmk_ipc_api_t *api, const char *ipc_name)
GList * pe__build_node_name_list(pe_working_set_t *data_set, const char *s)
pcmk_ipc_event
Possible event types that an IPC event callback can be called for.
int(* remove_notification)(stonith_t *st, const char *event)
Remove a previously registered notification for event, or all notifications if NULL.
void stonith_api_delete(stonith_t *st)
Sending a command will wait for any reply.
stonith_api_operations_t * cmds
gboolean cluster_status(pe_working_set_t *data_set)
void pcmk_free_ipc_api(pcmk_ipc_api_t *api)
Free the contents of an IPC API object.
void stonith_history_free(stonith_history_t *history)
This structure contains everything that makes up a single output formatter.
int pcmk__output_cluster_status(pcmk__output_t *out, stonith_t *st, cib_t *cib, xmlNode *current_cib, enum pcmk__fence_history fence_history, uint32_t show, uint32_t show_opts, char *only_node, char *only_rsc, char *neg_location_prefix, bool simple_output)
int pcmk__get_fencing_history(stonith_t *st, stonith_history_t **stonith_history, enum pcmk__fence_history fence_history)
Fetch STONITH history, optionally reducing it.
#define pe__set_working_set_flags(working_set, flags_to_set)
#define pcmk__plural_s(i)
int pcmk_status(xmlNodePtr *xml)
Output the current status of the cluster, formatted in the same way that crm_mon --output-as=xml woul...
Daemon's reply to client IPC request.
gboolean cli_config_update(xmlNode **xml, int *best_version, gboolean to_logs)
void pcmk_register_ipc_callback(pcmk_ipc_api_t *api, pcmk_ipc_callback_t cb, void *user_data)
Register a callback for IPC API events.