pacemaker  1.1.18-7fdfbbe
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
cluster.h File Reference
#include <crm/common/xml.h>
#include <crm/common/util.h>
Include dependency graph for cluster.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  crm_peer_node_s
 
struct  crm_cluster_s
 

Macros

#define CRM_SERVICE   PCMK_SERVICE_ID
 
#define CRM_NODE_LOST   "lost"
 
#define CRM_NODE_MEMBER   "member"
 
#define CRM_NODE_ACTIVE   CRM_NODE_MEMBER
 
#define CRM_NODE_EVICTED   "evicted"
 

Typedefs

typedef struct crm_peer_node_s crm_node_t
 
typedef struct crm_cluster_s crm_cluster_t
 

Enumerations

enum  crm_join_phase {
  crm_join_nack = -1, crm_join_none = 0, crm_join_welcomed = 1, crm_join_integrated = 2,
  crm_join_finalized = 3, crm_join_confirmed = 4
}
 
enum  crm_node_flags { crm_remote_node = 0x0001, crm_remote_container = 0x0002, crm_remote_baremetal = 0x0004, crm_node_dirty = 0x0010 }
 
enum  crm_ais_msg_class {
  crm_class_cluster = 0, crm_class_members = 1, crm_class_notify = 2, crm_class_nodeid = 3,
  crm_class_rmpeer = 4, crm_class_quorum = 5
}
 
enum  crm_ais_msg_types {
  crm_msg_none = 0, crm_msg_ais = 1, crm_msg_lrmd = 2, crm_msg_cib = 3,
  crm_msg_crmd = 4, crm_msg_attrd = 5, crm_msg_stonithd = 6, crm_msg_te = 7,
  crm_msg_pe = 8, crm_msg_stonith_ng = 9
}
 
enum  crm_get_peer_flags { CRM_GET_PEER_CLUSTER = 0x0001, CRM_GET_PEER_REMOTE = 0x0002, CRM_GET_PEER_ANY = CRM_GET_PEER_CLUSTER|CRM_GET_PEER_REMOTE }
 
enum  crm_status_type { crm_status_uname, crm_status_nstate, crm_status_processes, crm_status_rstate }
 
enum  cluster_type_e {
  pcmk_cluster_unknown = 0x0001, pcmk_cluster_invalid = 0x0002, pcmk_cluster_heartbeat = 0x0004, pcmk_cluster_classic_ais = 0x0010,
  pcmk_cluster_corosync = 0x0020, pcmk_cluster_cman = 0x0040
}
 

Functions

void crm_peer_init (void)
 
void crm_peer_destroy (void)
 
gboolean crm_cluster_connect (crm_cluster_t *cluster)
 
void crm_cluster_disconnect (crm_cluster_t *cluster)
 
gboolean send_cluster_message (crm_node_t *node, enum crm_ais_msg_types service, xmlNode *data, gboolean ordered)
 
int crm_remote_peer_cache_size (void)
 
void crm_remote_peer_cache_refresh (xmlNode *cib)
 Repopulate the remote peer cache based on CIB XML. More...
 
void crm_remote_peer_cache_add (const char *node_name)
 Add a node to the remote peer cache. More...
 
crm_node_tcrm_remote_peer_get (const char *node_name)
 Get a remote node peer cache entry, creating it if necessary. More...
 
void crm_remote_peer_cache_remove (const char *node_name)
 
crm_node_tcrm_get_peer_full (unsigned int id, const char *uname, int flags)
 
crm_node_tcrm_get_peer (unsigned int id, const char *uname)
 
guint crm_active_peers (void)
 
gboolean crm_is_peer_active (const crm_node_t *node)
 
guint reap_crm_member (uint32_t id, const char *name)
 Remove all peer cache entries matching a node ID and/or uname. More...
 
int crm_terminate_member (int nodeid, const char *uname, void *unused)
 
int crm_terminate_member_no_mainloop (int nodeid, const char *uname, int *connection)
 
const char * crm_peer_uuid (crm_node_t *node)
 
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)
 
enum crm_ais_msg_types text2msg_type (const char *text)
 
