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",
88 #endif // SUPPORT_COROSYNC 105 crm_info(
"Disconnecting from %s cluster infrastructure",
112 #endif // SUPPORT_COROSYNC 143 if (cluster == NULL) {
147 free(cluster->
uname);
163 const xmlNode *
data, gboolean ordered)
186 static char *
name = NULL;
214 #endif // SUPPORT_COROSYNC 220 if ((
name == NULL) && (nodeid == 0)) {
224 crm_err(
"Could not obtain the local %s node name",
228 crm_notice(
"Defaulting to uname -n for the local %s node name",
233 crm_notice(
"Could not obtain a node name for %s node with id %u",
264 while (g_hash_table_iter_next(&iter, NULL, (gpointer *) &node)) {
266 if (node->uname != NULL) {
278 || (
id < 1LL) || (
id > UINT32_MAX)) {
279 crm_err(
"Invalid Corosync node ID '%s'", uuid);
285 crm_info(
"Setting uuid for node %s[%u] to %s",
286 node->uname, node->id, uuid);
287 node->uuid = strdup(uuid);
327 bool detected =
false;
328 const char *cluster = NULL;
340 if (cluster == NULL) {
351 crm_info(
"Verifying cluster type: '%s'",
352 ((cluster == NULL)?
"-unspecified-" : cluster));
353 if (cluster == NULL) {
367 crm_notice(
"Could not determine the current cluster type");
370 crm_notice(
"This installation does not support the '%s' cluster infrastructure: terminating.",
375 crm_info(
"%s an active '%s' cluster",
376 (detected?
"Detected" :
"Assuming"),
void crm_peer_destroy(void)
#define CRM_CHECK(expr, failure_action)
#define crm_notice(fmt, args...)
gboolean send_cluster_message(const crm_node_t *node, enum crm_ais_msg_types service, const 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
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value.
bool pcmk__cpg_send_xml(const xmlNode *msg, const crm_node_t *node, enum crm_ais_msg_types dest)
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)
crm_node_t * pcmk__search_cluster_node_cache(unsigned int id, const char *uname, const char *uuid)
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_cluster_t * pcmk_cluster_new(void)
Allocate a new crm_cluster_t object.
CRM_TRACE_INIT_DATA(cluster)
void pcmk_cluster_free(crm_cluster_t *cluster)
Free a crm_cluster_t object and its dynamically allocated members.
gboolean crm_cluster_connect(crm_cluster_t *cluster)
Connect to the cluster layer.
#define PCMK__ENV_CLUSTER_TYPE
Deprecated Pacemaker cluster API.
#define crm_err(fmt, args...)
IPC interface to Pacemaker daemons.
void set_uuid(xmlNode *xml, const char *attr, crm_node_t *node)
char * pcmk__corosync_uuid(const crm_node_t *node)
char * pcmk_hostname(void)
Get the local hostname.
GHashTable * crm_peer_cache
#define crm_info(fmt, args...)