pacemaker  2.1.7-0f7f88312f
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/common/scheduler.h>
16 # include <crm/cib/cib_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, pcmk_resource_t *rsc,
210  const pcmk_node_t *node, GHashTable *overrides,
212 
241 int pcmk_simulate(xmlNodePtr *xml, pcmk_scheduler_t *scheduler,
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 
348 int pcmk_list_alternatives(xmlNodePtr *xml, const char *agent_spec);
349 
358 int pcmk_list_agents(xmlNodePtr *xml, char *agent_spec);
359 
368 int pcmk_list_providers(xmlNodePtr *xml, const char *agent_spec);
369 
377 int pcmk_list_standards(xmlNodePtr *xml);
378 
379 #ifdef BUILD_PUBLIC_LIBPACEMAKER
380 
402 int pcmk_request_fencing(stonith_t *st, const char *target, const char *action,
403  const char *name, unsigned int timeout,
404  unsigned int tolerance, int delay, char **reason);
405 
423 int pcmk_fence_history(xmlNodePtr *xml, stonith_t *st, const char *target,
424  unsigned int timeout, bool quiet, int verbose,
425  bool broadcast, bool cleanup);
426 
437 int pcmk_fence_installed(xmlNodePtr *xml, stonith_t *st, unsigned int timeout);
438 
449 int pcmk_fence_last(xmlNodePtr *xml, const char *target, bool as_nodeid);
450 
462 int pcmk_fence_list_targets(xmlNodePtr *xml, stonith_t *st,
463  const char *device_id, unsigned int timeout);
464 
479 int pcmk_fence_metadata(xmlNodePtr *xml, stonith_t *st, const char *agent,
480  unsigned int timeout);
481 
493 int pcmk_fence_registered(xmlNodePtr *xml, stonith_t *st, const char *target,
494  unsigned int timeout);
495 
508 int pcmk_fence_register_level(stonith_t *st, const char *target,
509  int fence_level,
510  const stonith_key_value_t *devices);
511 
523 int pcmk_fence_unregister_level(stonith_t *st, const char *target,
524  int fence_level);
525 
539 int pcmk_fence_validate(xmlNodePtr *xml, stonith_t *st, const char *agent,
540  const char *id, const stonith_key_value_t *params,
541  unsigned int timeout);
542 #endif
543 
544 #ifdef __cplusplus
545 }
546 #endif
547 
548 #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:26
(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:154
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
Implementation of pcmk_scheduler_t.
Definition: scheduler.h:172
const char * action
Definition: pcmk_fence.c:30
Scheduler API.
stonith_t * st
Definition: pcmk_fence.c:28
Implementation of pcmk_resource_t.
Definition: resources.h:399
unsigned int tolerance
Definition: pcmk_fence.c:33
Display result code description.
Definition: pacemaker.h:308
int pcmk_list_standards(xmlNodePtr *xml)
List all available resource agent standards.
Definition: pcmk_agents.c:228
GList * ticket_standby
Definition: pacemaker.h:72
int pcmk_simulate(xmlNodePtr *xml, pcmk_scheduler_t *scheduler, 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.
int pcmk_pacemakerd_status(xmlNodePtr *xml, const char *ipc_name, unsigned int message_timeout_ms)
Get and output pacemakerd status.
Implementation of pcmk_node_t.
Definition: nodes.h:130
void pcmk_free_injections(pcmk_injections_t *injections)
Free a :pcmk_injections_t structure.
int pcmk_list_providers(xmlNodePtr *xml, const char *agent_spec)
List all available OCF providers for the given agent.
Definition: pcmk_agents.c:177
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.
pcmk_scheduler_t * scheduler
int pcmk_list_alternatives(xmlNodePtr *xml, const char *agent_spec)
List available providers for the given OCF agent.
Definition: pcmk_agents.c:50
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
int pcmk_resource_digests(xmlNodePtr *xml, pcmk_resource_t *rsc, const pcmk_node_t *node, GHashTable *overrides, pcmk_scheduler_t *scheduler)
Calculate and output resource operation digests.
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_list_agents(xmlNodePtr *xml, char *agent_spec)
List all agents available for the named standard and/or provider.
Definition: pcmk_agents.c:121
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:349