pacemaker  2.1.6-802a72226b
Scalable High-Availability cluster resource manager
pacemaker.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019-2023 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 
95 int pcmk_controller_status(xmlNodePtr *xml, const char *node_name,
96  unsigned int message_timeout_ms);
97 
110 int pcmk_designated_controller(xmlNodePtr *xml,
111  unsigned int message_timeout_ms);
112 
118 void pcmk_free_injections(pcmk_injections_t *injections);
119 
151 int pcmk_query_node_info(xmlNodePtr *xml, uint32_t *node_id, char **node_name,
152  char **uuid, char **state, bool *have_quorum,
153  bool *is_remote, bool show_output,
154  unsigned int message_timeout_ms);
155 
174 static inline int
175 pcmk_query_node_name(xmlNodePtr *xml, uint32_t node_id, char **node_name,
176  unsigned int message_timeout_ms)
177 {
178  return pcmk_query_node_info(xml, &node_id, node_name, NULL, NULL, NULL,
179  NULL, false, message_timeout_ms);
180 }
181 
195 int pcmk_pacemakerd_status(xmlNodePtr *xml, const char *ipc_name,
196  unsigned int message_timeout_ms);
197 
209 int pcmk_resource_digests(xmlNodePtr *xml, pe_resource_t *rsc,
210  const pe_node_t *node, GHashTable *overrides,
212 
241 int pcmk_simulate(xmlNodePtr *xml, pe_working_set_t *data_set,
242  const pcmk_injections_t *injections, unsigned int flags,
243  unsigned int section_opts, const char *use_date,
244  const char *input_file, const char *graph_file,
245  const char *dot_file);
246 
255 int pcmk_list_nodes(xmlNodePtr *xml, const char *node_types);
256 
264 int pcmk_status(xmlNodePtr *xml);
265 
278 int pcmk_check_rules(xmlNodePtr *xml, xmlNodePtr input, const crm_time_t *date,
279  const char **rule_ids);
280 
292 static inline int
293 pcmk_check_rule(xmlNodePtr *xml, xmlNodePtr input, const crm_time_t *date,
294  const char *rule_id)
295 {
296  const char *rule_ids[] = {rule_id, NULL};
297  return pcmk_check_rules(xml, input, date, rule_ids);
298 }
299 
306  pcmk_rc_disp_code = (1 << 0),
307  pcmk_rc_disp_name = (1 << 1),
308  pcmk_rc_disp_desc = (1 << 2),
309 };
310 
323 int pcmk_show_result_code(xmlNodePtr *xml, int code, enum pcmk_result_type type,
324  uint32_t flags);
325 
337 int pcmk_list_result_codes(xmlNodePtr *xml, enum pcmk_result_type type,
338  uint32_t flags);
339 
340 #ifdef BUILD_PUBLIC_LIBPACEMAKER
341 
363 int pcmk_request_fencing(stonith_t *st, const char *target, const char *action,
364  const char *name, unsigned int timeout,
365  unsigned int tolerance, int delay, char **reason);
366 
384 int pcmk_fence_history(xmlNodePtr *xml, stonith_t *st, const char *target,
385  unsigned int timeout, bool quiet, int verbose,
386  bool broadcast, bool cleanup);
387 
398 int pcmk_fence_installed(xmlNodePtr *xml, stonith_t *st, unsigned int timeout);
399 
410 int pcmk_fence_last(xmlNodePtr *xml, const char *target, bool as_nodeid);
411 
423 int pcmk_fence_list_targets(xmlNodePtr *xml, stonith_t *st,
424  const char *device_id, unsigned int timeout);
425 
440 int pcmk_fence_metadata(xmlNodePtr *xml, stonith_t *st, const char *agent,
441  unsigned int timeout);
442 
454 int pcmk_fence_registered(xmlNodePtr *xml, stonith_t *st, const char *target,
455  unsigned int timeout);
456 
469 int pcmk_fence_register_level(stonith_t *st, const char *target,
470  int fence_level,
471  const stonith_key_value_t *devices);
472 
484 int pcmk_fence_unregister_level(stonith_t *st, const char *target,
485  int fence_level);
486 
500 int pcmk_fence_validate(xmlNodePtr *xml, stonith_t *st, const char *agent,
501  const char *id, const stonith_key_value_t *params,
502  unsigned int timeout);
503 #endif
504 
505 #ifdef __cplusplus
506 }
507 #endif
508 
509 #endif
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:305
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.
int pcmk_query_node_info(xmlNodePtr *xml, uint32_t *node_id, char **node_name, char **uuid, char **state, bool *have_quorum, bool *is_remote, bool show_output, unsigned int message_timeout_ms)
Get and optionally output node info corresponding to a node ID from the controller.
GList * node_up
Definition: pacemaker.h:52
int pcmk_designated_controller(xmlNodePtr *xml, unsigned int message_timeout_ms)
Get and output designated controller node name.
int pcmk_status(xmlNodePtr *xml)
Output cluster status formatted like crm_mon --output-as=xml
Definition: pcmk_status.c:152
int pcmk_list_nodes(xmlNodePtr *xml, const char *node_types)
Get nodes list.
GList * ticket_grant
Definition: pacemaker.h:68
enum crm_ais_msg_types type
Definition: cpg.c:48
pcmk_rc_disp_flags
Bit flags to control which fields of result code info are displayed.
Definition: pacemaker.h:304
const char * action
Definition: pcmk_fence.c:30
int pcmk_simulate(xmlNodePtr *xml, pe_working_set_t *data_set, const pcmk_injections_t *injections, unsigned int flags, unsigned int section_opts, const char *use_date, const char *input_file, const char *graph_file, const char *dot_file)
Simulate a cluster&#39;s response to events.
stonith_t * st
Definition: pcmk_fence.c:28
unsigned int tolerance
Definition: pcmk_fence.c:33
Display result code description.
Definition: pacemaker.h:308
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.
void pcmk_free_injections(pcmk_injections_t *injections)
Free a :pcmk_injections_t structure.
const char * target
Definition: pcmk_fence.c:29
Display result code name.
Definition: pacemaker.h:307
GList * ticket_revoke
Definition: pacemaker.h:70
int pcmk_controller_status(xmlNodePtr *xml, const char *node_name, unsigned int message_timeout_ms)
Get and output controller status.
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:279
Fencing aka. STONITH.
GList * node_fail
Definition: pacemaker.h:56
Display result code number.
Definition: pacemaker.h:306
GList * op_fail
Definition: pacemaker.h:66
int pcmk_show_result_code(xmlNodePtr *xml, int code, enum pcmk_result_type type, uint32_t flags)
Display the name and/or description of a result code.
int pcmk_resource_digests(xmlNodePtr *xml, pe_resource_t *rsc, const pe_node_t *node, GHashTable *overrides, pe_working_set_t *data_set)
Calculate and output resource operation digests.
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:346