18 #include <sys/param.h> 19 #include <sys/types.h> 46 if (peer->
uuid != NULL) {
59 crm_err(
"Unsupported cluster type");
79 crm_notice(
"Connecting to %s cluster infrastructure",
106 crm_info(
"Disconnecting from %s cluster infrastructure",
134 xmlNode *
data, gboolean ordered)
157 static char *
name = NULL;
181 # if SUPPORT_COROSYNC 191 if ((
name == NULL) && (nodeid == 0)) {
195 crm_err(
"Could not obtain the local %s node name",
199 crm_notice(
"Defaulting to uname -n for the local %s node name",
204 crm_notice(
"Could not obtain a node name for %s node with id %u",
235 while (g_hash_table_iter_next(&iter, NULL, (gpointer *) &node)) {
237 if (node->uname != NULL) {
250 || (
id < 1LL) || (
id > UINT32_MAX)) {
251 crm_err(
"Invalid Corosync node ID '%s'", uuid);
257 crm_info(
"Setting uuid for node %s[%u] to %s",
258 node->uname, node->id, uuid);
259 node->uuid = strdup(uuid);
313 bool detected =
false;
314 const char *cluster = NULL;
326 if (cluster == NULL) {
337 crm_info(
"Verifying cluster type: '%s'",
338 ((cluster == NULL)?
"-unspecified-" : cluster));
339 if (cluster == NULL) {
353 crm_notice(
"Could not determine the current cluster type");
356 crm_notice(
"This installation does not support the '%s' cluster infrastructure: terminating.",
361 crm_info(
"%s an active '%s' cluster",
362 (detected?
"Detected" :
"Assuming"),
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)
Send an XML message via the cluster messaging layer.
_Noreturn crm_exit_t crm_exit(crm_exit_t rc)
void pcmk__corosync_disconnect(crm_cluster_t *cluster)
char * pcmk__corosync_name(uint64_t cmap_handle, uint32_t nodeid)
enum cluster_type_e get_cluster_type(void)
Get (and validate) the local cluster type.
const char * crm_peer_uuid(crm_node_t *peer)
Get (and set if needed) a node's UUID.
GHashTable * crm_remote_peer_cache
char * pcmk__corosync_uuid(crm_node_t *node)
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)
Disconnect from the cluster layer.
enum cluster_type_e pcmk__corosync_detect(void)
enum crm_ais_msg_types type
const char * get_local_node_name(void)
Get the local node's name.
const char * pcmk__env_option(const char *option)
gboolean is_corosync_cluster(void)
Check whether the local cluster is a Corosync cluster.
int pcmk__scan_ll(const char *text, long long *result, long long default_value)
char * get_node_name(uint32_t nodeid)
Get the node name corresponding to a cluster node ID.
#define crm_debug(fmt, args...)
gboolean pcmk__corosync_connect(crm_cluster_t *cluster)
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)
Get a log-friendly string equivalent of a cluster type.
crm_node_t * pcmk__search_cluster_node_cache(unsigned int id, const char *uname)
CRM_TRACE_INIT_DATA(cluster)
gboolean crm_cluster_connect(crm_cluster_t *cluster)
Connect to the cluster layer.
gboolean pcmk__cpg_send_xml(xmlNode *msg, crm_node_t *node, enum crm_ais_msg_types dest)
#define PCMK__ENV_CLUSTER_TYPE
#define crm_err(fmt, args...)
IPC interface to Pacemaker daemons.
void set_uuid(xmlNode *xml, const char *attr, crm_node_t *node)
Add a node's UUID as an XML attribute.
char * pcmk_hostname(void)
Get the local hostname.
GHashTable * crm_peer_cache
#define crm_info(fmt, args...)