16 #include <sys/param.h>
17 #include <sys/types.h>
37 }
else if (peer->
uuid) {
50 crm_err(
"Unsupported cluster type");
63 crm_notice(
"Connecting to cluster infrastructure: %s",
85 crm_info(
"Disconnecting from cluster infrastructure: %s",
120 static char *name = NULL;
137 # if SUPPORT_COROSYNC
147 if(name == NULL && nodeid == 0) {
150 crm_err(
"Could not obtain the local %s node name",
154 crm_notice(
"Defaulting to uname -n for the local %s node name",
159 crm_notice(
"Could not obtain a node name for %s nodeid %u",
190 while (g_hash_table_iter_next(&iter, NULL, (gpointer *) &node)) {
191 if(node->
uuid && strcasecmp(node->
uuid, uuid) == 0) {
207 crm_err(
"Invalid node id: %s", uuid);
211 crm_info(
"Setting uuid for node %s[%u] to '%s'", node->
uname, node->
id, uuid);
212 node->
uuid = strdup(uuid);
244 crm_err(
"Invalid cluster type: %d", type);
260 }
else if (cluster_type == type) {
268 crm_err(
"Cluster type already set to %s, ignoring %s",
275 bool detected = FALSE;
276 const char *cluster = NULL;
287 if(cluster == NULL) {
298 crm_info(
"Verifying cluster type: '%s'", cluster?cluster:
"-unspecified-");
299 if (cluster == NULL) {
313 crm_notice(
"Could not determine the current cluster type");
316 crm_notice(
"This installation does not support the '%s' cluster infrastructure: terminating.",
342 }
else if (sscanf(name,
"%d.%d.%d.%d", &octet, &octet, &octet, &octet) == 4) {
343 crm_trace(
"%s contains an ipv4 address, ignoring: %s", key, name);
346 }
else if (strstr(name,
":") != NULL) {
347 crm_trace(
"%s contains an ipv6 address, ignoring: %s", key, name);
void crm_peer_destroy(void)
#define CRM_CHECK(expr, failure_action)
#define crm_notice(fmt, args...)
_Noreturn crm_exit_t crm_exit(crm_exit_t rc)
char * corosync_node_name(uint64_tcmap_handle, uint32_t nodeid)
void terminate_cs_connection(crm_cluster_t *cluster)
const char * get_local_node_name(void)
long long crm_int_helper(const char *text, char **end_text)
GHashTable * crm_remote_peer_cache
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value.
char * get_node_name(uint32_t nodeid)
void crm_cluster_disconnect(crm_cluster_t *cluster)
gboolean init_cs_connection(crm_cluster_t *cluster)
#define CRM_TRACE_INIT_DATA(name)
#define crm_debug(fmt, args...)
#define crm_trace(fmt, args...)
enum cluster_type_e find_corosync_variant(void)
const char * name_for_cluster_type(enum cluster_type_e type)
gboolean crm_cluster_connect(crm_cluster_t *cluster)
int set_cluster_type(enum cluster_type_e type)
gboolean is_corosync_cluster(void)
const char * daemon_option(const char *option)
gboolean node_name_is_valid(const char *key, const char *name)
#define crm_err(fmt, args...)
const char * crm_peer_uname(const char *uuid)
Get the node name corresponding to a node UUID.
gboolean send_cluster_message_cs(xmlNode *msg, gboolean local, crm_node_t *node, enum crm_ais_msg_types dest)
char * get_corosync_uuid(crm_node_t *node)
Wrappers for and extensions to libqb IPC.
char * pcmk_hostname(void)
Get the local hostname.
void set_uuid(xmlNode *xml, const char *attr, crm_node_t *node)
#define safe_str_eq(a, b)
crm_node_t * crm_find_peer(unsigned int id, const char *uname)
gboolean send_cluster_message(crm_node_t *node, enum crm_ais_msg_types service, xmlNode *data, gboolean ordered)
GHashTable * crm_peer_cache
#define crm_info(fmt, args...)
const char * crm_peer_uuid(crm_node_t *node)
enum crm_ais_msg_types type
enum cluster_type_e get_cluster_type(void)