pacemaker  2.1.0-7c3f660
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
cluster.c File Reference
#include <crm_internal.h>
#include <dlfcn.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <sys/param.h>
#include <sys/types.h>
#include <crm/crm.h>
#include <crm/msg_xml.h>
#include <crm/common/ipc.h>
#include <crm/cluster/internal.h>
#include "crmcluster_private.h"
Include dependency graph for cluster.c:

Go to the source code of this file.

Functions

 CRM_TRACE_INIT_DATA (cluster)
 
const char * crm_peer_uuid (crm_node_t *peer)
 Get (and set if needed) a node's UUID. More...
 
gboolean crm_cluster_connect (crm_cluster_t *cluster)
 Connect to the cluster layer. More...
 
void crm_cluster_disconnect (crm_cluster_t *cluster)
 Disconnect from the cluster layer. More...
 
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. More...
 
const char * get_local_node_name (void)
 Get the local node's name. More...
 
char * get_node_name (uint32_t nodeid)
 Get the node name corresponding to a cluster node ID. More...
 
const char * crm_peer_uname (const char *uuid)
 Get the node name corresponding to a node UUID. More...
 
void set_uuid (xmlNode *xml, const char *attr, crm_node_t *node)
 Add a node's UUID as an XML attribute. More...
 
const char * name_for_cluster_type (enum cluster_type_e type)
 Get a log-friendly string equivalent of a cluster type. More...
 
enum cluster_type_e get_cluster_type (void)
 Get (and validate) the local cluster type. More...
 
gboolean is_corosync_cluster (void)
 Check whether the local cluster is a Corosync cluster. More...
 

Function Documentation

gboolean crm_cluster_connect ( crm_cluster_t cluster)

Connect to the cluster layer.

Parameters
[in]Initializedcluster object to connect
Returns
TRUE on success, otherwise FALSE

Definition at line 75 of file cluster.c.

void crm_cluster_disconnect ( crm_cluster_t cluster)

Disconnect from the cluster layer.

Parameters
[in]clusterCluster object to disconnect

Definition at line 102 of file cluster.c.

const char* crm_peer_uname ( const char *  uuid)

Get the node name corresponding to a node UUID.

Parameters
[in]uuidUUID of desired node
Returns
name of desired node
Note
This relies on the remote peer cache being populated with all remote nodes in the cluster, so callers should maintain that cache.

Definition at line 221 of file cluster.c.

const char* crm_peer_uuid ( crm_node_t peer)

Get (and set if needed) a node's UUID.

Parameters
[in]peerNode to check
Returns
Node UUID of peer, or NULL if unknown

Definition at line 38 of file cluster.c.

CRM_TRACE_INIT_DATA ( cluster  )
enum cluster_type_e get_cluster_type ( void  )

Get (and validate) the local cluster type.

Returns
Local cluster type
Note
This will fatally exit if the local cluster type is invalid.

Definition at line 311 of file cluster.c.

const char* get_local_node_name ( void  )

Get the local node's name.

Returns
Local node's name
Note
This will fatally exit if local node name cannot be known.

Definition at line 155 of file cluster.c.

char* get_node_name ( uint32_t  nodeid)

Get the node name corresponding to a cluster node ID.

Parameters
[in]nodeidNode ID to check (or 0 for local node)
Returns
Node name corresponding to nodeid
Note
This will fatally exit if nodeid is 0 and local node name cannot be known.

Definition at line 175 of file cluster.c.

gboolean is_corosync_cluster ( void  )

Check whether the local cluster is a Corosync cluster.

Returns
TRUE if the local cluster is a Corosync cluster, otherwise FALSE

Definition at line 375 of file cluster.c.

const char* name_for_cluster_type ( enum cluster_type_e  type)

Get a log-friendly string equivalent of a cluster type.

Parameters
[in]typeCluster type
Returns
Log-friendly string corresponding to type

Definition at line 290 of file cluster.c.

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.

Parameters
[in]nodeCluster node to send message to
[in]serviceMessage type to use in message host info
[in]dataXML message to send
[in]orderedIgnored for currently supported messaging layers
Returns
TRUE on success, otherwise FALSE

Definition at line 133 of file cluster.c.

void set_uuid ( xmlNode *  xml,
const char *  attr,
crm_node_t node 
)

Add a node's UUID as an XML attribute.

Parameters
[in,out]xmlXML element to add UUID to
[in]attrXML attribute name to set
[in]nodeNode whose UUID should be used as attribute value

Definition at line 277 of file cluster.c.