pacemaker  2.1.5-b7adf64e51
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
21 extern "C" {
22 #endif
23 
38  pcmk_sim_process = 1 << 2,
43  pcmk_sim_verbose = 1 << 7,
44 };
45 
50 typedef struct {
52  GList *node_up;
54  GList *node_down;
56  GList *node_fail;
61  GList *op_inject;
66  GList *op_fail;
68  GList *ticket_grant;
70  GList *ticket_revoke;
76  char *watchdog;
78  char *quorum;
80 
90 int pcmk_controller_status(xmlNodePtr *xml, char *dest_node, unsigned int message_timeout_ms);
91 
100 int pcmk_designated_controller(xmlNodePtr *xml, unsigned int message_timeout_ms);
101 
107 void pcmk_free_injections(pcmk_injections_t *injections);
108 
124 int pcmk_pacemakerd_status(xmlNodePtr *xml, const char *ipc_name,
125  unsigned int message_timeout_ms);
126 
138 int pcmk_resource_digests(xmlNodePtr *xml, pe_resource_t *rsc,
139  pe_node_t *node, GHashTable *overrides,
141 
171 int 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 
184 int pcmk_list_nodes(xmlNodePtr *xml, char *node_types);
185 
194 int pcmk_status(xmlNodePtr *xml);
195 
208 int pcmk_check_rules(xmlNodePtr *xml, xmlNodePtr input, const crm_time_t *date,
209  const char **rule_ids);
210 
222 static inline int
223 pcmk_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  */
253 int pcmk_show_result_code(xmlNodePtr *xml, int code, enum pcmk_result_type type,
254  uint32_t flags);
255 
267 int pcmk_list_result_codes(xmlNodePtr *xml, enum pcmk_result_type type,
268  uint32_t flags);
269 
270 #ifdef BUILD_PUBLIC_LIBPACEMAKER
271 
293 int 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 
314 int pcmk_fence_history(xmlNodePtr *xml, stonith_t *st, char *target,
315  unsigned int timeout, bool quiet, int verbose,
316  bool broadcast, bool cleanup);
317 
330 int pcmk_fence_installed(xmlNodePtr *xml, stonith_t *st, unsigned int timeout);
331 
344 int pcmk_fence_last(xmlNodePtr *xml, const char *target, bool as_nodeid);
345 
359 int pcmk_fence_list_targets(xmlNodePtr *xml, stonith_t *st,
360  const char *device_id, unsigned int timeout);
361 
375 int pcmk_fence_metadata(xmlNodePtr *xml, stonith_t *st, char *agent,
376  unsigned int timeout);
377 
392 int pcmk_fence_registered(xmlNodePtr *xml, stonith_t *st, char *target,
393  unsigned int timeout);
394 
410 int pcmk_fence_register_level(stonith_t *st, char *target, int fence_level,
411  stonith_key_value_t *devices);
412 
427 int pcmk_fence_unregister_level(stonith_t *st, char *target, int fence_level);
428 
444 int 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
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&#39;s response to events.
GList * op_inject
Definition: pacemaker.h:61
int pcmk_list_result_codes(xmlNodePtr *xml, enum pcmk_result_type type, uint32_t flags)
List all valid result codes in a particular family.
const char * name
Definition: cib.c:24
(Does nothing)
Definition: pacemaker.h:235
struct crm_time_s crm_time_t
Definition: iso8601.h:32
GList * ticket_activate
Definition: pacemaker.h:74
Data types for Cluster Information Base access.
GList * node_up
Definition: pacemaker.h:52
int pcmk_designated_controller(xmlNodePtr *xml, unsigned int message_timeout_ms)
Get designated controller.
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
GList * ticket_grant
Definition: pacemaker.h:68
enum crm_ais_msg_types type
Definition: cpg.c:48
pcmk_rc_disp_flags
Definition: pacemaker.h:234
const char * action
Definition: pcmk_fence.c:30
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.
stonith_t * st
Definition: pcmk_fence.c:28
unsigned int tolerance
Definition: pcmk_fence.c:33
Display result code description.
Definition: pacemaker.h:238
GList * ticket_standby
Definition: pacemaker.h:72
pe_working_set_t * data_set
int pcmk_pacemakerd_status(xmlNodePtr *xml, const char *ipc_name, unsigned int message_timeout_ms)
Get and output pacemakerd status.
int pcmk_list_nodes(xmlNodePtr *xml, char *node_types)
Get nodes list.
void pcmk_free_injections(pcmk_injections_t *injections)
Free a :pcmk_injections_t structure.
const char * target
Definition: pcmk_fence.c:29
int pcmk_controller_status(xmlNodePtr *xml, char *dest_node, unsigned int message_timeout_ms)
Get controller status.
Display result code name.
Definition: pacemaker.h:237
GList * ticket_revoke
Definition: pacemaker.h:70
xmlNode * input
int delay
Definition: pcmk_fence.c:34
Synthetic cluster events that can be injected into the cluster for running simulations.
Definition: pacemaker.h:50
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
Fencing aka. STONITH.
GList * node_fail
Definition: pacemaker.h:56
Display result code number.
Definition: pacemaker.h:236
GList * op_fail
Definition: pacemaker.h:66
int pcmk_show_result_code(xmlNodePtr *xml, int code, enum pcmk_result_type type, uint32_t flags)
Data types for cluster status.
pcmk_sim_flags
Modify operation of running a cluster simulation.
Definition: pacemaker.h:34
unsigned int timeout
Definition: pcmk_fence.c:32
GList * node_down
Definition: pacemaker.h:54
uint64_t flags
Definition: remote.c:215
pcmk_result_type
Types of Pacemaker result codes.
Definition: results.h:343