void crm_set_status_callback (void(*dispatch)(enum crm_status_type, crm_node_t *, const void *))
 Set a client function that will be called after peer status changes. More...
 
void crm_set_autoreap (gboolean autoreap)
 Tell the library whether to automatically reap lost nodes. More...
 
enum cluster_type_e get_cluster_type (void)
 
const char * name_for_cluster_type (enum cluster_type_e type)
 
gboolean is_corosync_cluster (void)
 
gboolean is_cman_cluster (void)
 
gboolean is_openais_cluster (void)
 
gboolean is_classic_ais_cluster (void)
 
gboolean is_heartbeat_cluster (void)
 
const char * get_local_node_name (void)
 
char * get_node_name (uint32_t nodeid)
 

Variables

gboolean crm_have_quorum
 
GHashTable * crm_peer_cache
 
GHashTable * crm_remote_peer_cache
 
unsigned long long crm_peer_seq
 

Macro Definition Documentation

#define CRM_NODE_ACTIVE   CRM_NODE_MEMBER

Definition at line 45 of file cluster.h.

#define CRM_NODE_EVICTED   "evicted"

Definition at line 46 of file cluster.h.

#define CRM_NODE_LOST   "lost"

Definition at line 43 of file cluster.h.

#define CRM_NODE_MEMBER   "member"

Definition at line 44 of file cluster.h.

#define CRM_SERVICE   PCMK_SERVICE_ID

Definition at line 39 of file cluster.h.

Typedef Documentation

typedef struct crm_cluster_s crm_cluster_t
typedef struct crm_peer_node_s crm_node_t

Enumeration Type Documentation

Enumerator
pcmk_cluster_unknown 
pcmk_cluster_invalid 
pcmk_cluster_heartbeat 
pcmk_cluster_classic_ais 
pcmk_cluster_corosync 
pcmk_cluster_cman 

Definition at line 210 of file cluster.h.

Enumerator
crm_class_cluster 
crm_class_members 
crm_class_notify 
crm_class_nodeid 
crm_class_rmpeer 
crm_class_quorum 

Definition at line 118 of file cluster.h.

Enumerator
crm_msg_none 
crm_msg_ais 
crm_msg_lrmd 
crm_msg_cib 
crm_msg_crmd 
crm_msg_attrd 
crm_msg_stonithd 
crm_msg_te 
crm_msg_pe 
crm_msg_stonith_ng 

Definition at line 128 of file cluster.h.

Enumerator
CRM_GET_PEER_CLUSTER 
CRM_GET_PEER_REMOTE 
CRM_GET_PEER_ANY 

Definition at line 142 of file cluster.h.

Enumerator
crm_join_nack 
crm_join_none 
crm_join_welcomed 
crm_join_integrated 
crm_join_finalized 
crm_join_confirmed 

Definition at line 48 of file cluster.h.

Enumerator
crm_remote_node 
crm_remote_container 
crm_remote_baremetal 
crm_node_dirty 

Definition at line 58 of file cluster.h.

Enumerator
crm_status_uname 
crm_status_nstate 
crm_status_processes 
crm_status_rstate 

Definition at line 198 of file cluster.h.

Function Documentation

guint crm_active_peers ( void  )

Definition at line 393 of file membership.c.

gboolean crm_cluster_connect ( crm_cluster_t cluster)

Definition at line 175 of file cluster.c.

void crm_cluster_disconnect ( crm_cluster_t cluster)

Definition at line 234 of file cluster.c.

crm_node_t* crm_get_peer ( unsigned int  id,
const char *  uname 
)

Definition at line 676 of file membership.c.

crm_node_t* crm_get_peer_full ( unsigned int  id,
const char *  uname,
int  flags 
)

Definition at line 521 of file membership.c.

gboolean crm_is_peer_active ( const crm_node_t node)

Definition at line 295 of file membership.c.

void crm_peer_destroy ( void  )

Definition at line 431 of file membership.c.

void crm_peer_init ( void  )

Definition at line 419 of file membership.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 375 of file cluster.c.

const char* crm_peer_uuid ( crm_node_t node)

Definition at line 135 of file cluster.c.

void crm_remote_peer_cache_add ( const char *  node_name)

Add a node to the remote peer cache.

