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",
259 node->
uuid = strdup(uuid);
300 crm_err(
"Invalid cluster type: %d", type);
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...)
_Noreturn crm_exit_t crm_exit(crm_exit_t rc)
void pcmk__corosync_disconnect(crm_cluster_t *cluster)
const char * get_local_node_name(void)
Get the local node's name.
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.
enum cluster_type_e pcmk__corosync_detect(void)
enum crm_ais_msg_types type
char * get_node_name(uint32_t nodeid)
Get the node name corresponding to a cluster node ID.
void crm_cluster_disconnect(crm_cluster_t *cluster)
Disconnect from the cluster layer.
const char * pcmk__env_option(const char *option)
#define CRM_TRACE_INIT_DATA(name)
int pcmk__scan_ll(const char *text, long long *result, long long default_value)
#define crm_debug(fmt, args...)
gboolean pcmk__corosync_connect(crm_cluster_t *cluster)
crm_node_t * pcmk__search_cluster_node_cache(unsigned int id, const char *uname)
gboolean pcmk__cpg_send_xml(xmlNode *msg, crm_node_t *node, enum crm_ais_msg_types dest)
const char * name_for_cluster_type(enum cluster_type_e type)
Get a log-friendly string equivalent of a cluster type.
gboolean crm_cluster_connect(crm_cluster_t *cluster)
Connect to the cluster layer.
gboolean is_corosync_cluster(void)
Check whether the local cluster is a Corosync cluster.
#define crm_err(fmt, args...)
const char * crm_peer_uname(const char *uuid)
Get the node name corresponding to a node UUID.
char * pcmk__corosync_name(uint64_tcmap_handle, uint32_t nodeid)
IPC interface to Pacemaker daemons.
char * pcmk_hostname(void)
Get the local hostname.
void set_uuid(xmlNode *xml, const char *attr, crm_node_t *node)
Add a node's UUID as an XML attribute.
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.
GHashTable * crm_peer_cache
#define crm_info(fmt, args...)
const char * crm_peer_uuid(crm_node_t *node)
Get (and set if needed) a node's UUID.
enum cluster_type_e get_cluster_type(void)
Get (and validate) the local cluster type.