18 #include <sys/param.h> 19 #include <sys/types.h> 39 }
else if (peer->
uuid) {
52 crm_err(
"Unsupported cluster type");
65 crm_notice(
"Connecting to cluster infrastructure: %s",
87 crm_info(
"Disconnecting from cluster infrastructure: %s",
122 static char *
name = NULL;
139 # if SUPPORT_COROSYNC 149 if(
name == NULL && nodeid == 0) {
152 crm_err(
"Could not obtain the local %s node name",
156 crm_notice(
"Defaulting to uname -n for the local %s node name",
161 crm_notice(
"Could not obtain a node name for %s nodeid %u",
192 while (g_hash_table_iter_next(&iter, NULL, (gpointer *) &node)) {
193 if(node->uuid && strcasecmp(node->uuid, uuid) == 0) {
209 crm_err(
"Invalid node id: %s", uuid);
213 crm_info(
"Setting uuid for node %s[%u] to '%s'", node->uname, node->id, uuid);
214 node->uuid = strdup(uuid);
262 }
else if (cluster_type ==
type) {
270 crm_err(
"Cluster type already set to %s, ignoring %s",
277 bool detected = FALSE;
278 const char *cluster = NULL;
289 if(cluster == NULL) {
300 crm_info(
"Verifying cluster type: '%s'", cluster?cluster:
"-unspecified-");
301 if (cluster == NULL) {
315 crm_notice(
"Could not determine the current cluster type");
318 crm_notice(
"This installation does not support the '%s' cluster infrastructure: terminating.",
344 }
else if (sscanf(
name,
"%d.%d.%d.%d", &octet, &octet, &octet, &octet) == 4) {
345 crm_trace(
"%s contains an ipv4 address, ignoring: %s", key,
name);
348 }
else if (strstr(
name,
":") != NULL) {
349 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...)
gboolean send_cluster_message(crm_node_t *node, enum crm_ais_msg_types service, xmlNode *data, gboolean ordered)
_Noreturn crm_exit_t crm_exit(crm_exit_t rc)
enum cluster_type_e get_cluster_type(void)
void terminate_cs_connection(crm_cluster_t *cluster)
const char * crm_peer_uuid(crm_node_t *peer)
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.
void crm_cluster_disconnect(crm_cluster_t *cluster)
const char * get_local_node_name(void)
const char * pcmk__env_option(const char *option)
gboolean init_cs_connection(crm_cluster_t *cluster)
gboolean is_corosync_cluster(void)
gboolean node_name_is_valid(const char *key, const char *name)
char * get_node_name(uint32_t nodeid)
#define crm_debug(fmt, args...)
const char * crm_peer_uname(const char *uuid)
Get the node name corresponding to a node UUID.
const char * name_for_cluster_type(enum cluster_type_e type)
#define crm_trace(fmt, args...)
CRM_TRACE_INIT_DATA(cluster)
char * corosync_node_name(uint64_t cmap_handle, uint32_t nodeid)
enum cluster_type_e find_corosync_variant(void)
gboolean crm_cluster_connect(crm_cluster_t *cluster)
int set_cluster_type(enum cluster_type_e type)
long long crm_parse_ll(const char *text, const char *default_text)
Parse a long long integer value from a string.
#define crm_err(fmt, args...)
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)
IPC interface to Pacemaker daemons.
void set_uuid(xmlNode *xml, const char *attr, crm_node_t *node)
char * pcmk_hostname(void)
Get the local hostname.
crm_node_t * crm_find_peer(unsigned int id, const char *uname)
GHashTable * crm_peer_cache
#define crm_info(fmt, args...)
enum crm_ais_msg_types type