pacemaker  2.1.9-49aab99839
Scalable High-Availability cluster resource manager
pacemaker.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019-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__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 
210 int pcmk_resource_delete(xmlNodePtr *xml, const char *rsc_id, const char *rsc_type);
211 
222 int pcmk_resource_digests(xmlNodePtr *xml, pcmk_resource_t *rsc,
223  const pcmk_node_t *node, GHashTable *overrides);
224 
253 int pcmk_simulate(xmlNodePtr *xml, pcmk_scheduler_t *scheduler,
254  const pcmk_injections_t *injections, unsigned int flags,
255  unsigned int section_opts, const char *use_date,
256  const char *input_file, const char *graph_file,
257  const char *dot_file);
258 
273 int pcmk_verify(xmlNodePtr *xml, const char *cib_source);
274 
283 int pcmk_list_nodes(xmlNodePtr *xml, const char *node_types);
284 
292 int pcmk_status(xmlNodePtr *xml);
293 
306 int pcmk_check_rules(xmlNodePtr *xml, xmlNodePtr input, const crm_time_t *date,
307  const char **rule_ids);
308 
320 static inline int
321 pcmk_check_rule(xmlNodePtr *xml, xmlNodePtr input, const crm_time_t *date,
322  const char *rule_id)
323 {
324  const char *rule_ids[] = {rule_id, NULL};
325  return pcmk_check_rules(xml, input, date, rule_ids);
326 }
327 
334  pcmk_rc_disp_code = (1 << 0),
335  pcmk_rc_disp_name = (1 << 1),
336  pcmk_rc_disp_desc = (1 << 2),
337 };
338 
351 int pcmk_show_result_code(xmlNodePtr *xml, int code, enum pcmk_result_type type,
352  uint32_t flags);
353 
365 int pcmk_list_result_codes(xmlNodePtr *xml, enum pcmk_result_type type,
366  uint32_t flags);
367 
376 int pcmk_list_alternatives(xmlNodePtr *xml, const char *agent_spec);
377 
386 int pcmk_list_agents(xmlNodePtr *xml, char *agent_spec);
387 
396 int pcmk_list_providers(xmlNodePtr *xml, const char *agent_spec);
397 
405 int pcmk_list_standards(xmlNodePtr *xml);
406 
418 int pcmk_list_cluster_options(xmlNode **xml, bool all);
419 
433 int pcmk_list_fencing_params(xmlNode **xml, bool all);
434 
445 int pcmk_list_primitive_meta(xmlNode **xml, bool all);
446 
456 int pcmk_ticket_constraints(xmlNodePtr *xml, const char *ticket_id);
457 
458 
469 int pcmk_ticket_delete(xmlNodePtr *xml, const char *ticket_id, bool force);
470 
482 int pcmk_ticket_get_attr(xmlNodePtr *xml, const char *ticket_id,
483  const char *attr_name, const char *attr_default);
484 
494 int pcmk_ticket_info(xmlNodePtr *xml, const char *ticket_id);
495 
508 int pcmk_ticket_remove_attr(xmlNodePtr *xml, const char *ticket_id, GList *attr_delete,
509  bool force);
510 
528 int pcmk_ticket_set_attr(xmlNodePtr *xml, const char *ticket_id, GHashTable *attr_set,
529  bool force);
530 
543 int pcmk_ticket_state(xmlNodePtr *xml, const char *ticket_id);
544 
545 #ifdef BUILD_PUBLIC_LIBPACEMAKER
546 
568 int pcmk_request_fencing(stonith_t *st, const char *target, const char *action,
569  const char *name, unsigned int timeout,
570  unsigned int tolerance, int delay, char **reason);
571 
589 int pcmk_fence_history(xmlNodePtr *xml, stonith_t *st, const char *target,
590  unsigned int timeout, bool quiet, int verbose,
591  bool broadcast, bool cleanup);
592 
603 int pcmk_fence_installed(xmlNodePtr *xml, stonith_t *st, unsigned int timeout);
604 
615 int pcmk_fence_last(xmlNodePtr *xml, const char *target, bool as_nodeid);
616 
628 int pcmk_fence_list_targets(xmlNodePtr *xml, stonith_t *st,
629  const char *device_id, unsigned int timeout);
630 
645 int pcmk_fence_metadata(xmlNodePtr *xml, stonith_t *st, const char *agent,
646  unsigned int timeout);
647 
659 int pcmk_fence_registered(xmlNodePtr *xml, stonith_t *st, const char *target,
660  unsigned int timeout);
661 
674 int pcmk_fence_register_level(stonith_t *st, const char *target,
675  int fence_level,
676  const stonith_key_value_t *devices);
677 
689 int pcmk_fence_unregister_level(stonith_t *st, const char *target,
690  int fence_level);
691 
705 int pcmk_fence_validate(xmlNodePtr *xml, stonith_t *st, const char *agent,
706  const char *id, const stonith_key_value_t *params,
707  unsigned int timeout);
708 
709 #endif
710 
711 #ifdef __cplusplus
712 }
713 #endif
714 
715 #endif
int pcmk_ticket_constraints(xmlNodePtr *xml, const char *ticket_id)
Return constraints that apply to the given ticket.
Definition: pcmk_ticket.c:145
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:333
struct crm_time_s crm_time_t
Definition: iso8601.h:32
GList * ticket_activate
Definition: pacemaker.h:74
int pcmk_ticket_info(xmlNodePtr *xml, const char *ticket_id)
Return information about the given ticket.
Definition: pcmk_ticket.c:343
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_ticket_get_attr(xmlNodePtr *xml, const char *ticket_id, const char *attr_name, const char *attr_default)
Return the value of a ticket&#39;s attribute.
Definition: pcmk_ticket.c:291
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:51
pcmk_rc_disp_flags
Bit flags to control which fields of result code info are displayed.
Definition: pacemaker.h:332
int pcmk_list_primitive_meta(xmlNode **xml, bool all)
Definition: pcmk_options.c:137
int pcmk_verify(xmlNodePtr *xml, const char *cib_source)
Verify that a CIB is error-free or output errors and warnings.
Definition: pcmk_verify.c:119
const char * action
Definition: pcmk_fence.c:30
Scheduler API.
stonith_t * st
Definition: pcmk_fence.c:28
unsigned int tolerance
Definition: pcmk_fence.c:33
int pcmk_ticket_set_attr(xmlNodePtr *xml, const char *ticket_id, GHashTable *attr_set, bool force)
Set the given attribute(s) on a ticket.
Definition: pcmk_ticket.c:484
int pcmk_ticket_delete(xmlNodePtr *xml, const char *ticket_id, bool force)
Delete a ticket&#39;s state from the local cluster site.
Definition: pcmk_ticket.c:234
Display result code description.
Definition: pacemaker.h:336
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_ticket_remove_attr(xmlNodePtr *xml, const char *ticket_id, GList *attr_delete, bool force)
Remove the given attribute(s) from a ticket.
Definition: pcmk_ticket.c:416
int pcmk_list_cluster_options(xmlNode **xml, bool all)
List all available cluster options.
Definition: pcmk_options.c:48
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.
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
int pcmk_list_fencing_params(xmlNode **xml, bool all)
List common fencing resource parameters.
Definition: pcmk_options.c:97
Display result code name.
Definition: pacemaker.h:335
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_ticket_state(xmlNodePtr *xml, const char *ticket_id)
Return a ticket&#39;s state XML.
Definition: pcmk_ticket.c:533
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:198
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)
Calculate and output resource operation digests.
Display result code number.
Definition: pacemaker.h:334
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:360
int pcmk_resource_delete(xmlNodePtr *xml, const char *rsc_id, const char *rsc_type)
Remove a resource.