 |
pacemaker
2.0.1-9e909a5bdd
Scalable High-Availability cluster resource manager
|
Go to the documentation of this file.
31 typedef struct cib_native_opaque_s {
34 void (*dnotify_fn) (gpointer user_data);
40 xmlNode *
data, xmlNode ** output_data,
int call_options);
43 const char *section, xmlNode *
data, xmlNode ** output_data,
44 int call_options,
const char *user_name);
67 native->source = NULL;
68 native->dnotify_fn = NULL;
90 cib_native_dispatch_internal(
const char *buffer, ssize_t length, gpointer userdata)
92 const char *
type = NULL;
95 cib_t *cib = userdata;
107 crm_warn(
"Received a NULL message from the CIB manager");
133 gboolean stay_connected = TRUE;
148 cib_native_dispatch_internal(msg, strlen(msg), cib);
153 stay_connected = FALSE;
157 return stay_connected;
161 cib_native_destroy(
void *userdata)
163 cib_t *cib = userdata;
168 native->source = NULL;
171 if (native->dnotify_fn) {
172 native->dnotify_fn(userdata);
180 const char *channel = NULL;
184 .
dispatch = cib_native_dispatch_internal,
185 .destroy = cib_native_destroy
206 crm_trace(
"Connecting %s channel", channel);
208 if (async_fd != NULL) {
214 }
else if (native->ipc) {
215 crm_perror(LOG_ERR,
"Connection to cluster information base failed");
227 crm_debug(
"Connection unsuccessful (%d %p)", rc, native->ipc);
232 xmlNode *reply = NULL;
247 crm_err(
"Invalid registration message: %s", msg_type);
252 if (native->token == NULL) {
266 crm_debug(
"Connection to CIB manager successful");
280 crm_debug(
"Disconnecting from the CIB manager");
282 if (native->source != NULL) {
285 native->source = NULL;
288 }
else if (native->ipc) {
326 xmlNode *
data, xmlNode ** output_data,
int call_options)
329 data, output_data, call_options, NULL);
334 xmlNode *
data, xmlNode ** output_data,
int call_options,
335 const char *user_name)
341 xmlNode *op_msg = NULL;
342 xmlNode *op_reply = NULL;
350 if (output_data != NULL) {
355 crm_err(
"No operation specified");
377 if (op_msg == NULL) {
386 crm_err(
"Couldn't perform %s operation (timeout=%ds): %s (%d)", op,
403 if (reply_id == cib->
call_id) {
406 crm_trace(
"Synchronous reply %d received", reply_id);
414 }
else if (tmp != NULL) {
418 }
else if (reply_id <= 0) {
419 crm_err(
"Received bad reply: No id set");
425 crm_err(
"Received bad reply: %d (wanted %d)", reply_id, cib->
call_id);
434 }
else if (rc ==
pcmk_ok && op_reply == NULL) {
465 crm_err(
"The CIB manager disconnected");
484 native->dnotify_fn = dnotify;
503 crm_trace(
"Notification not registered: %d", rc);
bool crm_ipc_connect(crm_ipc_t *client)
Establish an IPC connection to a Pacemaker component.
struct cib_native_opaque_s cib_native_opaque_t
int cib_native_set_connection_dnotify(cib_t *cib, void(*dnotify)(gpointer user_data))
cib_api_operations_t * cmds
int cib_native_signon_raw(cib_t *cib, const char *name, enum cib_conn_type type, int *event_fd)
int(* signoff)(cib_t *cib)
int cib_native_free(cib_t *cib)
int crm_element_value_int(const xmlNode *data, const char *name, int *dest)
Retrieve the integer value of an XML attribute.
void crm_ipc_close(crm_ipc_t *client)
crm_ipc_t * mainloop_get_ipc_client(mainloop_io_t *client)
xmlNode * create_xml_node(xmlNode *parent, const char *name)
int cib_native_signon(cib_t *cib, const char *name, enum cib_conn_type type)
const char * pcmk_strerror(int rc)
void cib_native_notify(gpointer data, gpointer user_data)
#define CRM_CHECK(expr, failure_action)
xmlNode * copy_xml(xmlNode *src_node)
int(* register_notification)(cib_t *cib, const char *callback, int enabled)
bool cib_native_dispatch(cib_t *cib)
int crm_ipc_ready(crm_ipc_t *client)
Check whether an IPC connection is ready to be read.
enum crm_ais_msg_types type
#define crm_err(fmt, args...)
int crm_ipc_send(crm_ipc_t *client, xmlNode *message, enum crm_ipc_flags flags, int32_t ms_timeout, xmlNode **reply)
#define crm_trace(fmt, args...)
#define safe_str_eq(a, b)
int cib_native_signoff(cib_t *cib)
#define crm_warn(fmt, args...)
void free_xml(xmlNode *child)
const char * crm_ipc_buffer(crm_ipc_t *client)
void crm_ipc_destroy(crm_ipc_t *client)
cib_t * cib_new_variant(void)
int crm_ipc_get_fd(crm_ipc_t *client)
Wrappers for and extensions to glib mainloop.
int cib_native_perform_op_delegate(cib_t *cib, const char *op, const char *host, const char *section, xmlNode *data, xmlNode **output_data, int call_options, const char *user_name)
#define crm_log_xml_explicit(xml, text)
bool crm_ipc_connected(crm_ipc_t *client)
crm_ipc_t * crm_ipc_new(const char *name, size_t max_size)
#define F_CIB_NOTIFY_ACTIVATE
#define crm_debug(fmt, args...)
xmlNode * cib_create_op(int call_id, const char *token, const char *op, const char *host, const char *section, xmlNode *data, int call_options, const char *user_name)
xmlNode * string2xml(const char *input)
cib_t * cib_native_new(void)
#define pcmk_err_diff_resync
int cib_native_perform_op(cib_t *cib, const char *op, const char *host, const char *section, xmlNode *data, xmlNode **output_data, int call_options)
xmlNode * get_message_xml(xmlNode *msg, const char *field)
@ cib_command_nonblocking
#define crm_log_xml_trace(xml, text)
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value.
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
int(* signon_raw)(cib_t *cib, const char *name, enum cib_conn_type type, int *event_fd)
int(* set_connection_dnotify)(cib_t *cib, void(*dnotify)(gpointer user_data))
int cib_native_register_notification(cib_t *cib, const char *callback, int enabled)
#define crm_perror(level, fmt, args...)
Log a system error message.
#define F_CIB_NOTIFY_TYPE
gboolean safe_str_neq(const char *a, const char *b)
struct mainloop_io_s mainloop_io_t
void mainloop_del_ipc_client(mainloop_io_t *client)
#define crm_log_xml_err(xml, text)
const char * crm_xml_add_int(xmlNode *node, const char *name, int value)
Create an XML attribute with specified name and integer value.
char * crm_element_value_copy(const xmlNode *data, const char *name)
Retrieve a copy of the value of an XML attribute.
int(* dispatch)(const char *buffer, ssize_t length, gpointer userdata)
int(* signon)(cib_t *cib, const char *name, enum cib_conn_type type)
void cib_native_callback(cib_t *cib, xmlNode *msg, int call_id, int rc)
@ crm_ipc_client_response
struct crm_ipc_s crm_ipc_t
mainloop_io_t * mainloop_add_ipc_client(const char *name, int priority, size_t max_size, void *userdata, struct ipc_client_callbacks *callbacks)
long crm_ipc_read(crm_ipc_t *client)