This source file includes following definitions.
- crm_join_phase_str
1
2
3
4
5
6
7
8
9
10 #ifndef PCMK__CRM_CLUSTER__H
11 # define PCMK__CRM_CLUSTER__H
12
13 # include <stdint.h>
14 # include <glib.h>
15 # include <libxml/tree.h>
16 # include <crm/common/xml.h>
17 # include <crm/common/util.h>
18
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22
23 # if SUPPORT_COROSYNC
24 # include <corosync/cpg.h>
25 # endif
26
27 extern gboolean crm_have_quorum;
28 extern GHashTable *crm_peer_cache;
29 extern GHashTable *crm_remote_peer_cache;
30 extern unsigned long long crm_peer_seq;
31
32 #define CRM_NODE_LOST "lost"
33 #define CRM_NODE_MEMBER "member"
34
35 enum crm_join_phase {
36
37
38
39
40 crm_join_nack_quiet = -2,
41
42 crm_join_nack = -1,
43 crm_join_none = 0,
44 crm_join_welcomed = 1,
45 crm_join_integrated = 2,
46 crm_join_finalized = 3,
47 crm_join_confirmed = 4,
48 };
49
50 enum crm_node_flags {
51
52 crm_remote_node = 0x0001,
53
54
55 crm_node_dirty = 0x0010,
56 };
57
58 typedef struct crm_peer_node_s {
59 char *uname;
60 char *uuid;
61 char *state;
62 uint64_t flags;
63 uint64_t last_seen;
64 uint32_t processes;
65
66
67
68
69
70
71
72 uint32_t id;
73 time_t when_lost;
74
75
76 enum crm_join_phase join;
77 char *expected;
78
79 time_t peer_lost;
80 char *conn_host;
81
82 time_t when_member;
83 time_t when_online;
84 } crm_node_t;
85
86 void crm_peer_init(void);
87 void crm_peer_destroy(void);
88
89 typedef struct crm_cluster_s {
90 char *uuid;
91 char *uname;
92 uint32_t nodeid;
93
94 void (*destroy) (gpointer);
95
96 # if SUPPORT_COROSYNC
97
98
99
100
101 struct cpg_name group;
102 cpg_callbacks_t cpg;
103 cpg_handle_t cpg_handle;
104 # endif
105
106 } crm_cluster_t;
107
108 gboolean crm_cluster_connect(crm_cluster_t *cluster);
109 void crm_cluster_disconnect(crm_cluster_t *cluster);
110
111 crm_cluster_t *pcmk_cluster_new(void);
112 void pcmk_cluster_free(crm_cluster_t *cluster);
113
114 enum crm_ais_msg_class {
115 crm_class_cluster = 0,
116 };
117
118 enum crm_ais_msg_types {
119 crm_msg_none = 0,
120 crm_msg_ais = 1,
121 crm_msg_lrmd = 2,
122 crm_msg_cib = 3,
123 crm_msg_crmd = 4,
124 crm_msg_attrd = 5,
125 crm_msg_stonithd = 6,
126 crm_msg_te = 7,
127 crm_msg_pe = 8,
128 crm_msg_stonith_ng = 9,
129 };
130
131
132 enum crm_get_peer_flags {
133 CRM_GET_PEER_CLUSTER = 0x0001,
134 CRM_GET_PEER_REMOTE = 0x0002,
135 CRM_GET_PEER_ANY = CRM_GET_PEER_CLUSTER|CRM_GET_PEER_REMOTE,
136 };
137
138 gboolean send_cluster_message(const crm_node_t *node,
139 enum crm_ais_msg_types service,
140 const xmlNode *data, gboolean ordered);
141
142 int crm_remote_peer_cache_size(void);
143
144
145 void crm_remote_peer_cache_refresh(xmlNode *cib);
146 crm_node_t *crm_remote_peer_get(const char *node_name);
147 void crm_remote_peer_cache_remove(const char *node_name);
148
149
150 crm_node_t *crm_get_peer_full(unsigned int id, const char *uname, int flags);
151
152
153 crm_node_t *crm_get_peer(unsigned int id, const char *uname);
154
155 guint crm_active_peers(void);
156 gboolean crm_is_peer_active(const crm_node_t * node);
157 guint reap_crm_member(uint32_t id, const char *name);
158
159 # if SUPPORT_COROSYNC
160 uint32_t get_local_nodeid(cpg_handle_t handle);
161
162 gboolean cluster_connect_cpg(crm_cluster_t *cluster);
163 void cluster_disconnect_cpg(crm_cluster_t * cluster);
164
165 void pcmk_cpg_membership(cpg_handle_t handle,
166 const struct cpg_name *groupName,
167 const struct cpg_address *member_list, size_t member_list_entries,
168 const struct cpg_address *left_list, size_t left_list_entries,
169 const struct cpg_address *joined_list, size_t joined_list_entries);
170 gboolean crm_is_corosync_peer_active(const crm_node_t * node);
171 gboolean send_cluster_text(enum crm_ais_msg_class msg_class, const char *data,
172 gboolean local, const crm_node_t *node,
173 enum crm_ais_msg_types dest);
174 char *pcmk_message_common_cs(cpg_handle_t handle, uint32_t nodeid, uint32_t pid, void *msg,
175 uint32_t *kind, const char **from);
176 # endif
177
178 const char *crm_peer_uuid(crm_node_t *node);
179 const char *crm_peer_uname(const char *uuid);
180
181 enum crm_status_type {
182 crm_status_uname,
183 crm_status_nstate,
184 crm_status_processes,
185 };
186
187 enum crm_ais_msg_types text2msg_type(const char *text);
188 void crm_set_status_callback(void (*dispatch) (enum crm_status_type, crm_node_t *, const void *));
189 void crm_set_autoreap(gboolean autoreap);
190
191 enum cluster_type_e {
192 pcmk_cluster_unknown = 0x0001,
193 pcmk_cluster_invalid = 0x0002,
194
195
196 pcmk_cluster_corosync = 0x0020,
197
198 };
199
200 enum cluster_type_e get_cluster_type(void);
201 const char *name_for_cluster_type(enum cluster_type_e type);
202
203 gboolean is_corosync_cluster(void);
204
205 const char *get_local_node_name(void);
206 char *get_node_name(uint32_t nodeid);
207
208
209
210
211
212
213
214
215 static inline const char *
216 crm_join_phase_str(enum crm_join_phase phase)
217 {
218 switch (phase) {
219 case crm_join_nack_quiet: return "nack_quiet";
220 case crm_join_nack: return "nack";
221 case crm_join_none: return "none";
222 case crm_join_welcomed: return "welcomed";
223 case crm_join_integrated: return "integrated";
224 case crm_join_finalized: return "finalized";
225 case crm_join_confirmed: return "confirmed";
226 default: return "invalid";
227 }
228 }
229
230 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
231 #include <crm/cluster/compat.h>
232 #endif
233
234 #ifdef __cplusplus
235 }
236 #endif
237
238 #endif