This source file includes following definitions.
- crm_get_cluster_proc
- pcmk__cs_err_str
1
2
3
4
5
6
7
8
9
10 #ifndef PCMK__CRM_CLUSTER_INTERNAL__H
11 # define PCMK__CRM_CLUSTER_INTERNAL__H
12
13 # include <stdbool.h>
14 # include <stdint.h>
15
16 # include <glib.h>
17
18 # include <crm/cluster.h>
19
20 enum crm_proc_flag {
21
22
23
24
25 crm_proc_none = 0x00000001,
26
27
28 crm_proc_cpg = 0x04000000,
29 };
30
31
32 enum pcmk__node_search_flags {
33
34 pcmk__node_search_none = 0,
35
36
37 pcmk__node_search_cluster_member = (1 << 0),
38
39
40 pcmk__node_search_remote = (1 << 1),
41
42
43 pcmk__node_search_any = pcmk__node_search_cluster_member
44 |pcmk__node_search_remote,
45
46
47
48
49
50
51 pcmk__node_search_cluster_cib = (1 << 2),
52 };
53
54
55
56
57
58
59
60 static inline uint32_t
61 crm_get_cluster_proc(void)
62 {
63 switch (pcmk_get_cluster_layer()) {
64 case pcmk_cluster_layer_corosync:
65 return crm_proc_cpg;
66
67 default:
68 break;
69 }
70 return crm_proc_none;
71 }
72
73
74
75
76
77
78
79
80
81 static inline const char *
82 pcmk__cs_err_str(int error)
83 {
84 # if SUPPORT_COROSYNC
85 switch (error) {
86 case CS_OK: return "OK";
87 case CS_ERR_LIBRARY: return "Library error";
88 case CS_ERR_VERSION: return "Version error";
89 case CS_ERR_INIT: return "Initialization error";
90 case CS_ERR_TIMEOUT: return "Timeout";
91 case CS_ERR_TRY_AGAIN: return "Try again";
92 case CS_ERR_INVALID_PARAM: return "Invalid parameter";
93 case CS_ERR_NO_MEMORY: return "No memory";
94 case CS_ERR_BAD_HANDLE: return "Bad handle";
95 case CS_ERR_BUSY: return "Busy";
96 case CS_ERR_ACCESS: return "Access error";
97 case CS_ERR_NOT_EXIST: return "Doesn't exist";
98 case CS_ERR_NAME_TOO_LONG: return "Name too long";
99 case CS_ERR_EXIST: return "Exists";
100 case CS_ERR_NO_SPACE: return "No space";
101 case CS_ERR_INTERRUPT: return "Interrupt";
102 case CS_ERR_NAME_NOT_FOUND: return "Name not found";
103 case CS_ERR_NO_RESOURCES: return "No resources";
104 case CS_ERR_NOT_SUPPORTED: return "Not supported";
105 case CS_ERR_BAD_OPERATION: return "Bad operation";
106 case CS_ERR_FAILED_OPERATION: return "Failed operation";
107 case CS_ERR_MESSAGE_ERROR: return "Message error";
108 case CS_ERR_QUEUE_FULL: return "Queue full";
109 case CS_ERR_QUEUE_NOT_AVAILABLE: return "Queue not available";
110 case CS_ERR_BAD_FLAGS: return "Bad flags";
111 case CS_ERR_TOO_BIG: return "Too big";
112 case CS_ERR_NO_SECTIONS: return "No sections";
113 }
114 # endif
115 return "Corosync error";
116 }
117
118 # if SUPPORT_COROSYNC
119
120 #if 0
121
122
123
124
125 #define pcmk__init_cmap(handle) cmap_initialize_map((handle), CMAP_MAP_ICMAP)
126 #else
127 #define pcmk__init_cmap(handle) cmap_initialize(handle)
128 #endif
129
130 char *pcmk__corosync_cluster_name(void);
131 bool pcmk__corosync_add_nodes(xmlNode *xml_parent);
132
133 void pcmk__cpg_confchg_cb(cpg_handle_t handle,
134 const struct cpg_name *group_name,
135 const struct cpg_address *member_list,
136 size_t member_list_entries,
137 const struct cpg_address *left_list,
138 size_t left_list_entries,
139 const struct cpg_address *joined_list,
140 size_t joined_list_entries);
141
142 char *pcmk__cpg_message_data(cpg_handle_t handle, uint32_t sender_id,
143 uint32_t pid, void *content, uint32_t *kind,
144 const char **from);
145
146 # endif
147
148 const char *pcmk__cluster_node_uuid(crm_node_t *node);
149 char *pcmk__cluster_node_name(uint32_t nodeid);
150 const char *pcmk__cluster_local_node_name(void);
151 const char *pcmk__node_name_from_uuid(const char *uuid);
152
153 crm_node_t *crm_update_peer_proc(const char *source, crm_node_t * peer,
154 uint32_t flag, const char *status);
155 crm_node_t *pcmk__update_peer_state(const char *source, crm_node_t *node,
156 const char *state, uint64_t membership);
157
158 void pcmk__update_peer_expected(const char *source, crm_node_t *node,
159 const char *expected);
160 void pcmk__reap_unseen_nodes(uint64_t ring_id);
161
162 void pcmk__corosync_quorum_connect(gboolean (*dispatch)(unsigned long long,
163 gboolean),
164 void (*destroy) (gpointer));
165
166 enum crm_ais_msg_types pcmk__cluster_parse_msg_type(const char *text);
167 bool pcmk__cluster_send_message(const crm_node_t *node,
168 enum crm_ais_msg_types service,
169 const xmlNode *data);
170
171
172
173 void pcmk__cluster_init_node_caches(void);
174 void pcmk__cluster_destroy_node_caches(void);
175
176 void pcmk__cluster_set_autoreap(bool enable);
177 void pcmk__cluster_set_status_callback(void (*dispatch)(enum crm_status_type,
178 crm_node_t *,
179 const void *));
180
181 bool pcmk__cluster_is_node_active(const crm_node_t *node);
182 unsigned int pcmk__cluster_num_active_nodes(void);
183 unsigned int pcmk__cluster_num_remote_nodes(void);
184
185 crm_node_t *pcmk__cluster_lookup_remote_node(const char *node_name);
186 void pcmk__cluster_forget_cluster_node(uint32_t id, const char *node_name);
187 void pcmk__cluster_forget_remote_node(const char *node_name);
188 crm_node_t *pcmk__search_node_caches(unsigned int id, const char *uname,
189 uint32_t flags);
190 void pcmk__purge_node_from_cache(const char *node_name, uint32_t node_id);
191
192 void pcmk__refresh_node_caches_from_cib(xmlNode *cib);
193
194 crm_node_t *pcmk__get_node(unsigned int id, const char *uname,
195 const char *uuid, uint32_t flags);
196
197 #endif