Parameters
[in]node_nameName of remote node
Note
This is a legacy convenience wrapper for crm_remote_peer_get() for callers that don't need the cache entry returned.

Definition at line 137 of file membership.c.

void crm_remote_peer_cache_refresh ( xmlNode *  cib)

Repopulate the remote peer cache based on CIB XML.

Parameters
[in]xmlNodeCIB XML to parse

Definition at line 257 of file membership.c.

void crm_remote_peer_cache_remove ( const char *  node_name)

Definition at line 143 of file membership.c.

int crm_remote_peer_cache_size ( void  )

Definition at line 69 of file membership.c.

crm_node_t* crm_remote_peer_get ( const char *  node_name)

Get a remote node peer cache entry, creating it if necessary.

Parameters
[in]node_nameName of remote node
Returns
Cache entry for node on success, NULL (and set errno) otherwise
Note
When creating a new entry, this will leave the node state undetermined, so the caller should also call crm_update_peer_state() if the state is known.

Definition at line 89 of file membership.c.

void crm_set_autoreap ( gboolean  autoreap)

Tell the library whether to automatically reap lost nodes.

If TRUE (the default), calling crm_update_peer_proc() will also update the peer state to CRM_NODE_MEMBER or CRM_NODE_LOST, and crm_update_peer_state() will reap peers whose state changes to anything other than CRM_NODE_MEMBER. Callers should leave this enabled unless they plan to manage the cache separately on their own.

Parameters
[in]autoreapTRUE to enable automatic reaping, FALSE to disable

Definition at line 476 of file membership.c.

void crm_set_status_callback ( void(*)(enum crm_status_type, crm_node_t *, const void *)  dispatch)

Set a client function that will be called after peer status changes.

Parameters
[in]dispatchPointer to function to use as callback
Note
Previously, client callbacks were responsible for peer cache management. This is no longer the case, and client callbacks should do only client-specific handling. Callbacks MUST NOT add or remove entries in the peer caches.

Definition at line 459 of file membership.c.

int crm_terminate_member ( int  nodeid,
const char *  uname,
void *  unused 
)

Definition at line 1115 of file membership.c.

int crm_terminate_member_no_mainloop ( int  nodeid,
const char *  uname,
int *  connection 
)

Definition at line 1122 of file membership.c.

enum cluster_type_e get_cluster_type ( void  )

Definition at line 513 of file cluster.c.

const char* get_local_node_name ( void  )

Definition at line 289 of file cluster.c.

char* get_node_name ( uint32_t  nodeid)

Definition at line 301 of file cluster.c.

gboolean is_classic_ais_cluster ( void  )

Definition at line 624 of file cluster.c.

gboolean is_cman_cluster ( void  )

Definition at line 612 of file cluster.c.

gboolean is_corosync_cluster ( void  )

Definition at line 618 of file cluster.c.

gboolean is_heartbeat_cluster ( void  )

Definition at line 645 of file cluster.c.

gboolean is_openais_cluster ( void  )

Definition at line 630 of file cluster.c.

const char* name_for_cluster_type ( enum cluster_type_e  type)

Definition at line 468 of file cluster.c.

guint reap_crm_member ( uint32_t  id,
const char *  name 
)

Remove all peer cache entries matching a node ID and/or uname.

Parameters
[in]idID of node to remove (or 0 to ignore)
[in]nameUname of node to remove (or NULL to ignore)
Returns
Number of cache entries removed

Definition at line 352 of file membership.c.

gboolean send_cluster_message ( crm_node_t node,
enum crm_ais_msg_types  service,
xmlNode *  data,
gboolean  ordered 
)

Definition at line 271 of file cluster.c.

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

Definition at line 459 of file cluster.c.

enum crm_ais_msg_types text2msg_type ( const char *  text)

Definition at line 652 of file cpg.c.

Variable Documentation

gboolean crm_have_quorum

Definition at line 65 of file membership.c.

GHashTable* crm_peer_cache

Definition at line 44 of file membership.c.

unsigned long long crm_peer_seq

Definition at line 64 of file membership.c.

GHashTable* crm_remote_peer_cache

Definition at line 62 of file membership.c.