pacemaker 2.1.4-dc6eb4362e
Scalable High-Availability cluster resource manager
pcmk_fence.c
Go to the documentation of this file.
1/*
2 * Copyright 2009-2022 the Pacemaker project contributors
3 *
4 * The version control history for this file may have further details.
5 *
6 * This source code is licensed under the GNU General Public License version 2
7 * or later (GPLv2+) WITHOUT ANY WARRANTY.
8 */
9
10#include <crm_internal.h>
11#include <crm/common/mainloop.h>
12#include <crm/common/results.h>
14#include <crm/stonith-ng.h>
16
17#include <glib.h>
18#include <libxml/tree.h>
19#include <pacemaker.h>
20#include <pacemaker-internal.h>
21
22static const int st_opts = st_opt_sync_call | st_opt_allow_suicide;
23
24static GMainLoop *mainloop = NULL;
25
26static struct {
28 const char *target;
29 const char *action;
30 char *name;
31 unsigned int timeout;
32 unsigned int tolerance;
33 int delay;
35} async_fence_data = { NULL, };
36
37static int
38handle_level(stonith_t *st, char *target, int fence_level,
39 stonith_key_value_t *devices, bool added) {
40 char *node = NULL;
41 char *pattern = NULL;
42 char *name = NULL;
43 char *value = NULL;
44 int rc = pcmk_rc_ok;
45
46 if (target == NULL) {
47 // Not really possible, but makes static analysis happy
48 return EINVAL;
49 }
50
51 /* Determine if targeting by attribute, node name pattern or node name */
52 value = strchr(target, '=');
53 if (value != NULL) {
54 name = target;
55 *value++ = '\0';
56 } else if (*target == '@') {
57 pattern = target + 1;
58 } else {
59 node = target;
60 }
61
62 /* Register or unregister level as appropriate */
63 if (added) {
64 rc = st->cmds->register_level_full(st, st_opts, node, pattern,
65 name, value, fence_level,
66 devices);
67 } else {
68 rc = st->cmds->remove_level_full(st, st_opts, node, pattern,
69 name, value, fence_level);
70 }
71
72 return pcmk_legacy2rc(rc);
73}
74
75static stonith_history_t *
76reduce_fence_history(stonith_history_t *history)
77{
78 stonith_history_t *new, *hp, *np;
79
80 if (!history) {
81 return history;
82 }
83
84 new = history;
85 hp = new->next;
86 new->next = NULL;
87
88 while (hp) {
89 stonith_history_t *hp_next = hp->next;
90
91 hp->next = NULL;
92
93 for (np = new; ; np = np->next) {
94 if ((hp->state == st_done) || (hp->state == st_failed)) {
95 /* action not in progress */
96 if (pcmk__str_eq(hp->target, np->target, pcmk__str_casei) &&
97 pcmk__str_eq(hp->action, np->action, pcmk__str_none) &&
98 (hp->state == np->state) &&
99 ((hp->state == st_done) ||
100 pcmk__str_eq(hp->delegate, np->delegate, pcmk__str_casei))) {
101 /* purge older hp */
103 break;
104 }
105 }
106
107 if (!np->next) {
108 np->next = hp;
109 break;
110 }
111 }
112 hp = hp_next;
113 }
114
115 return new;
116}
117
118static void
119notify_callback(stonith_t * st, stonith_event_t * e)
120{
121 if (pcmk__str_eq(async_fence_data.target, e->target, pcmk__str_casei)
122 && pcmk__str_eq(async_fence_data.action, e->action, pcmk__str_none)) {
123
124 pcmk__set_result(&async_fence_data.result,
128 g_main_loop_quit(mainloop);
129 }
130}
131
132static void
133fence_callback(stonith_t * stonith, stonith_callback_data_t * data)
134{
135 pcmk__set_result(&async_fence_data.result, stonith__exit_status(data),
138 g_main_loop_quit(mainloop);
139}
140
141static gboolean
142async_fence_helper(gpointer user_data)
143{
144 stonith_t *st = async_fence_data.st;
145 int call_id = 0;
146 int rc = stonith_api_connect_retry(st, async_fence_data.name, 10);
147
148 if (rc != pcmk_ok) {
149 g_main_loop_quit(mainloop);
150 pcmk__set_result(&async_fence_data.result, CRM_EX_ERROR,
152 return TRUE;
153 }
154
156
157 call_id = st->cmds->fence_with_delay(st,
159 async_fence_data.target,
160 async_fence_data.action,
161 async_fence_data.timeout/1000,
162 async_fence_data.tolerance/1000,
163 async_fence_data.delay);
164
165 if (call_id < 0) {
166 g_main_loop_quit(mainloop);
167 pcmk__set_result(&async_fence_data.result, CRM_EX_ERROR,
169 return TRUE;
170 }
171
173 call_id,
174 async_fence_data.timeout/1000,
175 st_opt_timeout_updates, NULL, "callback", fence_callback);
176
177 return TRUE;
178}
179
180int
181pcmk__request_fencing(stonith_t *st, const char *target, const char *action,
182 const char *name, unsigned int timeout,
183 unsigned int tolerance, int delay, char **reason)
184{
185 crm_trigger_t *trig;
186 int rc = pcmk_rc_ok;
187
188 async_fence_data.st = st;
189 async_fence_data.name = strdup(name);
190 async_fence_data.target = target;
191 async_fence_data.action = action;
192 async_fence_data.timeout = timeout;
193 async_fence_data.tolerance = tolerance;
194 async_fence_data.delay = delay;
195 pcmk__set_result(&async_fence_data.result, CRM_EX_ERROR, PCMK_EXEC_UNKNOWN,
196 NULL);
197
198 trig = mainloop_add_trigger(G_PRIORITY_HIGH, async_fence_helper, NULL);
200
201 mainloop = g_main_loop_new(NULL, FALSE);
202 g_main_loop_run(mainloop);
203
204 free(async_fence_data.name);
205
206 if (reason != NULL) {
207 // Give the caller ownership of the exit reason
208 *reason = async_fence_data.result.exit_reason;
209 async_fence_data.result.exit_reason = NULL;
210 }
211 rc = stonith__result2rc(&async_fence_data.result);
212 pcmk__reset_result(&async_fence_data.result);
213 return rc;
214}
215
216#ifdef BUILD_PUBLIC_LIBPACEMAKER
217int
218pcmk_request_fencing(stonith_t *st, const char *target, const char *action,
219 const char *name, unsigned int timeout,
220 unsigned int tolerance, int delay, char **reason)
221{
223 delay, reason);
224}
225#endif
226
227int
229 unsigned int timeout, int verbose, bool broadcast,
230 bool cleanup) {
231 stonith_history_t *history = NULL, *hp, *latest = NULL;
232 int rc = pcmk_rc_ok;
233 int opts = 0;
234
235 if (cleanup) {
236 out->info(out, "cleaning up fencing-history%s%s",
237 target ? " for node " : "", target ? target : "");
238 }
239 if (broadcast) {
240 out->info(out, "gather fencing-history from all nodes");
241 }
242
243 stonith__set_call_options(opts, target, st_opts);
244 if (cleanup) {
246 }
247 if (broadcast) {
249 }
250 rc = st->cmds->history(st, opts,
251 pcmk__str_eq(target, "*", pcmk__str_none)? NULL : target,
252 &history, timeout/1000);
253
254 if (cleanup) {
255 // Cleanup doesn't return a history list
256 stonith_history_free(history);
257 return pcmk_legacy2rc(rc);
258 }
259
260 out->begin_list(out, "event", "events", "Fencing history");
261
262 history = stonith__sort_history(history);
263 for (hp = history; hp; hp = hp->next) {
264 if (hp->state == st_done) {
265 latest = hp;
266 }
267
268 if (out->is_quiet(out) || !verbose) {
269 continue;
270 }
271
272 out->message(out, "stonith-event", hp, 1, stonith__later_succeeded(hp, history));
273 out->increment_list(out);
274 }
275
276 if (latest) {
277 if (out->is_quiet(out)) {
278 pcmk__formatted_printf(out, "%lld\n", (long long) latest->completed);
279 } else if (!verbose) { // already printed if verbose
280 out->message(out, "stonith-event", latest, 0, FALSE);
281 out->increment_list(out);
282 }
283 }
284
285 out->end_list(out);
286
287 stonith_history_free(history);
288 return pcmk_legacy2rc(rc);
289}
290
291#ifdef BUILD_PUBLIC_LIBPACEMAKER
292int
293pcmk_fence_history(xmlNodePtr *xml, stonith_t *st, char *target, unsigned int timeout,
294 bool quiet, int verbose, bool broadcast, bool cleanup) {
295 pcmk__output_t *out = NULL;
296 int rc = pcmk_rc_ok;
297
298 rc = pcmk__out_prologue(&out, xml);
299 if (rc != pcmk_rc_ok) {
300 return rc;
301 }
302
304
305 out->quiet = quiet;
306
307 rc = pcmk__fence_history(out, st, target, timeout, verbose, broadcast, cleanup);
308 pcmk__out_epilogue(out, xml, rc);
309 return rc;
310}
311#endif
312
313int
315 stonith_key_value_t *devices = NULL;
316 int rc = pcmk_rc_ok;
317
318 rc = st->cmds->list_agents(st, st_opt_sync_call, NULL, &devices, timeout/1000);
319 /* list_agents returns a negative error code or a positive number of agents. */
320 if (rc < 0) {
321 return pcmk_legacy2rc(rc);
322 }
323
324 out->begin_list(out, "fence device", "fence devices", "Installed fence devices");
325 for (stonith_key_value_t *dIter = devices; dIter; dIter = dIter->next) {
326 out->list_item(out, "device", "%s", dIter->value);
327 }
328 out->end_list(out);
329
330 stonith_key_value_freeall(devices, 1, 1);
331 return pcmk_rc_ok;
332}
333
334#ifdef BUILD_PUBLIC_LIBPACEMAKER
335int
336pcmk_fence_installed(xmlNodePtr *xml, stonith_t *st, unsigned int timeout) {
337 pcmk__output_t *out = NULL;
338 int rc = pcmk_rc_ok;
339
340 rc = pcmk__out_prologue(&out, xml);
341 if (rc != pcmk_rc_ok) {
342 return rc;
343 }
344
346
347 rc = pcmk__fence_installed(out, st, timeout);
348 pcmk__out_epilogue(out, xml, rc);
349 return rc;
350}
351#endif
352
353int
354pcmk__fence_last(pcmk__output_t *out, const char *target, bool as_nodeid) {
355 time_t when = 0;
356
357 if (target == NULL) {
358 return pcmk_rc_ok;
359 }
360
361 if (as_nodeid) {
362 when = stonith_api_time(atol(target), NULL, FALSE);
363 } else {
364 when = stonith_api_time(0, target, FALSE);
365 }
366
367 return out->message(out, "last-fenced", target, when);
368}
369
370#ifdef BUILD_PUBLIC_LIBPACEMAKER
371int
372pcmk_fence_last(xmlNodePtr *xml, const char *target, bool as_nodeid) {
373 pcmk__output_t *out = NULL;
374 int rc = pcmk_rc_ok;
375
376 rc = pcmk__out_prologue(&out, xml);
377 if (rc != pcmk_rc_ok) {
378 return rc;
379 }
380
382
383 rc = pcmk__fence_last(out, target, as_nodeid);
384 pcmk__out_epilogue(out, xml, rc);
385 return rc;
386}
387#endif
388
389int
391 const char *device_id, unsigned int timeout) {
392 GList *targets = NULL;
393 char *lists = NULL;
394 int rc = pcmk_rc_ok;
395
396 rc = st->cmds->list(st, st_opts, device_id, &lists, timeout/1000);
397 if (rc != pcmk_rc_ok) {
398 return pcmk_legacy2rc(rc);
399 }
400
401 targets = stonith__parse_targets(lists);
402
403 out->begin_list(out, "fence target", "fence targets", "Fence Targets");
404 while (targets != NULL) {
405 out->list_item(out, NULL, "%s", (const char *) targets->data);
406 targets = targets->next;
407 }
408 out->end_list(out);
409
410 free(lists);
411 return rc;
412}
413
414#ifdef BUILD_PUBLIC_LIBPACEMAKER
415int
416pcmk_fence_list_targets(xmlNodePtr *xml, stonith_t *st, const char *device_id,
417 unsigned int timeout) {
418 pcmk__output_t *out = NULL;
419 int rc = pcmk_rc_ok;
420
421 rc = pcmk__out_prologue(&out, xml);
422 if (rc != pcmk_rc_ok) {
423 return rc;
424 }
425
427
428 rc = pcmk__fence_list_targets(out, st, device_id, timeout);
429 pcmk__out_epilogue(out, xml, rc);
430 return rc;
431}
432#endif
433
434int
436 unsigned int timeout) {
437 char *buffer = NULL;
438 int rc = st->cmds->metadata(st, st_opt_sync_call, agent, NULL, &buffer,
439 timeout/1000);
440
441 if (rc != pcmk_rc_ok) {
442 return pcmk_legacy2rc(rc);
443 }
444
445 out->output_xml(out, "metadata", buffer);
446 free(buffer);
447 return rc;
448}
449
450#ifdef BUILD_PUBLIC_LIBPACEMAKER
451int
452pcmk_fence_metadata(xmlNodePtr *xml, stonith_t *st, char *agent,
453 unsigned int timeout) {
454 pcmk__output_t *out = NULL;
455 int rc = pcmk_rc_ok;
456
457 rc = pcmk__out_prologue(&out, xml);
458 if (rc != pcmk_rc_ok) {
459 return rc;
460 }
461
463
464 rc = pcmk__fence_metadata(out, st, agent, timeout);
465 pcmk__out_epilogue(out, xml, rc);
466 return rc;
467}
468#endif
469
470int
472 unsigned int timeout) {
473 stonith_key_value_t *devices = NULL;
474 int rc = pcmk_rc_ok;
475
476 rc = st->cmds->query(st, st_opts, target, &devices, timeout/1000);
477 /* query returns a negative error code or a positive number of results. */
478 if (rc < 0) {
479 return pcmk_legacy2rc(rc);
480 }
481
482 out->begin_list(out, "fence device", "fence devices", "Registered fence devices");
483 for (stonith_key_value_t *dIter = devices; dIter; dIter = dIter->next) {
484 out->list_item(out, "device", "%s", dIter->value);
485 }
486 out->end_list(out);
487
488 stonith_key_value_freeall(devices, 1, 1);
489
490 /* Return pcmk_rc_ok here, not the number of results. Callers probably
491 * don't care.
492 */
493 return pcmk_rc_ok;
494}
495
496#ifdef BUILD_PUBLIC_LIBPACEMAKER
497int
498pcmk_fence_registered(xmlNodePtr *xml, stonith_t *st, char *target,
499 unsigned int timeout) {
500 pcmk__output_t *out = NULL;
501 int rc = pcmk_rc_ok;
502
503 rc = pcmk__out_prologue(&out, xml);
504 if (rc != pcmk_rc_ok) {
505 return rc;
506 }
507
509
511 pcmk__out_epilogue(out, xml, rc);
512 return rc;
513}
514#endif
515
516int
518 stonith_key_value_t *devices) {
519 return handle_level(st, target, fence_level, devices, true);
520}
521
522#ifdef BUILD_PUBLIC_LIBPACEMAKER
523int
524pcmk_fence_register_level(stonith_t *st, char *target, int fence_level,
525 stonith_key_value_t *devices) {
526 return pcmk__fence_register_level(st, target, fence_level, devices);
527}
528#endif
529
530int
532 return handle_level(st, target, fence_level, NULL, false);
533}
534
535#ifdef BUILD_PUBLIC_LIBPACEMAKER
536int
537pcmk_fence_unregister_level(stonith_t *st, char *target, int fence_level) {
538 return pcmk__fence_unregister_level(st, target, fence_level);
539}
540#endif
541
542int
544 const char *id, stonith_key_value_t *params,
545 unsigned int timeout) {
546 char *output = NULL;
547 char *error_output = NULL;
548 int rc;
549
550 rc = st->cmds->validate(st, st_opt_sync_call, id, NULL, agent, params,
551 timeout/1000, &output, &error_output);
552 out->message(out, "validate", agent, id, output, error_output, rc);
553 return pcmk_legacy2rc(rc);
554}
555
556#ifdef BUILD_PUBLIC_LIBPACEMAKER
557int
558pcmk_fence_validate(xmlNodePtr *xml, stonith_t *st, const char *agent,
559 const char *id, stonith_key_value_t *params,
560 unsigned int timeout) {
561 pcmk__output_t *out = NULL;
562 int rc = pcmk_rc_ok;
563
564 rc = pcmk__out_prologue(&out, xml);
565 if (rc != pcmk_rc_ok) {
566 return rc;
567 }
568
570
571 rc = pcmk__fence_validate(out, st, agent, id, params, timeout);
572 pcmk__out_epilogue(out, xml, rc);
573 return rc;
574}
575#endif
576
577int
579 enum pcmk__fence_history fence_history)
580{
581 int rc = pcmk_rc_ok;
582
583 if (st == NULL) {
584 rc = ENOTCONN;
585 } else if (fence_history != pcmk__fence_history_none) {
586 rc = st->cmds->history(st, st_opt_sync_call, NULL, stonith_history, 120);
587
588 rc = pcmk_legacy2rc(rc);
589 if (rc != pcmk_rc_ok) {
590 return rc;
591 }
592
593 *stonith_history = stonith__sort_history(*stonith_history);
594 if (fence_history == pcmk__fence_history_reduced) {
595 *stonith_history = reduce_fence_history(*stonith_history);
596 }
597 }
598
599 return rc;
600}
char data[0]
Definition: cpg.c:10
const char * stonith__event_exit_reason(stonith_event_t *event)
Definition: st_client.c:2461
int stonith__exit_status(stonith_callback_data_t *data)
Definition: st_client.c:2370
GList * stonith__parse_targets(const char *hosts)
Definition: st_client.c:2150
gboolean stonith__later_succeeded(stonith_history_t *event, stonith_history_t *top_history)
Definition: st_client.c:2190
stonith_history_t * stonith__sort_history(stonith_history_t *history)
Definition: st_client.c:2221
#define stonith__set_call_options(st_call_opts, call_for, flags_to_set)
Definition: internal.h:35
int stonith__event_execution_status(stonith_event_t *event)
Definition: st_client.c:2441
int stonith__execution_status(stonith_callback_data_t *data)
Definition: st_client.c:2387
const char * stonith__exit_reason(stonith_callback_data_t *data)
Definition: st_client.c:2404
int stonith__result2rc(const pcmk__action_result_t *result)
Definition: st_actions.c:305
void stonith__register_messages(pcmk__output_t *out)
Definition: st_output.c:481
int stonith__event_exit_status(stonith_event_t *event)
Definition: st_client.c:2421
Wrappers for and extensions to glib mainloop.
void mainloop_set_trigger(crm_trigger_t *source)
Definition: mainloop.c:198
crm_trigger_t * mainloop_add_trigger(int priority, int(*dispatch)(gpointer user_data), gpointer userdata)
Create a trigger to be used as a mainloop source.
Definition: mainloop.c:186
struct trigger_s crm_trigger_t
Definition: mainloop.h:32
Formatted output for pacemaker tools.
void void void pcmk__formatted_printf(pcmk__output_t *out, const char *format,...) G_GNUC_PRINTF(2
High Level API.
int pcmk__fence_validate(pcmk__output_t *out, stonith_t *st, const char *agent, const char *id, stonith_key_value_t *params, unsigned int timeout)
Validate a STONITH device configuration.
Definition: pcmk_fence.c:543
int pcmk__fence_register_level(stonith_t *st, char *target, int fence_level, stonith_key_value_t *devices)
Register a fencing level for a specific node, node regex, or attribute.
Definition: pcmk_fence.c:517
int pcmk__request_fencing(stonith_t *st, const char *target, const char *action, const char *name, unsigned int timeout, unsigned int tolerance, int delay, char **reason)
Ask the cluster to perform fencing.
Definition: pcmk_fence.c:181
unsigned int timeout
Definition: pcmk_fence.c:31
int pcmk__get_fencing_history(stonith_t *st, stonith_history_t **stonith_history, enum pcmk__fence_history fence_history)
Fetch STONITH history, optionally reducing it.
Definition: pcmk_fence.c:578
char * name
Definition: pcmk_fence.c:30
int delay
Definition: pcmk_fence.c:33
unsigned int tolerance
Definition: pcmk_fence.c:32
int pcmk__fence_list_targets(pcmk__output_t *out, stonith_t *st, const char *device_id, unsigned int timeout)
List nodes that can be fenced.
Definition: pcmk_fence.c:390
int pcmk__fence_installed(pcmk__output_t *out, stonith_t *st, unsigned int timeout)
List all installed STONITH agents.
Definition: pcmk_fence.c:314
stonith_t * st
Definition: pcmk_fence.c:27
int pcmk__fence_registered(pcmk__output_t *out, stonith_t *st, char *target, unsigned int timeout)
List registered fence devices.
Definition: pcmk_fence.c:471
const char * action
Definition: pcmk_fence.c:29
int pcmk__fence_unregister_level(stonith_t *st, char *target, int fence_level)
Unregister a fencing level for a specific node, node regex, or attribute.
Definition: pcmk_fence.c:531
int pcmk__fence_history(pcmk__output_t *out, stonith_t *st, char *target, unsigned int timeout, int verbose, bool broadcast, bool cleanup)
List the fencing operations that have occurred for a specific node.
Definition: pcmk_fence.c:228
int pcmk__fence_last(pcmk__output_t *out, const char *target, bool as_nodeid)
When was a device last fenced?
Definition: pcmk_fence.c:354
pcmk__action_result_t result
Definition: pcmk_fence.c:34
int pcmk__fence_metadata(pcmk__output_t *out, stonith_t *st, char *agent, unsigned int timeout)
Get metadata for a resource.
Definition: pcmk_fence.c:435
const char * target
Definition: pcmk_fence.c:28
pcmk__fence_history
Control how much of the fencing history is output.
Definition: pcmki_fence.h:18
@ pcmk__fence_history_reduced
Definition: pcmki_fence.h:20
@ pcmk__fence_history_none
Definition: pcmki_fence.h:19
int pcmk__out_prologue(pcmk__output_t **out, xmlNodePtr *xml)
void pcmk__out_epilogue(pcmk__output_t *out, xmlNodePtr *xml, int retval)
Function and executable result codes.
const char * pcmk_strerror(int rc)
Definition: results.c:58
@ CRM_EX_ERROR
Unspecified error.
Definition: results.h:240
@ pcmk_rc_ok
Definition: results.h:146
#define pcmk_ok
Definition: results.h:68
@ PCMK_EXEC_ERROR
Execution failed, may be retried.
Definition: results.h:312
@ PCMK_EXEC_UNKNOWN
Used only to initialize variables.
Definition: results.h:306
@ PCMK_EXEC_NOT_CONNECTED
No connection to executor.
Definition: results.h:316
int pcmk_legacy2rc(int legacy_rc)
Definition: results.c:428
void pcmk__set_result(pcmk__action_result_t *result, int exit_status, enum pcmk_exec_status exec_status, const char *exit_reason)
Definition: results.c:814
void pcmk__reset_result(pcmk__action_result_t *result)
Definition: results.c:903
Fencing aka. STONITH.
time_t stonith_api_time(uint32_t nodeid, const char *uname, bool in_progress)
Definition: st_client.c:1947
#define T_STONITH_NOTIFY_FENCE
Definition: stonith-ng.h:36
void stonith_history_free(stonith_history_t *history)
Definition: st_client.c:737
@ st_opt_cleanup
Definition: stonith-ng.h:65
@ st_opt_timeout_updates
Definition: stonith-ng.h:61
@ st_opt_broadcast
Definition: stonith-ng.h:67
@ st_opt_allow_suicide
Definition: stonith-ng.h:50
@ st_opt_sync_call
Definition: stonith-ng.h:58
int stonith_api_connect_retry(stonith_t *st, const char *name, int max_attempts)
Make a blocking connection attempt to the fencer.
Definition: st_client.c:1840
void stonith_key_value_freeall(stonith_key_value_t *kvp, int keys, int values)
Definition: st_client.c:1884
@ st_failed
Definition: stonith-ng.h:77
@ st_done
Definition: stonith-ng.h:75
@ pcmk__str_none
@ pcmk__str_casei
This structure contains everything that makes up a single output formatter.
void(*) void(*) void(* increment_list)(pcmk__output_t *out)
void(* end_list)(pcmk__output_t *out)
int(* message)(pcmk__output_t *out, const char *message_id,...)
bool(* is_quiet)(pcmk__output_t *out)
int(*) void(*) void(* output_xml)(pcmk__output_t *out, const char *name, const char *buf)
void(*) void(* list_item)(pcmk__output_t *out, const char *name, const char *format,...) G_GNUC_PRINTF(3
void(* begin_list)(pcmk__output_t *out, const char *singular_noun, const char *plural_noun, const char *format,...) G_GNUC_PRINTF(4
bool quiet
Should this formatter supress most output?
int(* info)(pcmk__output_t *out, const char *format,...) G_GNUC_PRINTF(2
int(* fence_with_delay)(stonith_t *st, int options, const char *node, const char *action, int timeout, int tolerance, int delay)
Issue a fencing action against a node with requested fencing delay.
Definition: stonith-ng.h:424
int(* register_level_full)(stonith_t *st, int options, const char *node, const char *pattern, const char *attr, const char *value, int level, stonith_key_value_t *device_list)
Register fencing level for specified node, pattern or attribute.
Definition: stonith-ng.h:379
int(* metadata)(stonith_t *st, int options, const char *device, const char *provider, char **output, int timeout)
Get the metadata documentation for a resource.
Definition: stonith-ng.h:215
int(* register_notification)(stonith_t *st, const char *event, void(*notify)(stonith_t *st, stonith_event_t *e))
Definition: stonith-ng.h:298
int(* register_callback)(stonith_t *st, int call_id, int timeout, int options, void *userdata, const char *callback_name, void(*callback)(stonith_t *st, stonith_callback_data_t *data))
Register a callback to receive the result of an asynchronous call.
Definition: stonith-ng.h:327
int(* list_agents)(stonith_t *stonith, int call_options, const char *provider, stonith_key_value_t **devices, int timeout)
Retrieve a list of installed stonith agents.
Definition: stonith-ng.h:227
int(* list)(stonith_t *st, int options, const char *id, char **list_output, int timeout)
Retrieve string listing hosts and port assignments from a local stonith device.
Definition: stonith-ng.h:236
int(* query)(stonith_t *st, int options, const char *node, stonith_key_value_t **devices, int timeout)
Retrieve a list of registered stonith devices.
Definition: stonith-ng.h:262
int(* validate)(stonith_t *st, int call_options, const char *rsc_id, const char *namespace_s, const char *agent, stonith_key_value_t *params, int timeout, char **output, char **error_output)
Validate an arbitrary stonith device configuration.
Definition: stonith-ng.h:402
int(* remove_level_full)(stonith_t *st, int options, const char *node, const char *pattern, const char *attr, const char *value, int level)
Unregister fencing level for specified node, pattern or attribute.
Definition: stonith-ng.h:358
int(* history)(stonith_t *st, int options, const char *node, stonith_history_t **output, int timeout)
Retrieve a list of fencing operations that have occurred for a specific node.
Definition: stonith-ng.h:296
struct stonith_history_s * next
Definition: stonith-ng.h:112
struct stonith_key_value_s * next
Definition: stonith-ng.h:101
stonith_api_operations_t * cmds
Definition: stonith-ng.h:437