This source file includes following definitions.
- fenced_set_protocol_error
1
2
3
4
5
6
7
8 #include <stdint.h>
9 #include <crm/common/mainloop.h>
10
11
12
13
14
15
16
17
18
19
20
21
22 gboolean stonith_check_fence_tolerance(int tolerance, const char *target, const char *action);
23
24 typedef struct stonith_device_s {
25 char *id;
26 char *agent;
27 char *namespace;
28
29
30 char *on_target_actions;
31 GList *targets;
32 time_t targets_age;
33 gboolean has_attr_map;
34
35 gboolean include_nodeid;
36
37 gboolean automatic_unfencing;
38 guint priority;
39
40 uint32_t flags;
41
42 GHashTable *params;
43 GHashTable *aliases;
44 GList *pending_ops;
45 mainloop_timer_t *timer;
46 crm_trigger_t *work;
47 xmlNode *agent_metadata;
48
49
50
51 gboolean verified;
52
53 gboolean cib_registered;
54 gboolean api_registered;
55 gboolean dirty;
56 } stonith_device_t;
57
58
59
60
61
62
63 enum st_remap_phase {
64 st_phase_requested = 0,
65 st_phase_off = 1,
66 st_phase_on = 2,
67 st_phase_max = 3
68 };
69
70 typedef struct remote_fencing_op_s {
71
72 char *id;
73
74 char *target;
75
76 char *action;
77
78
79 time_t created;
80
81
82 gboolean notify_sent;
83
84 guint replies;
85
86 guint replies_expected;
87
88 gboolean owner;
89
90 guint op_timer_total;
91
92
93 guint op_timer_one;
94
95
96 guint query_timer;
97
98
99 gint base_timeout;
100
101
102
103 gint total_timeout;
104
105
106
107 int delay;
108
109
110
111
112
113 char *delegate;
114
115 time_t completed;
116
117 uint32_t call_options;
118
119
120
121 enum op_state state;
122
123 char *originator;
124
125 char *client_id;
126
127 int client_callid;
128
129 char *client_name;
130
131 GList *query_results;
132
133 xmlNode *request;
134
135
136 guint level;
137
138 enum st_remap_phase phase;
139
140
141 GList *automatic_list;
142
143 GList *devices_list;
144
145 GList *devices;
146
147
148
149 GList *duplicates;
150
151
152 long long completed_nsec;
153
154
155 pcmk__action_result_t result;
156 } remote_fencing_op_t;
157
158 void fenced_broadcast_op_result(remote_fencing_op_t *op, bool op_merged);
159
160
161 enum st_client_flags {
162 st_callback_unknown = UINT64_C(0),
163 st_callback_notify_fence = (UINT64_C(1) << 0),
164 st_callback_device_add = (UINT64_C(1) << 2),
165 st_callback_device_del = (UINT64_C(1) << 4),
166 st_callback_notify_history = (UINT64_C(1) << 5),
167 st_callback_notify_history_synced = (UINT64_C(1) << 6)
168 };
169
170
171 enum fenced_target_by {
172 fenced_target_by_unknown = -1,
173 fenced_target_by_name,
174 fenced_target_by_pattern,
175 fenced_target_by_attribute,
176 };
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192 typedef struct stonith_topology_s {
193 enum fenced_target_by kind;
194
195
196 char *target;
197 char *target_value;
198 char *target_pattern;
199 char *target_attribute;
200
201
202 GList *levels[ST_LEVEL_MAX];
203
204 } stonith_topology_t;
205
206 void init_device_list(void);
207 void free_device_list(void);
208 void init_topology_list(void);
209 void free_topology_list(void);
210 void free_stonith_remote_op_list(void);
211 void init_stonith_remote_op_hash_table(GHashTable **table);
212 void free_metadata_cache(void);
213 void fenced_unregister_handlers(void);
214
215 uint64_t get_stonith_flag(const char *name);
216
217 void stonith_command(pcmk__client_t *client, uint32_t id, uint32_t flags,
218 xmlNode *op_request, const char *remote_peer);
219
220 int stonith_device_register(xmlNode * msg, const char **desc, gboolean from_cib);
221
222 void stonith_device_remove(const char *id, bool from_cib);
223
224 char *stonith_level_key(xmlNode * msg, int mode);
225 void fenced_register_level(xmlNode *msg, char **desc,
226 pcmk__action_result_t *result);
227 void fenced_unregister_level(xmlNode *msg, char **desc,
228 pcmk__action_result_t *result);
229
230 stonith_topology_t *find_topology_for_host(const char *host);
231
232 void do_local_reply(xmlNode *notify_src, pcmk__client_t *client,
233 int call_options);
234
235 xmlNode *fenced_construct_reply(xmlNode *request, xmlNode *data,
236 pcmk__action_result_t *result);
237
238 void
239 do_stonith_async_timeout_update(const char *client, const char *call_id, int timeout);
240
241 void fenced_send_notification(const char *type,
242 const pcmk__action_result_t *result,
243 xmlNode *data);
244 void fenced_send_device_notification(const char *op,
245 const pcmk__action_result_t *result,
246 const char *desc);
247 void fenced_send_level_notification(const char *op,
248 const pcmk__action_result_t *result,
249 const char *desc);
250
251 remote_fencing_op_t *initiate_remote_stonith_op(pcmk__client_t *client,
252 xmlNode *request,
253 gboolean manual_ack);
254
255 void fenced_process_fencing_reply(xmlNode *msg);
256
257 int process_remote_stonith_query(xmlNode * msg);
258
259 void *create_remote_stonith_op(const char *client, xmlNode * request, gboolean peer);
260
261 void stonith_fence_history(xmlNode *msg, xmlNode **output,
262 const char *remote_peer, int options);
263
264 void stonith_fence_history_trim(void);
265
266 bool fencing_peer_active(crm_node_t *peer);
267
268 void set_fencing_completed(remote_fencing_op_t * op);
269
270 int fenced_handle_manual_confirmation(pcmk__client_t *client, xmlNode *msg);
271
272 gboolean node_has_attr(const char *node, const char *name, const char *value);
273
274 gboolean node_does_watchdog_fencing(const char *node);
275
276 static inline void
277 fenced_set_protocol_error(pcmk__action_result_t *result)
278 {
279 pcmk__set_result(result, CRM_EX_PROTOCOL, PCMK_EXEC_INVALID,
280 "Fencer API request missing required information (bug?)");
281 }
282
283 extern char *stonith_our_uname;
284 extern gboolean stand_alone;
285 extern GHashTable *device_list;
286 extern GHashTable *topology;
287 extern long stonith_watchdog_timeout_ms;
288 extern GList *stonith_watchdog_targets;
289
290 extern GHashTable *stonith_remote_op_list;