20 #include <sys/param.h> 21 #include <sys/types.h> 22 #include <sys/utsname.h> 96 if (node->
uuid != NULL) {
100 switch (cluster_layer) {
105 #endif // SUPPORT_COROSYNC 108 crm_err(
"Unsupported cluster layer %s",
129 crm_notice(
"Connecting to %s cluster layer", cluster_layer_s);
131 switch (cluster_layer) {
135 #endif // SUPPORT_COROSYNC 141 crm_err(
"Failed to connect to unsupported cluster layer %s",
143 return EPROTONOSUPPORT;
159 crm_info(
"Disconnecting from %s cluster layer", cluster_layer_s);
161 switch (cluster_layer) {
167 #endif // SUPPORT_COROSYNC 173 crm_err(
"Failed to disconnect from unsupported cluster layer %s",
175 return EPROTONOSUPPORT;
199 if (cluster == NULL) {
203 free(cluster->
uname);
218 if (cluster == NULL) {
244 #endif // SUPPORT_COROSYNC 275 switch (cluster_layer) {
283 #endif // SUPPORT_COROSYNC 286 crm_err(
"Unsupported cluster layer: %s", cluster_layer_s);
291 struct utsname hostinfo;
293 crm_notice(
"Could not get local node name from %s cluster layer, " 294 "defaulting to local hostname",
297 if (
uname(&hostinfo) < 0) {
299 crm_err(
"Failed to get the local hostname");
305 crm_notice(
"Could not obtain a node name for node with " 328 static char *
name = NULL;
372 while (g_hash_table_iter_next(&iter, NULL, (gpointer *) &node)) {
398 crm_err(
"Invalid cluster layer: %d", layer);
418 const char *cluster = NULL;
422 return cluster_layer;
427 if (cluster != NULL) {
428 crm_info(
"Verifying configured cluster layer '%s'", cluster);
435 #endif // SUPPORT_COROSYNC 438 crm_notice(
"This installation does not support the '%s' cluster " 439 "infrastructure: terminating",
443 crm_info(
"Assuming an active '%s' cluster", cluster);
452 #endif // SUPPORT_COROSYNC 455 crm_notice(
"Could not determine the current cluster layer");
457 crm_info(
"Detected an active '%s' cluster",
462 return cluster_layer;
517 const xmlNode *
data, gboolean ordered)
#define CRM_CHECK(expr, failure_action)
#define crm_notice(fmt, args...)
#define PCMK_VALUE_COROSYNC
int pcmk_cluster_disconnect(pcmk_cluster_t *cluster)
Disconnect from the cluster layer.
gboolean send_cluster_message(const crm_node_t *node, enum crm_ais_msg_types service, const xmlNode *data, gboolean ordered)
_Noreturn crm_exit_t crm_exit(crm_exit_t rc)
char * pcmk__corosync_name(uint64_t cmap_handle, uint32_t nodeid)
enum cluster_type_e get_cluster_type(void)
int pcmk_cluster_connect(pcmk_cluster_t *cluster)
const char * crm_peer_uuid(crm_node_t *peer)
void(* destroy)(gpointer)
GHashTable * crm_remote_peer_cache
gboolean crm_cluster_connect(pcmk_cluster_t *cluster)
pcmk_cluster_t * pcmk_cluster_new(void)
Allocate a new pcmk_cluster_t object.
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)
const char * pcmk_cluster_layer_text(enum pcmk_cluster_layer layer)
Get a log-friendly string equivalent of a cluster layer.
enum crm_ais_msg_types type
const char * get_local_node_name(void)
const char * pcmk__env_option(const char *option)
enum crm_ais_msg_types pcmk__cluster_parse_msg_type(const char *text)
gboolean is_corosync_cluster(void)
const char * pcmk__node_name_from_uuid(const char *uuid)
char * get_node_name(uint32_t nodeid)
#define crm_debug(fmt, args...)
const char * crm_peer_uname(const char *uuid)
int pcmk__corosync_connect(pcmk_cluster_t *cluster)
const char * name_for_cluster_type(enum cluster_type_e type)
#define CRM_SYSTEM_PENGINE
Wrappers for and extensions to libxml2.
CRM_TRACE_INIT_DATA(cluster)
int pcmk_cluster_set_destroy_fn(pcmk_cluster_t *cluster, void(*fn)(gpointer))
Set the destroy function for a cluster object.
#define PCMK__ENV_CLUSTER_TYPE
bool pcmk__str_any_of(const char *s,...) G_GNUC_NULL_TERMINATED
#define pcmk__str_copy(str)
const char * pcmk__cluster_local_node_name(void)
Deprecated Pacemaker cluster API.
const char * pcmk__message_name(const char *name)
Get name to be used as identifier for cluster messages.
enum pcmk_cluster_layer pcmk_get_cluster_layer(void)
Get and validate the local cluster layer.
#define CRM_SYSTEM_STONITHD
#define CRM_SYSTEM_TENGINE
void pcmk__cluster_destroy_node_caches(void)
#define crm_err(fmt, args...)
void pcmk_cluster_free(pcmk_cluster_t *cluster)
Free a pcmk_cluster_t object and its dynamically allocated members.
pcmk_cluster_layer
Types of cluster layer.
void crm_cluster_disconnect(pcmk_cluster_t *cluster)
IPC interface to Pacemaker daemons.
void set_uuid(xmlNode *xml, const char *attr, crm_node_t *node)
char * pcmk__cluster_node_name(uint32_t nodeid)
char * pcmk__corosync_uuid(const crm_node_t *node)
bool pcmk__corosync_is_active(void)
const char * pcmk__cluster_node_uuid(crm_node_t *node)
bool pcmk__cluster_send_message(const crm_node_t *node, enum crm_ais_msg_types service, const xmlNode *data)
#define pcmk__assert_alloc(nmemb, size)
GHashTable * crm_peer_cache
#define crm_info(fmt, args...)
void pcmk__corosync_disconnect(pcmk_cluster_t *cluster)