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 } crm_node_t;
82
83 void crm_peer_init(void);
84 void crm_peer_destroy(void);
85
86 typedef struct crm_cluster_s {
87 char *uuid;
88 char *uname;
89 uint32_t nodeid;
90
91 void (*destroy) (gpointer);
92
93 # if SUPPORT_COROSYNC
94
95
96
97
98 struct cpg_name group;
99 cpg_callbacks_t cpg;
100 cpg_handle_t cpg_handle;
101 # endif
102
103 } crm_cluster_t;
104
105 gboolean crm_cluster_connect(crm_cluster_t *cluster);
106 void crm_cluster_disconnect(crm_cluster_t *cluster);
107
108 crm_cluster_t *pcmk_cluster_new(void);
109 void pcmk_cluster_free(crm_cluster_t *cluster);
110
111 enum crm_ais_msg_class {
112 crm_class_cluster = 0,
113 };
114
115 enum crm_ais_msg_types {
116 crm_msg_none = 0,
117 crm_msg_ais = 1,
118 crm_msg_lrmd = 2,
119 crm_msg_cib = 3,
120 crm_msg_crmd = 4,
121 crm_msg_attrd = 5,
122 crm_msg_stonithd = 6,
123 crm_msg_te = 7,
124 crm_msg_pe = 8,
125 crm_msg_stonith_ng = 9,
126 };
127
128
129 enum crm_get_peer_flags {
130 CRM_GET_PEER_CLUSTER = 0x0001,
131 CRM_GET_PEER_REMOTE = 0x0002,
132 CRM_GET_PEER_ANY = CRM_GET_PEER_CLUSTER|CRM_GET_PEER_REMOTE,
133 };
134
135 gboolean send_cluster_message(const crm_node_t *node,
136 enum crm_ais_msg_types service, xmlNode *data,
137 gboolean ordered);
138
139 int crm_remote_peer_cache_size(void);
140
141
142 void crm_remote_peer_cache_refresh(xmlNode *cib);
143 crm_node_t *crm_remote_peer_get(const char *node_name);
144 void crm_remote_peer_cache_remove(const char *node_name);
145
146
147 crm_node_t *crm_get_peer_full(unsigned int id, const char *uname, int flags);
148
149
150 crm_node_t *crm_get_peer(unsigned int id, const char *uname);
151
152 guint crm_active_peers(void);
153 gboolean crm_is_peer_active(const crm_node_t * node);
154 guint reap_crm_member(uint32_t id, const char *name);
155
156 # if SUPPORT_COROSYNC
157 uint32_t get_local_nodeid(cpg_handle_t handle);
158
159 gboolean cluster_connect_cpg(crm_cluster_t *cluster);
160 void cluster_disconnect_cpg(crm_cluster_t * cluster);
161
162 void pcmk_cpg_membership(cpg_handle_t handle,
163 const struct cpg_name *groupName,
164 const struct cpg_address *member_list, size_t member_list_entries,
165 const struct cpg_address *left_list, size_t left_list_entries,
166 const struct cpg_address *joined_list, size_t joined_list_entries);
167 gboolean crm_is_corosync_peer_active(const crm_node_t * node);
168 gboolean send_cluster_text(enum crm_ais_msg_class msg_class, const char *data,
169 gboolean local, const crm_node_t *node,
170 enum crm_ais_msg_types dest);
171 char *pcmk_message_common_cs(cpg_handle_t handle, uint32_t nodeid, uint32_t pid, void *msg,
172 uint32_t *kind, const char **from);
173 # endif
174
175 const char *crm_peer_uuid(crm_node_t *node);
176 const char *crm_peer_uname(const char *uuid);
177 void set_uuid(xmlNode *xml, const char *attr, crm_node_t *node);
178
179 enum crm_status_type {
180 crm_status_uname,
181 crm_status_nstate,
182 crm_status_processes,
183 };
184
185 enum crm_ais_msg_types text2msg_type(const char *text);
186 void crm_set_status_callback(void (*dispatch) (enum crm_status_type, crm_node_t *, const void *));
187 void crm_set_autoreap(gboolean autoreap);
188
189 enum cluster_type_e {
190 pcmk_cluster_unknown = 0x0001,
191 pcmk_cluster_invalid = 0x0002,
192
193
194 pcmk_cluster_corosync = 0x0020,
195
196 };
197
198 enum cluster_type_e get_cluster_type(void);
199 const char *name_for_cluster_type(enum cluster_type_e type);
200
201 gboolean is_corosync_cluster(void);
202
203 const char *get_local_node_name(void);
204 char *get_node_name(uint32_t nodeid);
205
206
207
208
209
210
211
212
213 static inline const char *
214 crm_join_phase_str(enum crm_join_phase phase)
215 {
216 switch (phase) {
217 case crm_join_nack_quiet: return "nack_quiet";
218 case crm_join_nack: return "nack";
219 case crm_join_none: return "none";
220 case crm_join_welcomed: return "welcomed";
221 case crm_join_integrated: return "integrated";
222 case crm_join_finalized: return "finalized";
223 case crm_join_confirmed: return "confirmed";
224 default: return "invalid";
225 }
226 }
227
228 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
229 #include <crm/cluster/compat.h>
230 #endif
231
232 #ifdef __cplusplus
233 }
234 #endif
235
236 #endif