19 #ifndef CRM_CLUSTER_INTERNAL__H
20 # define CRM_CLUSTER_INTERNAL__H
24 # define AIS_IPC_NAME "ais-crm-ipc"
25 # define AIS_IPC_MESSAGE_SIZE 8192*128
26 # define CRM_MESSAGE_IPC_ACK 0
28 # ifndef INTERFACE_MAX
29 # define INTERFACE_MAX 2
105 static inline const char *
108 const char *text =
"unknown";
152 text =
"corosync-cpg";
159 text2proc(
const char *proc)
163 if (proc && strcmp(proc,
"cib") == 0) {
165 }
else if (proc && strcmp(proc,
"crmd") == 0) {
172 static inline const char *
177 }
else if (host->
size > 0) {
184 # define ais_data_len(msg) (msg->is_compressed?msg->compressed_size:msg->size)
232 static inline const char *
233 ais_error2text(
int error)
235 const char *text =
"unknown";
237 # if SUPPORT_COROSYNC
243 text =
"Library error";
246 text =
"Version error";
249 text =
"Initialization error";
254 case CS_ERR_TRY_AGAIN:
257 case CS_ERR_INVALID_PARAM:
258 text =
"Invalid parameter";
260 case CS_ERR_NO_MEMORY:
263 case CS_ERR_BAD_HANDLE:
270 text =
"Access error";
272 case CS_ERR_NOT_EXIST:
273 text =
"Doesn't exist";
275 case CS_ERR_NAME_TOO_LONG:
276 text =
"Name too long";
281 case CS_ERR_NO_SPACE:
284 case CS_ERR_INTERRUPT:
287 case CS_ERR_NAME_NOT_FOUND:
288 text =
"Name not found";
290 case CS_ERR_NO_RESOURCES:
291 text =
"No resources";
293 case CS_ERR_NOT_SUPPORTED:
294 text =
"Not supported";
296 case CS_ERR_BAD_OPERATION:
297 text =
"Bad operation";
299 case CS_ERR_FAILED_OPERATION:
300 text =
"Failed operation";
302 case CS_ERR_MESSAGE_ERROR:
303 text =
"Message error";
305 case CS_ERR_QUEUE_FULL:
308 case CS_ERR_QUEUE_NOT_AVAILABLE:
309 text =
"Queue not available";
311 case CS_ERR_BAD_FLAGS:
317 case CS_ERR_NO_SECTIONS:
318 text =
"No sections";
325 static inline const char *
328 const char *text =
"unknown";
369 # if SUPPORT_HEARTBEAT
370 extern ll_cluster_t *heartbeat_cluster;
371 gboolean send_ha_message(ll_cluster_t * hb_conn, xmlNode * msg,
372 const char *node, gboolean force_ordered);
373 gboolean ha_msg_dispatch(ll_cluster_t * cluster_conn, gpointer user_data);
376 xmlNode *convert_ha_message(xmlNode * parent, HA_Message * msg,
const char *field);
377 gboolean ccm_have_quorum(oc_ed_t event);
378 const char *ccm_event_name(oc_ed_t event);
379 crm_node_t *crm_update_ccm_node(
const oc_ev_membership_t * oc,
int offset,
const char *state,
382 gboolean heartbeat_initialize_nodelist(
void *cluster, gboolean force_member, xmlNode * xml_parent);
385 # if SUPPORT_COROSYNC
387 gboolean send_cpg_iov(
struct iovec * iov);
390 char *classic_node_name(uint32_t nodeid);
392 bool send_plugin_text(
int class,
struct iovec *iov);
394 char *corosync_node_name(uint64_t cmap_handle, uint32_t nodeid);
395 char *corosync_cluster_name(
void);
396 int corosync_cmap_has_config(
const char *prefix);
399 gboolean corosync_initialize_nodelist(
void *cluster, gboolean force_member, xmlNode * xml_parent);
401 gboolean send_cluster_message_cs(xmlNode * msg, gboolean
local,
412 char *cman_node_name(uint32_t nodeid);
428 int32_t
votes, uint32_t children,
const char *uuid,
const char *
uname,
429 const char *addr,
const char *state);
436 void (*destroy) (gpointer));
439 void (*destroy) (gpointer));
void crm_update_peer_state(const char *source, crm_node_t *node, const char *state, int membership)
enum crm_ais_msg_types type
char * get_corosync_uuid(crm_node_t *peer)
int get_corosync_id(int id, const char *uuid)
cs_ipc_header_response_t header __attribute__((aligned(8)))
enum crm_ais_msg_types text2msg_type(const char *text)
gboolean cluster_connect_quorum(gboolean(*dispatch)(unsigned long long, gboolean), void(*destroy)(gpointer))
crm_node_t * crm_update_peer(const char *source, unsigned int id, uint64_t born, uint64_t seen, int32_t votes, uint32_t children, const char *uuid, const char *uname, const char *addr, const char *state)
cs_ipc_header_response_t header __attribute__((aligned(8)))
enum crm_proc_flag __attribute__
void crm_update_peer_proc(const char *source, crm_node_t *peer, uint32_t flag, const char *status)
gboolean check_message_sanity(const AIS_Message *msg, const char *data)
enum crm_quorum_source get_quorum_source(void)
#define ais_data_len(msg)
void crm_update_peer_expected(const char *source, crm_node_t *node, const char *expected)
char * get_ais_data(const AIS_Message *msg)
gboolean node_name_is_valid(const char *key, const char *name)
crm_node_t * crm_find_peer_full(unsigned int id, const char *uname, int flags)
void set_node_uuid(const char *uname, const char *uuid)
cs_ipc_header_response_t header __attribute__((aligned(8)))
gboolean init_cman_connection(gboolean(*dispatch)(unsigned long long, gboolean), void(*destroy)(gpointer))
crm_node_t * crm_find_peer(unsigned int id, const char *uname)
enum crm_ais_msg_types type