1 /*
2 * Copyright 2004-2024 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 Lesser General Public License
7 * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
8 */
9
10 #ifndef PCMK__CRM_STONITH_NG__H
11 # define PCMK__CRM_STONITH_NG__H
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16
17 /**
18 * \file
19 * \brief Fencing aka. STONITH
20 * \ingroup fencing
21 */
22
23 /* IMPORTANT: DLM source code includes this file directly, without having access
24 * to other Pacemaker headers on its include path, so this file should *not*
25 * include any other Pacemaker headers. (DLM might be updated to avoid the
26 * issue, but we should still follow this guideline for a long time after.)
27 */
28
29 # include <dlfcn.h>
30 # include <errno.h>
31 # include <stdbool.h> // bool
32 # include <stdint.h> // uint32_t
33 # include <time.h> // time_t
34
35 /* *INDENT-OFF* */
36 enum stonith_state {
37 stonith_connected_command,
38 stonith_connected_query,
39 stonith_disconnected,
40 };
41
42 enum stonith_call_options {
43 st_opt_none = 0x00000000,
44 st_opt_verbose = 0x00000001,
45 st_opt_allow_suicide = 0x00000002,
46
47 st_opt_manual_ack = 0x00000008,
48 st_opt_discard_reply = 0x00000010,
49 /* st_opt_all_replies = 0x00000020, */
50 st_opt_topology = 0x00000040,
51 st_opt_scope_local = 0x00000100,
52 st_opt_cs_nodeid = 0x00000200,
53 st_opt_sync_call = 0x00001000,
54 /*! Allow the timeout period for a callback to be adjusted
55 * based on the time the server reports the operation will take. */
56 st_opt_timeout_updates = 0x00002000,
57 /*! Only report back if operation is a success in callback */
58 st_opt_report_only_success = 0x00004000,
59 /* used where ever apropriate - e.g. cleanup of history */
60 st_opt_cleanup = 0x000080000,
61 /* used where ever apropriate - e.g. send out a history query to all nodes */
62 st_opt_broadcast = 0x000100000,
63 };
64
65 /*! Order matters here, do not change values */
66 enum op_state
67 {
68 st_query,
69 st_exec,
70 st_done,
71 st_duplicate,
72 st_failed,
73 };
74
75 // Supported fence agent interface standards
76 enum stonith_namespace {
77 st_namespace_invalid,
78 st_namespace_any,
79 st_namespace_internal, // Implemented internally by Pacemaker
80
81 /* Neither of these projects are active any longer, but the fence agent
82 * interfaces they created are still in use and supported by Pacemaker.
83 */
84 st_namespace_rhcs, // Red Hat Cluster Suite compatible
85 st_namespace_lha, // Linux-HA compatible
86 };
87
88 enum stonith_namespace stonith_text2namespace(const char *namespace_s);
89 const char *stonith_namespace2text(enum stonith_namespace st_namespace);
90 enum stonith_namespace stonith_get_namespace(const char *agent,
91 const char *namespace_s);
92
93 typedef struct stonith_key_value_s {
94 char *key;
95 char *value;
96 struct stonith_key_value_s *next;
97 } stonith_key_value_t;
98
99 typedef struct stonith_history_s {
100 char *target;
101 char *action;
102 char *origin;
103 char *delegate;
104 char *client;
105 int state;
106 time_t completed;
107 struct stonith_history_s *next;
108 long completed_nsec;
109 char *exit_reason;
110 } stonith_history_t;
111
112 typedef struct stonith_s stonith_t;
113
114 typedef struct stonith_event_s
115 {
116 char *id;
117 char *type; //!< \deprecated Will be removed in future release
118 char *message; //!< \deprecated Will be removed in future release
119 char *operation;
120
121 int result;
122 char *origin;
123 char *target;
124 char *action;
125 char *executioner;
126
127 char *device;
128
129 /*! The name of the client that initiated the action. */
130 char *client_origin;
131
132 //! \internal This field should be treated as internal to Pacemaker
133 void *opaque;
134 } stonith_event_t;
135
136 typedef struct stonith_callback_data_s {
137 int rc;
138 int call_id;
139 void *userdata;
140
141 //! \internal This field should be treated as internal to Pacemaker
142 void *opaque;
143 } stonith_callback_data_t;
144
145 typedef struct stonith_api_operations_s
146 {
147 /*!
148 * \brief Destroy a fencer connection
149 *
150 * \param[in,out] st Fencer connection to destroy
151 */
152 int (*free) (stonith_t *st);
153
154 /*!
155 * \brief Connect to the local fencer
156 *
157 * \param[in,out] st Fencer connection to connect
158 * \param[in] name Client name to use
159 * \param[out] stonith_fd If NULL, use a main loop, otherwise
160 * store IPC file descriptor here
161 *
162 * \return Legacy Pacemaker return code
163 */
164 int (*connect) (stonith_t *st, const char *name, int *stonith_fd);
165
166 /*!
167 * \brief Disconnect from the local stonith daemon.
168 *
169 * \param[in,out] st Fencer connection to disconnect
170 *
171 * \return Legacy Pacemaker return code
172 */
173 int (*disconnect)(stonith_t *st);
174
175 /*!
176 * \brief Unregister a fence device with the local fencer
177 *
178 * \param[in,out] st Fencer connection to disconnect
179 * \param[in] options Group of enum stonith_call_options
180 * \param[in] name ID of fence device to unregister
181 *
182 * \return pcmk_ok (if synchronous) or positive call ID (if asynchronous)
183 * on success, otherwise a negative legacy Pacemaker return code
184 */
185 int (*remove_device)(stonith_t *st, int options, const char *name);
186
187 /*!
188 * \brief Register a fence device with the local fencer
189 *
190 * \param[in,out] st Fencer connection to use
191 * \param[in] options Group of enum stonith_call_options
192 * \param[in] id ID of fence device to register
193 * \param[in] namespace_s Type of fence agent to search for ("redhat"
194 * or "stonith-ng" for RHCS-style, "internal"
195 * for Pacemaker-internal devices, "heartbeat"
196 * for LHA-style, or "any" or NULL for any)
197 * \param[in] agent Name of fence agent for device
198 * \param[in] params Fence agent parameters for device
199 *
200 * \return pcmk_ok (if synchronous) or positive call ID (if asynchronous)
201 * on success, otherwise a negative legacy Pacemaker return code
202 */
203 int (*register_device)(stonith_t *st, int options, const char *id,
204 const char *namespace_s, const char *agent,
205 const stonith_key_value_t *params);
206
207 /*!
208 * \brief Unregister a fencing level for specified node with local fencer
209 *
210 * \param[in,out] st Fencer connection to use
211 * \param[in] options Group of enum stonith_call_options
212 * \param[in] node Target node to unregister level for
213 * \param[in] level Topology level number to unregister
214 *
215 * \return pcmk_ok (if synchronous) or positive call ID (if asynchronous)
216 * on success, otherwise a negative legacy Pacemaker return code
217 */
218 int (*remove_level)(stonith_t *st, int options, const char *node,
219 int level);
220
221 /*!
222 * \brief Register a fencing level for specified node with local fencer
223 *
224 * \param[in,out] st Fencer connection to use
225 * \param[in] options Group of enum stonith_call_options
226 * \param[in] node Target node to register level for
227 * \param[in] level Topology level number to register
228 * \param[in] device_list Devices to register in level
229 *
230 * \return pcmk_ok (if synchronous) or positive call ID (if asynchronous)
231 * on success, otherwise a negative legacy Pacemaker return code
232 */
233 int (*register_level)(stonith_t *st, int options, const char *node,
234 int level, const stonith_key_value_t *device_list);
235
236 /*!
237 * \brief Retrieve a fence agent's metadata
238 *
239 * \param[in,out] stonith Fencer connection
240 * \param[in] call_options Group of enum stonith_call_options
241 * (currently ignored)
242 * \param[in] agent Fence agent to query
243 * \param[in] namespace_s Type of fence agent to search for ("redhat"
244 * or "stonith-ng" for RHCS-style, "internal"
245 * for Pacemaker-internal devices, "heartbeat"
246 * for LHA-style, or "any" or NULL for any)
247 * \param[out] output Where to store metadata
248 * \param[in] timeout_sec Error if not complete within this time
249 *
250 * \return Legacy Pacemaker return code
251 * \note The caller is responsible for freeing *output using free().
252 */
253 int (*metadata)(stonith_t *stonith, int call_options, const char *agent,
254 const char *namespace_s, char **output, int timeout_sec);
255
256 /*!
257 * \brief Retrieve a list of installed fence agents
258 *
259 * \param[in,out] stonith Fencer connection to use
260 * \param[in] call_options Group of enum stonith_call_options
261 * (currently ignored)
262 * \param[in] namespace_s Type of fence agents to list ("redhat"
263 * or "stonith-ng" for RHCS-style, "internal" for
264 * Pacemaker-internal devices, "heartbeat" for
265 * LHA-style, or "any" or NULL for all)
266 * \param[out] devices Where to store agent list
267 * \param[in] timeout Error if unable to complete within this
268 * (currently ignored)
269 *
270 * \return Number of items in list on success, or negative errno otherwise
271 * \note The caller is responsible for freeing the returned list with
272 * stonith_key_value_freeall().
273 */
274 int (*list_agents)(stonith_t *stonith, int call_options,
275 const char *namespace_s, stonith_key_value_t **devices,
276 int timeout);
277
278 /*!
279 * \brief Get the output of a fence device's list action
280 *
281 * \param[in,out] stonith Fencer connection to use
282 * \param[in] call_options Group of enum stonith_call_options
283 * \param[in] id Fence device ID to run list for
284 * \param[out] list_info Where to store list output
285 * \param[in] timeout Error if unable to complete within this
286 *
287 * \return pcmk_ok (if synchronous) or positive call ID (if asynchronous)
288 * on success, otherwise a negative legacy Pacemaker return code
289 */
290 int (*list)(stonith_t *stonith, int call_options, const char *id,
291 char **list_info, int timeout);
292
293 /*!
294 * \brief Check whether a fence device is reachable by monitor action
295 *
296 * \param[in,out] stonith Fencer connection to use
297 * \param[in] call_options Group of enum stonith_call_options
298 * \param[in] id Fence device ID to run monitor for
299 * \param[in] timeout Error if unable to complete within this
300 *
301 * \return pcmk_ok (if synchronous) or positive call ID (if asynchronous)
302 * on success, otherwise a negative legacy Pacemaker return code
303 */
304 int (*monitor)(stonith_t *stonith, int call_options, const char *id,
305 int timeout);
306
307 /*!
308 * \brief Check whether a fence device target is reachable by status action
309 *
310 * \param[in,out] stonith Fencer connection to use
311 * \param[in] call_options Group of enum stonith_call_options
312 * \param[in] id Fence device ID to run status for
313 * \param[in] port Fence target to run status for
314 * \param[in] timeout Error if unable to complete within this
315 *
316 * \return pcmk_ok (if synchronous) or positive call ID (if asynchronous)
317 * on success, otherwise a negative legacy Pacemaker return code
318 */
319 int (*status)(stonith_t *stonith, int call_options, const char *id,
320 const char *port, int timeout);
321
322 /*!
323 * \brief List registered fence devices
324 *
325 * \param[in,out] stonith Fencer connection to use
326 * \param[in] call_options Group of enum stonith_call_options
327 * \param[in] target Fence target to run status for
328 * \param[out] devices Where to store list of fence devices
329 * \param[in] timeout Error if unable to complete within this
330 *
331 * \note If node is provided, only devices that can fence the node id
332 * will be returned.
333 *
334 * \return Number of items in list on success, or negative errno otherwise
335 */
336 int (*query)(stonith_t *stonith, int call_options, const char *target,
337 stonith_key_value_t **devices, int timeout);
338
339 /*!
340 * \brief Request that a target get fenced
341 *
342 * \param[in,out] stonith Fencer connection to use
343 * \param[in] call_options Group of enum stonith_call_options
344 * \param[in] node Fence target
345 * \param[in] action "on", "off", or "reboot"
346 * \param[in] timeout Default per-device timeout to use with
347 * each executed device
348 * \param[in] tolerance Accept result of identical fence action
349 * completed within this time
350 *
351 * \return pcmk_ok (if synchronous) or positive call ID (if asynchronous)
352 * on success, otherwise a negative legacy Pacemaker return code
353 */
354 int (*fence)(stonith_t *stonith, int call_options, const char *node,
355 const char *action, int timeout, int tolerance);
356
357 /*!
358 * \brief Manually confirm that a node has been fenced
359 *
360 * \param[in,out] stonith Fencer connection to use
361 * \param[in] call_options Group of enum stonith_call_options
362 * \param[in] target Fence target
363 *
364 * \return pcmk_ok (if synchronous) or positive call ID (if asynchronous)
365 * on success, otherwise a negative legacy Pacemaker return code
366 */
367 int (*confirm)(stonith_t *stonith, int call_options, const char *target);
368
369 /*!
370 * \brief List fencing actions that have occurred for a target
371 *
372 * \param[in,out] stonith Fencer connection to use
373 * \param[in] call_options Group of enum stonith_call_options
374 * \param[in] node Fence target
375 * \param[out] history Where to store list of fencing actions
376 * \param[in] timeout Error if unable to complete within this
377 *
378 * \return Legacy Pacemaker return code
379 */
380 int (*history)(stonith_t *stonith, int call_options, const char *node,
381 stonith_history_t **history, int timeout);
382
383 /*!
384 * \brief Register a callback for fence notifications
385 *
386 * \param[in,out] stonith Fencer connection to use
387 * \param[in] event Event to register for
388 * \param[in] callback Callback to register
389 *
390 * \return Legacy Pacemaker return code
391 */
392 int (*register_notification)(stonith_t *stonith, const char *event,
393 void (*callback)(stonith_t *st,
394 stonith_event_t *e));
395
396 /*!
397 * \brief Unregister callbacks for fence notifications
398 *
399 * \param[in,out] stonith Fencer connection to use
400 * \param[in] event Event to unregister callbacks for (NULL for all)
401 *
402 * \return Legacy Pacemaker return code
403 */
404 int (*remove_notification)(stonith_t *stonith, const char *event);
405
406 /*!
407 * \brief Register a callback for an asynchronous fencing result
408 *
409 * \param[in,out] stonith Fencer connection to use
410 * \param[in] call_id Call ID to register callback for
411 * \param[in] timeout Error if result not received in this time
412 * \param[in] options Group of enum stonith_call_options
413 * (respects \c st_opt_timeout_updates and
414 * \c st_opt_report_only_success)
415 * \param[in,out] user_data Pointer to pass to callback
416 * \param[in] callback_name Unique identifier for callback
417 * \param[in] callback Callback to register (may be called
418 * immediately if \p call_id indicates error)
419 *
420 * \return \c TRUE on success, \c FALSE if call_id indicates error,
421 * or -EINVAL if \p stonith is not valid
422 */
423 int (*register_callback)(stonith_t *stonith, int call_id, int timeout,
424 int options, void *user_data,
425 const char *callback_name,
426 void (*callback)(stonith_t *st,
427 stonith_callback_data_t *data));
428
429 /*!
430 * \brief Unregister callbacks for asynchronous fencing results
431 *
432 * \param[in,out] stonith Fencer connection to use
433 * \param[in] call_id If \p all_callbacks is false, call ID
434 * to unregister callback for
435 * \param[in] all_callbacks If true, unregister all callbacks
436 *
437 * \return pcmk_ok
438 */
439 int (*remove_callback)(stonith_t *stonith, int call_id, bool all_callbacks);
440
441 /*!
442 * \brief Unregister fencing level for specified node, pattern or attribute
443 *
444 * \param[in,out] st Fencer connection to use
445 * \param[in] options Group of enum stonith_call_options
446 * \param[in] node If not NULL, unregister level targeting this node
447 * \param[in] pattern If not NULL, unregister level targeting nodes
448 * whose names match this regular expression
449 * \param[in] attr If this and \p value are not NULL, unregister
450 * level targeting nodes with this node attribute
451 * set to \p value
452 * \param[in] value If this and \p attr are not NULL, unregister
453 * level targeting nodes with node attribute \p attr
454 * set to this
455 * \param[in] level Topology level number to remove
456 *
457 * \return pcmk_ok (if synchronous) or positive call ID (if asynchronous)
458 * on success, otherwise a negative legacy Pacemaker return code
459 * \note The caller should set only one of \p node, \p pattern, or \p attr
460 * and \p value.
461 */
462 int (*remove_level_full)(stonith_t *st, int options,
463 const char *node, const char *pattern,
464 const char *attr, const char *value, int level);
465
466 /*!
467 * \brief Register fencing level for specified node, pattern or attribute
468 *
469 * \param[in,out] st Fencer connection to use
470 * \param[in] options Group of enum stonith_call_options
471 * \param[in] node If not NULL, register level targeting this
472 * node by name
473 * \param[in] pattern If not NULL, register level targeting nodes
474 * whose names match this regular expression
475 * \param[in] attr If this and \p value are not NULL, register
476 * level targeting nodes with this node
477 * attribute set to \p value
478 * \param[in] value If this and \p attr are not NULL, register
479 * level targeting nodes with node attribute
480 * \p attr set to this
481 * \param[in] level Topology level number to remove
482 * \param[in] device_list Devices to use in level
483 *
484 * \return pcmk_ok (if synchronous) or positive call ID (if asynchronous)
485 * on success, otherwise a negative legacy Pacemaker return code
486 *
487 * \note The caller should set only one of node, pattern or attr/value.
488 */
489 int (*register_level_full)(stonith_t *st, int options,
490 const char *node, const char *pattern,
491 const char *attr, const char *value, int level,
492 const stonith_key_value_t *device_list);
493
494 /*!
495 * \brief Validate an arbitrary stonith device configuration
496 *
497 * \param[in,out] st Fencer connection to use
498 * \param[in] call_options Group of enum stonith_call_options
499 * \param[in] rsc_id ID used to replace CIB secrets in \p params
500 * \param[in] namespace_s Type of fence agent to validate ("redhat"
501 * or "stonith-ng" for RHCS-style, "internal"
502 * for Pacemaker-internal devices, "heartbeat"
503 * for LHA-style, or "any" or NULL for any)
504 * \param[in] agent Fence agent to validate
505 * \param[in] params Configuration parameters to pass to agent
506 * \param[in] timeout Fail if no response within this many seconds
507 * \param[out] output If non-NULL, where to store any agent output
508 * \param[out] error_output If non-NULL, where to store agent error output
509 *
510 * \return pcmk_ok if validation succeeds, -errno otherwise
511 * \note If pcmk_ok is returned, the caller is responsible for freeing
512 * the output (if requested) with free().
513 */
514 int (*validate)(stonith_t *st, int call_options, const char *rsc_id,
515 const char *namespace_s, const char *agent,
516 const stonith_key_value_t *params, int timeout,
517 char **output, char **error_output);
518
519 /*!
520 * \brief Request delayed fencing of a target
521 *
522 * \param[in,out] stonith Fencer connection to use
523 * \param[in] call_options Group of enum stonith_call_options
524 * \param[in] node Fence target
525 * \param[in] action "on", "off", or "reboot"
526 * \param[in] timeout Default per-device timeout to use with
527 * each executed device
528 * \param[in] tolerance Accept result of identical fence action
529 * completed within this time
530 * \param[in] delay Execute fencing after this delay (-1
531 * disables any delay from pcmk_delay_base
532 * and pcmk_delay_max)
533 *
534 * \return pcmk_ok (if synchronous) or positive call ID (if asynchronous)
535 * on success, otherwise a negative legacy Pacemaker return code
536 */
537 int (*fence_with_delay)(stonith_t *stonith, int call_options,
538 const char *node, const char *action, int timeout,
539 int tolerance, int delay);
540
541 } stonith_api_operations_t;
542
543 struct stonith_s
544 {
545 enum stonith_state state;
546
547 int call_id;
548 int call_timeout; //!< \deprecated Unused
549 void *st_private;
550
551 stonith_api_operations_t *cmds;
552 };
553 /* *INDENT-ON* */
554
555 /* Core functions */
556 stonith_t *stonith_api_new(void);
557 void stonith_api_delete(stonith_t * st);
558
559 void stonith_dump_pending_callbacks(stonith_t * st);
560
561 bool stonith_dispatch(stonith_t * st);
562
563 stonith_key_value_t *stonith_key_value_add(stonith_key_value_t * kvp, const char *key,
564 const char *value);
565 void stonith_key_value_freeall(stonith_key_value_t * kvp, int keys, int values);
566
567 void stonith_history_free(stonith_history_t *history);
568
569 // Convenience functions
570 int stonith_api_connect_retry(stonith_t *st, const char *name,
571 int max_attempts);
572 const char *stonith_op_state_str(enum op_state state);
573
574 /* Basic helpers that allows nodes to be fenced and the history to be
575 * queried without mainloop or the caller understanding the full API
576 *
577 * At least one of nodeid and uname are required
578 *
579 * NOTE: DLM uses both of these
580 */
581 int stonith_api_kick(uint32_t nodeid, const char *uname, int timeout, bool off);
582 time_t stonith_api_time(uint32_t nodeid, const char *uname, bool in_progress);
583
584 /*
585 * Helpers for using the above functions without install-time dependencies
586 *
587 * Usage:
588 * #include <crm/stonith-ng.h>
589 *
590 * To turn a node off by corosync nodeid:
591 * stonith_api_kick_helper(nodeid, 120, 1);
592 *
593 * To check the last fence date/time (also by nodeid):
594 * last = stonith_api_time_helper(nodeid, 0);
595 *
596 * To check if fencing is in progress:
597 * if(stonith_api_time_helper(nodeid, 1) > 0) { ... }
598 *
599 * eg.
600
601 #include <stdio.h>
602 #include <time.h>
603 #include <crm/stonith-ng.h>
604 int
605 main(int argc, char ** argv)
606 {
607 int rc = 0;
608 int nodeid = 102;
609
610 rc = stonith_api_time_helper(nodeid, 0);
611 printf("%d last fenced at %s\n", nodeid, ctime(rc));
612
613 rc = stonith_api_kick_helper(nodeid, 120, 1);
614 printf("%d fence result: %d\n", nodeid, rc);
615
616 rc = stonith_api_time_helper(nodeid, 0);
617 printf("%d last fenced at %s\n", nodeid, ctime(rc));
618
619 return 0;
620 }
621
622 */
623
624 # define STONITH_LIBRARY "libstonithd.so.26"
625
626 typedef int (*st_api_kick_fn) (int nodeid, const char *uname, int timeout, bool off);
627 typedef time_t (*st_api_time_fn) (int nodeid, const char *uname, bool in_progress);
628
629 static inline int
630 stonith_api_kick_helper(uint32_t nodeid, int timeout, bool off)
/* ![[previous]](../icons/n_left.png)
![[next]](../icons/right.png)
![[first]](../icons/n_first.png)
![[last]](../icons/last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
631 {
632 static void *st_library = NULL;
633 static st_api_kick_fn st_kick_fn;
634
635 if (st_library == NULL) {
636 st_library = dlopen(STONITH_LIBRARY, RTLD_LAZY);
637 }
638 if (st_library && st_kick_fn == NULL) {
639 st_kick_fn = (st_api_kick_fn) dlsym(st_library, "stonith_api_kick");
640 }
641 if (st_kick_fn == NULL) {
642 #ifdef ELIBACC
643 return -ELIBACC;
644 #else
645 return -ENOSYS;
646 #endif
647 }
648
649 return (*st_kick_fn) (nodeid, NULL, timeout, off);
650 }
651
652 static inline time_t
653 stonith_api_time_helper(uint32_t nodeid, bool in_progress)
/* ![[previous]](../icons/left.png)
![[next]](../icons/n_right.png)
![[first]](../icons/first.png)
![[last]](../icons/n_last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
654 {
655 static void *st_library = NULL;
656 static st_api_time_fn st_time_fn;
657
658 if (st_library == NULL) {
659 st_library = dlopen(STONITH_LIBRARY, RTLD_LAZY);
660 }
661 if (st_library && st_time_fn == NULL) {
662 st_time_fn = (st_api_time_fn) dlsym(st_library, "stonith_api_time");
663 }
664 if (st_time_fn == NULL) {
665 return 0;
666 }
667
668 return (*st_time_fn) (nodeid, NULL, in_progress);
669 }
670
671 /**
672 * Does the given agent describe a stonith resource that can exist?
673 *
674 * \param[in] agent What is the name of the agent?
675 * \param[in] timeout Timeout to use when querying. If 0 is given,
676 * use a default of 120.
677 *
678 * \return A boolean
679 */
680 bool stonith_agent_exists(const char *agent, int timeout);
681
682 /*!
683 * \brief Turn fence action into a more readable string
684 *
685 * \param[in] action Fence action
686 */
687 const char *stonith_action_str(const char *action);
688
689 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
690 /* Normally we'd put this section in a separate file (crm/fencing/compat.h), but
691 * we can't do that for the reason noted at the top of this file. That does mean
692 * we have to duplicate these declarations where they're implemented.
693 */
694
695 //! \deprecated Do not use
696 #define T_STONITH_NOTIFY_DISCONNECT "st_notify_disconnect"
697
698 //! \deprecated Do not use
699 #define T_STONITH_NOTIFY_FENCE "st_notify_fence"
700
701 //! \deprecated Do not use
702 #define T_STONITH_NOTIFY_HISTORY "st_notify_history"
703
704 //! \deprecated Do not use
705 #define T_STONITH_NOTIFY_HISTORY_SYNCED "st_notify_history_synced"
706
707 //! \deprecated Use stonith_get_namespace() instead
708 const char *get_stonith_provider(const char *agent, const char *provider);
709
710 #endif
711
712 #ifdef __cplusplus
713 }
714 #endif
715
716 #endif