pacemaker  3.0.0-d8340737c4
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 
566 int pcmk_request_fencing(xmlNodePtr *xml, const char *target, const char *action,
567  const char *name, unsigned int timeout,
568  unsigned int tolerance, int delay, char **reason);
569 
586 int pcmk_fence_history(xmlNodePtr *xml, const char *target, unsigned int timeout,
587  bool quiet, int verbose, bool broadcast, bool cleanup);
588 
598 int pcmk_fence_installed(xmlNodePtr *xml, unsigned int timeout);
599 
610 int pcmk_fence_last(xmlNodePtr *xml, const char *target, bool as_nodeid);
611 
622 int pcmk_fence_list_targets(xmlNodePtr *xml, const char *device_id,
623  unsigned int timeout);
624 
638 int pcmk_fence_metadata(xmlNodePtr *xml, const char *agent, unsigned int timeout);
639 
650 int pcmk_fence_registered(xmlNodePtr *xml, const char *target, unsigned int timeout);
651 
665 int pcmk_fence_register_level(xmlNodePtr *xml, const char *target, int fence_level,
666  GList *devices);
667 
680 int pcmk_fence_unregister_level(xmlNodePtr *xml, const char *target, int fence_level);
681 
694 int pcmk_fence_validate(xmlNodePtr *xml, const char *agent, const char *id,
695  GHashTable *params, unsigned int timeout);
696 
697 #ifdef __cplusplus
698 }
699 #endif
700 
701 #endif
int pcmk_ticket_constraints(xmlNodePtr *xml, const char *ticket_id)
Return constraints that apply to the given ticket.
Definition: pcmk_ticket.c:145
int pcmk_fence_installed(xmlNodePtr *xml, unsigned int timeout)
List all installed fence agents.
Definition: pcmk_fence.c:378
GList * op_inject
Definition: pacemaker.h:61
int pcmk_fence_history(xmlNodePtr *xml, const char *target, unsigned int timeout, bool quiet, int verbose, bool broadcast, bool cleanup)
List the fencing operations that have occurred for a specific node.
Definition: pcmk_fence.c:330
int pcmk_fence_registered(xmlNodePtr *xml, const char *target, unsigned int timeout)
List registered fence devices.
Definition: pcmk_fence.c:545
int pcmk_list_result_codes(xmlNodePtr *xml, enum pcmk_result_type type, uint32_t flags)
List all valid result codes in a particular family.
int pcmk_fence_metadata(xmlNodePtr *xml, const char *agent, unsigned int timeout)
Get metadata for a fence agent.
Definition: pcmk_fence.c:497
const char * name
Definition: cib.c:26
enum pcmk_ipc_server type
Definition: cpg.c:51
(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:349
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:294
int pcmk_status(xmlNodePtr *xml)
Output cluster status formatted like crm_mon --output-as=xml
Definition: pcmk_status.c:139
int pcmk_list_nodes(xmlNodePtr *xml, const char *node_types)
Get nodes list.
GList * ticket_grant
Definition: pacemaker.h:68
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:125
const char * action
Definition: pcmk_fence.c:32
int pcmk_fence_unregister_level(xmlNodePtr *xml, const char *target, int fence_level)
Unregister a fencing topology level.
Definition: pcmk_fence.c:599
Scheduler API.
unsigned int tolerance
Definition: pcmk_fence.c:35
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:490
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:236
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:422
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.
int pcmk_fence_last(xmlNodePtr *xml, const char *target, bool as_nodeid)
When was a device last fenced?
Definition: pcmk_fence.c:416
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:31
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
int pcmk_fence_list_targets(xmlNodePtr *xml, const char *device_id, unsigned int timeout)
List nodes that can be fenced.
Definition: pcmk_fence.c:460
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_fence_register_level(xmlNodePtr *xml, const char *target, int fence_level, GList *devices)
Register a fencing topology level.
Definition: pcmk_fence.c:572
int pcmk_ticket_state(xmlNodePtr *xml, const char *ticket_id)
Return a ticket&#39;s state XML.
Definition: pcmk_ticket.c:539
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:36
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:195
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.
int pcmk_fence_validate(xmlNodePtr *xml, const char *agent, const char *id, GHashTable *params, unsigned int timeout)
Validate a fence device configuration.
Definition: pcmk_fence.c:633
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:34
int pcmk_request_fencing(xmlNodePtr *xml, const char *target, const char *action, const char *name, unsigned int timeout, unsigned int tolerance, int delay, char **reason)
Ask the cluster to perform fencing.
Definition: pcmk_fence.c:231
GList * node_down
Definition: pacemaker.h:54
uint64_t flags
Definition: remote.c:211
pcmk_result_type
Types of Pacemaker result codes.
Definition: results.h:340
int pcmk_resource_delete(xmlNodePtr *xml, const char *rsc_id, const char *rsc_type)
Remove a resource.