pacemaker 2.1.5-a3f44794f94
Scalable High-Availability cluster resource manager
pacemaker.h
Go to the documentation of this file.
1/*
2 * Copyright 2019-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 Lesser General Public License
7 * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
8 */
9
10#ifndef PCMK__PACEMAKER__H
11# define PCMK__PACEMAKER__H
12
13# include <glib.h>
14# include <libxml/tree.h>
15# include <crm/cib/cib_types.h>
16# include <crm/pengine/pe_types.h>
17
18# include <crm/stonith-ng.h>
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
44};
45
50typedef struct {
52 GList *node_up;
54 GList *node_down;
56 GList *node_fail;
61 GList *op_inject;
66 GList *op_fail;
76 char *watchdog;
78 char *quorum;
80
90int pcmk_controller_status(xmlNodePtr *xml, char *dest_node, unsigned int message_timeout_ms);
91
100int pcmk_designated_controller(xmlNodePtr *xml, unsigned int message_timeout_ms);
101
108
124int pcmk_pacemakerd_status(xmlNodePtr *xml, const char *ipc_name,
125 unsigned int message_timeout_ms);
126
138int pcmk_resource_digests(xmlNodePtr *xml, pe_resource_t *rsc,
139 pe_node_t *node, GHashTable *overrides,
141
171int pcmk_simulate(xmlNodePtr *xml, pe_working_set_t *data_set,
172 pcmk_injections_t *injections, unsigned int flags,
173 unsigned int section_opts, char *use_date, char *input_file,
174 char *graph_file, char *dot_file);
175
184int pcmk_list_nodes(xmlNodePtr *xml, char *node_types);
185
194int pcmk_status(xmlNodePtr *xml);
195
208int pcmk_check_rules(xmlNodePtr *xml, xmlNodePtr input, const crm_time_t *date,
209 const char **rule_ids);
210
222static inline int
223pcmk_check_rule(xmlNodePtr *xml, xmlNodePtr input, const crm_time_t *date,
224 const char *rule_id)
225{
226 const char *rule_ids[] = {rule_id, NULL};
227 return pcmk_check_rules(xml, input, date, rule_ids);
228}
229
230/*
231 * \enum pcmk_rc_disp_flags
232 * \brief Bit flags to control which fields of result code info are displayed
233 */
236 pcmk_rc_disp_code = (1 << 0),
237 pcmk_rc_disp_name = (1 << 1),
238 pcmk_rc_disp_desc = (1 << 2),
239};
240
241/*
242 * \brief Display the name and/or description of a result code
243 *
244 * \param[in,out] xml The destination for the result, as an XML tree
245 * \param[in] code The result code
246 * \param[in] type Interpret \c code as this type of result code.
247 * Supported values: \c pcmk_result_legacy,
248 * \c pcmk_result_rc, \c pcmk_result_exitcode.
249 * \param[in] flags Group of \c pcmk_rc_disp_flags
250 *
251 * \return Standard Pacemaker return code
252 */
253int pcmk_show_result_code(xmlNodePtr *xml, int code, enum pcmk_result_type type,
254 uint32_t flags);
255
267int pcmk_list_result_codes(xmlNodePtr *xml, enum pcmk_result_type type,
268 uint32_t flags);
269
270#ifdef BUILD_PUBLIC_LIBPACEMAKER
271
293int pcmk_request_fencing(stonith_t *st, const char *target, const char *action,
294 const char *name, unsigned int timeout,
295 unsigned int tolerance, int delay, char **reason);
296
314int pcmk_fence_history(xmlNodePtr *xml, stonith_t *st, char *target,
315 unsigned int timeout, bool quiet, int verbose,
316 bool broadcast, bool cleanup);
317
330int pcmk_fence_installed(xmlNodePtr *xml, stonith_t *st, unsigned int timeout);
331
344int pcmk_fence_last(xmlNodePtr *xml, const char *target, bool as_nodeid);
345
359int pcmk_fence_list_targets(xmlNodePtr *xml, stonith_t *st,
360 const char *device_id, unsigned int timeout);
361
375int pcmk_fence_metadata(xmlNodePtr *xml, stonith_t *st, char *agent,
376 unsigned int timeout);
377
392int pcmk_fence_registered(xmlNodePtr *xml, stonith_t *st, char *target,
393 unsigned int timeout);
394
410int pcmk_fence_register_level(stonith_t *st, char *target, int fence_level,
411 stonith_key_value_t *devices);
412
427int pcmk_fence_unregister_level(stonith_t *st, char *target, int fence_level);
428
444int pcmk_fence_validate(xmlNodePtr *xml, stonith_t *st, const char *agent,
445 const char *id, stonith_key_value_t *params,
446 unsigned int timeout);
447#endif
448
449#ifdef __cplusplus
450}
451#endif
452
453#endif
const char * name
Definition: cib.c:24
Data types for Cluster Information Base access.
uint64_t flags
Definition: remote.c:3
enum crm_ais_msg_types type
Definition: cpg.c:3
struct crm_time_s crm_time_t
Definition: iso8601.h:32
pe_working_set_t * data_set
xmlNode * input
int pcmk_list_nodes(xmlNodePtr *xml, char *node_types)
Get nodes list.
int pcmk_controller_status(xmlNodePtr *xml, char *dest_node, unsigned int message_timeout_ms)
Get controller status.
pcmk_sim_flags
Modify operation of running a cluster simulation.
Definition: pacemaker.h:34
@ pcmk_sim_none
Definition: pacemaker.h:35
@ pcmk_sim_verbose
Definition: pacemaker.h:43
@ pcmk_sim_sanitized
Definition: pacemaker.h:42
@ pcmk_sim_show_scores
Definition: pacemaker.h:39
@ pcmk_sim_simulate
Definition: pacemaker.h:41
@ pcmk_sim_process
Definition: pacemaker.h:38
@ pcmk_sim_show_pending
Definition: pacemaker.h:37
@ pcmk_sim_all_actions
Definition: pacemaker.h:36
@ pcmk_sim_show_utilization
Definition: pacemaker.h:40
int pcmk_list_result_codes(xmlNodePtr *xml, enum pcmk_result_type type, uint32_t flags)
List all valid result codes in a particular family.
void pcmk_free_injections(pcmk_injections_t *injections)
Free a :pcmk_injections_t structure.
int pcmk_designated_controller(xmlNodePtr *xml, unsigned int message_timeout_ms)
Get designated controller.
int pcmk_simulate(xmlNodePtr *xml, pe_working_set_t *data_set, pcmk_injections_t *injections, unsigned int flags, unsigned int section_opts, char *use_date, char *input_file, char *graph_file, char *dot_file)
Simulate a cluster's response to events.
pcmk_rc_disp_flags
Definition: pacemaker.h:234
@ pcmk_rc_disp_none
(Does nothing)
Definition: pacemaker.h:235
@ pcmk_rc_disp_code
Display result code number.
Definition: pacemaker.h:236
@ pcmk_rc_disp_name
Display result code name.
Definition: pacemaker.h:237
@ pcmk_rc_disp_desc
Display result code description.
Definition: pacemaker.h:238
int pcmk_pacemakerd_status(xmlNodePtr *xml, const char *ipc_name, unsigned int message_timeout_ms)
Get and output pacemakerd status.
int pcmk_show_result_code(xmlNodePtr *xml, int code, enum pcmk_result_type type, uint32_t flags)
int pcmk_check_rules(xmlNodePtr *xml, xmlNodePtr input, const crm_time_t *date, const char **rule_ids)
Check whether each rule in a list is in effect.
Definition: pcmk_rule.c:280
int pcmk_status(xmlNodePtr *xml)
Output the current status of the cluster, formatted in the same way that crm_mon --output-as=xml woul...
Definition: pcmk_status.c:170
int pcmk_resource_digests(xmlNodePtr *xml, pe_resource_t *rsc, pe_node_t *node, GHashTable *overrides, pe_working_set_t *data_set)
Calculate and output resource operation digests.
unsigned int timeout
Definition: pcmk_fence.c:32
int delay
Definition: pcmk_fence.c:34
unsigned int tolerance
Definition: pcmk_fence.c:33
stonith_t * st
Definition: pcmk_fence.c:28
const char * action
Definition: pcmk_fence.c:30
const char * target
Definition: pcmk_fence.c:29
Data types for cluster status.
pcmk_result_type
Types of Pacemaker result codes.
Definition: results.h:343
Fencing aka. STONITH.
Synthetic cluster events that can be injected into the cluster for running simulations.
Definition: pacemaker.h:50
GList * node_down
Definition: pacemaker.h:54
GList * ticket_activate
Definition: pacemaker.h:74
GList * ticket_grant
Definition: pacemaker.h:68
GList * ticket_revoke
Definition: pacemaker.h:70
GList * node_fail
Definition: pacemaker.h:56
GList * node_up
Definition: pacemaker.h:52
GList * op_inject
Definition: pacemaker.h:61
GList * op_fail
Definition: pacemaker.h:66
GList * ticket_standby
Definition: pacemaker.h:72