 |
pacemaker
2.0.3-4b1f869f0f
Scalable High-Availability cluster resource manager
|
Go to the documentation of this file.
30 typedef struct cib_native_opaque_s {
33 void (*dnotify_fn) (gpointer user_data);
39 xmlNode *
data, xmlNode ** output_data,
int call_options);
42 const char *section, xmlNode *
data, xmlNode ** output_data,
43 int call_options,
const char *user_name);
66 native->source = NULL;
67 native->dnotify_fn = NULL;
89 cib_native_dispatch_internal(
const char *buffer, ssize_t length, gpointer userdata)
91 const char *
type = NULL;
94 cib_t *cib = userdata;
106 crm_warn(
"Received a NULL message from the CIB manager");
132 gboolean stay_connected = TRUE;
147 cib_native_dispatch_internal(msg, strlen(msg), cib);
152 stay_connected = FALSE;
156 return stay_connected;
160 cib_native_destroy(
void *userdata)
162 cib_t *cib = userdata;
167 native->source = NULL;
170 if (native->dnotify_fn) {
171 native->dnotify_fn(userdata);
179 const char *channel = NULL;
183 .
dispatch = cib_native_dispatch_internal,
184 .destroy = cib_native_destroy
205 crm_trace(
"Connecting %s channel", channel);
207 if (async_fd != NULL) {
213 }
else if (native->ipc) {
214 crm_perror(LOG_ERR,
"Connection to cluster information base failed");
226 crm_debug(
"Connection unsuccessful (%d %p)", rc, native->ipc);
231 xmlNode *reply = NULL;
246 crm_err(
"Invalid registration message: %s", msg_type);
251 if (native->token == NULL) {
265 crm_debug(
"Connection to CIB manager successful");
279 crm_debug(
"Disconnecting from the CIB manager");
281 if (native->source != NULL) {
284 native->source = NULL;
287 }
else if (native->ipc) {
325 xmlNode *
data, xmlNode ** output_data,
int call_options)
328 data, output_data, call_options, NULL);
333 xmlNode *
data, xmlNode ** output_data,
int call_options,
334 const char *user_name)
340 xmlNode *op_msg = NULL;
341 xmlNode *op_reply = NULL;
349 if (output_data != NULL) {
354 crm_err(
"No operation specified");
376 if (op_msg == NULL) {
385 crm_err(
"Couldn't perform %s operation (timeout=%ds): %s (%d)", op,
402 if (reply_id == cib->
call_id) {
405 crm_trace(
"Synchronous reply %d received", reply_id);
413 }
else if (tmp != NULL) {
417 }
else if (reply_id <= 0) {
418 crm_err(
"Received bad reply: No id set");
424 crm_err(
"Received bad reply: %d (wanted %d)", reply_id, cib->
call_id);
433 }
else if (rc ==
pcmk_ok && op_reply == NULL) {
464 crm_err(
"The CIB manager disconnected");
483 native->dnotify_fn = dnotify;
502 crm_trace(
"Notification not registered: %d", rc);
bool crm_ipc_connect(crm_ipc_t *client)
Establish an IPC connection to a Pacemaker component.
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)
#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.
struct cib_native_opaque_s cib_native_opaque_t
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)
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)