22 typedef struct pacemakerd_api_private_s {
27 static const char *pacemakerd_state_str[] = {
47 if (pcmk__str_eq(state, pacemakerd_state_str[i],
pcmk__str_none)) {
60 return pacemakerd_state_str[state];
79 return "Initializing pacemaker";
81 return "Pacemaker daemons are starting";
83 return "Waiting for startup trigger from SBD";
85 return "Pacemaker is running";
87 return "Pacemaker daemons are shutting down";
92 return "Pacemaker daemons are shut down (reporting to SBD)";
94 return "pacemaker-remoted is running (on a Pacemaker Remote node)";
96 return "Invalid pacemakerd state";
125 struct pacemakerd_api_private_s *
private = NULL;
127 api->
api_data = calloc(1,
sizeof(
struct pacemakerd_api_private_s));
138 private->client_uuid = pcmk__getpid_s();
144 free_data(
void *
data)
146 free(((
struct pacemakerd_api_private_s *)
data)->client_uuid);
154 struct pacemakerd_api_private_s *
private = NULL;
168 struct pacemakerd_api_private_s *
private = NULL;
184 if (command == NULL) {
196 xmlNode *wrapper = NULL;
197 xmlNode *msg_data = NULL;
201 const char *value = NULL;
202 long long value_ll = 0;
205 long long int ack_status = 0;
213 crm_info(
"Unrecognizable message from %s: " 221 crm_info(
"Unrecognizable message from %s: no reference",
243 reply_data.
data.
ping.last_good = (value_ll < 0)? 0 : (time_t) value_ll;
252 crm_info(
"Unrecognizable message from %s: unknown command '%s'",
280 do_pacemakerd_api_call(
pcmk_ipc_api_t *api,
const char *ipc_name,
const char *task)
294 pcmk__ipc_sys_name(ipc_name,
"client"),
295 private->client_uuid);
300 crm_debug(
"Couldn't send request to %s: %s rc=%d",
314 return do_pacemakerd_api_call(api, ipc_name,
CRM_OP_PING);
320 return do_pacemakerd_api_call(api, ipc_name,
CRM_OP_QUIT);
#define PCMK__VALUE_RESPONSE
int pcmk_pacemakerd_api_ping(pcmk_ipc_api_t *api, const char *ipc_name)
Could not determine status.
#define PCMK_XA_REFERENCE
#define PCMK__XA_PACEMAKERD_STATE
enum crm_exit_e crm_exit_t
#define PCMK__VALUE_SHUTDOWN_COMPLETE
struct pcmk_pacemakerd_api_reply_t::@5::@6 ping
pcmk_pacemakerd_api_reply
Possible types of pacemakerd replies.
const char * pcmk_rc_str(int rc)
Get a user-friendly description of a return code.
int crm_element_value_ll(const xmlNode *data, const char *name, long long *dest)
Retrieve the long long integer value of an XML attribute.
G_GNUC_INTERNAL void pcmk__call_ipc_callback(pcmk_ipc_api_t *api, enum pcmk_ipc_event event_type, crm_exit_t status, void *event_data)
struct pacemakerd_api_private_s pacemakerd_api_private_t
union pcmk_pacemakerd_api_reply_t::@5 data
#define PCMK__XA_CRM_TASK
#define PCMK_XA_CRM_TIMESTAMP
int pcmk__scan_ll(const char *text, long long *result, long long default_value)
enum pcmk_pacemakerd_api_reply reply_type
#define crm_debug(fmt, args...)
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)
G_GNUC_INTERNAL int pcmk__send_ipc_request(pcmk_ipc_api_t *api, const xmlNode *request)
#define PCMK__VALUE_WAIT_FOR_PING
Wrappers for and extensions to libxml2.
#define PCMK__VALUE_RUNNING
#define PCMK__VALUE_STARTING_DAEMONS
IPC commands for Pacemakerd.
void free_xml(xmlNode *child)
int(* post_connect)(pcmk_ipc_api_t *api)
#define PCMK__XA_CRM_SUBSYSTEM
bool pcmk__str_any_of(const char *s,...) G_GNUC_NULL_TERMINATED
#define PCMK__VALUE_SHUTTING_DOWN
int(* new_data)(pcmk_ipc_api_t *api)
int pcmk_pacemakerd_api_shutdown(pcmk_ipc_api_t *api, const char *ipc_name)
enum pcmk_pacemakerd_state pcmk_pacemakerd_api_daemon_state_text2enum(const char *state)
const char * pcmk_pacemakerd_api_daemon_state_enum2text(enum pcmk_pacemakerd_state state)
bool(* dispatch)(pcmk_ipc_api_t *api, xmlNode *msg)
bool(* reply_expected)(pcmk_ipc_api_t *api, const xmlNode *request)
#define PCMK__XA_OP_STATUS
void(* free_data)(void *api_data)
const char * pcmk_ipc_name(const pcmk_ipc_api_t *api, bool for_log)
Get the IPC name used with an IPC API connection.
struct pcmk_pacemakerd_api_reply_t::@5::@7 shutdown
IPC interface to Pacemaker daemons.
const char * pcmk__pcmkd_state_enum2friendly(enum pcmk_pacemakerd_state state)
const char * pcmk__pcmkd_api_reply2str(enum pcmk_pacemakerd_api_reply reply)
void(* post_disconnect)(pcmk_ipc_api_t *api)
Daemon's reply to client IPC request.
#define create_request(task, xml_data, host_to, sys_to, sys_from, uuid_from)
#define PCMK_VALUE_REMOTE
#define crm_info(fmt, args...)
pcmk__ipc_methods_t * pcmk__pacemakerd_api_methods(void)