20 #include <sys/param.h> 21 #include <sys/types.h> 22 #include <sys/utsname.h> 51 if (node->
xml_id != NULL) {
55 switch (cluster_layer) {
60 #endif // SUPPORT_COROSYNC 63 crm_err(
"Unsupported cluster layer %s",
83 if (cluster == NULL) {
88 crm_notice(
"Connecting to %s cluster layer", cluster_layer_s);
90 switch (cluster_layer) {
94 #endif // SUPPORT_COROSYNC 100 crm_err(
"Failed to connect to unsupported cluster layer %s",
102 return EPROTONOSUPPORT;
118 crm_info(
"Disconnecting from %s cluster layer", cluster_layer_s);
120 switch (cluster_layer) {
126 #endif // SUPPORT_COROSYNC 132 crm_err(
"Failed to disconnect from unsupported cluster layer %s",
134 return EPROTONOSUPPORT;
162 if (cluster == NULL) {
182 if (cluster == NULL) {
208 #endif // SUPPORT_COROSYNC 239 switch (cluster_layer) {
247 #endif // SUPPORT_COROSYNC 250 crm_err(
"Unsupported cluster layer: %s", cluster_layer_s);
255 struct utsname hostinfo;
257 crm_notice(
"Could not get local node name from %s cluster layer, " 258 "defaulting to local hostname",
261 if (
uname(&hostinfo) < 0) {
263 crm_err(
"Failed to get the local hostname");
269 crm_notice(
"Could not obtain a node name for node with " 292 static char *
name = NULL;
336 while (g_hash_table_iter_next(&iter, NULL, (gpointer *) &node)) {
362 crm_err(
"Invalid cluster layer: %d", layer);
382 const char *cluster = NULL;
386 return cluster_layer;
391 if (cluster != NULL) {
392 crm_info(
"Verifying configured cluster layer '%s'", cluster);
399 #endif // SUPPORT_COROSYNC 402 crm_notice(
"This installation does not support the '%s' cluster " 403 "infrastructure: terminating",
407 crm_info(
"Assuming an active '%s' cluster", cluster);
416 #endif // SUPPORT_COROSYNC 419 crm_notice(
"Could not determine the current cluster layer");
421 crm_info(
"Detected an active '%s' cluster",
426 return cluster_layer;
437 if (cluster == NULL) {
440 if (cluster->
priv == NULL) {
#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.
_Noreturn crm_exit_t crm_exit(crm_exit_t rc)
Implementation of pcmk__cluster_private_t.
enum pcmk_ipc_server type
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)
gboolean crm_cluster_connect(pcmk_cluster_t *cluster)
pcmk_cluster_t * pcmk_cluster_new(void)
Allocate a new pcmk_cluster_t object.
const char * pcmk_cluster_layer_text(enum pcmk_cluster_layer layer)
Get a log-friendly string equivalent of a cluster layer.
bool pcmk__cpg_send_xml(const xmlNode *msg, const pcmk__node_status_t *node, enum pcmk_ipc_server dest)
char * node_name
Local node name at cluster layer.
const char * pcmk__env_option(const char *option)
enum pcmk_ipc_server server
Server this connection is for (if any)
G_GNUC_INTERNAL void election_fini(pcmk_cluster_t *cluster)
const char * pcmk__node_name_from_uuid(const char *uuid)
pcmk_ipc_server
Available IPC interfaces.
void(* destroy)(gpointer)
#define crm_debug(fmt, args...)
int pcmk__corosync_connect(pcmk_cluster_t *cluster)
const char * name_for_cluster_type(enum cluster_type_e type)
char * pcmk__corosync_uuid(const pcmk__node_status_t *node)
Wrappers for and extensions to libxml2.
CRM_TRACE_INIT_DATA(cluster)
enum pcmk_ipc_server pcmk__parse_server(const char *text)
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
#define pcmk__str_copy(str)
const char * pcmk__cluster_local_node_name(void)
Deprecated Pacemaker cluster API.
GHashTable * pcmk__remote_peer_cache
enum pcmk_cluster_layer pcmk_get_cluster_layer(void)
Get and validate the local cluster layer.
bool pcmk__cluster_send_message(const pcmk__node_status_t *node, enum pcmk_ipc_server service, const xmlNode *data)
void pcmk__cluster_destroy_node_caches(void)
#define crm_err(fmt, args...)
const char * pcmk__cluster_node_uuid(pcmk__node_status_t *node)
GHashTable * pcmk__peer_cache
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.
IPC interface to Pacemaker daemons.
char * pcmk__cluster_node_name(uint32_t nodeid)
bool pcmk__corosync_is_active(void)
#define pcmk__assert_alloc(nmemb, size)
#define crm_info(fmt, args...)
pcmk__cluster_private_t * priv
Node status data (may be a cluster node or a Pacemaker Remote node)
void pcmk__corosync_disconnect(pcmk_cluster_t *cluster)