pacemaker
2.1.9-49aab99839
Scalable High-Availability cluster resource manager
|
High Level API. More...
#include <glib.h>
#include <libxml/tree.h>
#include <crm/common/scheduler.h>
#include <crm/cib/cib_types.h>
#include <crm/stonith-ng.h>
Go to the source code of this file.
Data Structures | |
struct | pcmk_injections_t |
Synthetic cluster events that can be injected into the cluster for running simulations. More... | |
Enumerations | |
enum | pcmk_sim_flags { pcmk_sim_none = 0, pcmk_sim_all_actions = 1 << 0, pcmk_sim_show_pending = 1 << 1, pcmk_sim_process = 1 << 2, pcmk_sim_show_scores = 1 << 3, pcmk_sim_show_utilization = 1 << 4, pcmk_sim_simulate = 1 << 5, pcmk_sim_sanitized = 1 << 6, pcmk_sim_verbose = 1 << 7 } |
Modify operation of running a cluster simulation. More... | |
enum | pcmk_rc_disp_flags { pcmk_rc_disp_none = 0, pcmk_rc_disp_code = (1 << 0), pcmk_rc_disp_name = (1 << 1), pcmk_rc_disp_desc = (1 << 2) } |
Bit flags to control which fields of result code info are displayed. More... | |
Functions | |
int | pcmk_controller_status (xmlNodePtr *xml, const char *node_name, unsigned int message_timeout_ms) |
Get and output controller status. More... | |
int | pcmk_designated_controller (xmlNodePtr *xml, unsigned int message_timeout_ms) |
Get and output designated controller node name. More... | |
void | pcmk_free_injections (pcmk_injections_t *injections) |
Free a :pcmk_injections_t structure. More... | |
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. More... | |
int | pcmk_pacemakerd_status (xmlNodePtr *xml, const char *ipc_name, unsigned int message_timeout_ms) |
Get and output pacemakerd status. More... | |
int | pcmk_resource_delete (xmlNodePtr *xml, const char *rsc_id, const char *rsc_type) |
Remove a resource. More... | |
int | pcmk_resource_digests (xmlNodePtr *xml, pcmk_resource_t *rsc, const pcmk_node_t *node, GHashTable *overrides) |
Calculate and output resource operation digests. More... | |
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's response to events. More... | |
int | pcmk_verify (xmlNodePtr *xml, const char *cib_source) |
Verify that a CIB is error-free or output errors and warnings. More... | |
int | pcmk_list_nodes (xmlNodePtr *xml, const char *node_types) |
Get nodes list. More... | |
int | pcmk_status (xmlNodePtr *xml) |
Output cluster status formatted like crm_mon --output-as=xml More... | |
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. More... | |
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. More... | |
int | pcmk_list_result_codes (xmlNodePtr *xml, enum pcmk_result_type type, uint32_t flags) |
List all valid result codes in a particular family. More... | |
int | pcmk_list_alternatives (xmlNodePtr *xml, const char *agent_spec) |
List available providers for the given OCF agent. More... | |
int | pcmk_list_agents (xmlNodePtr *xml, char *agent_spec) |
List all agents available for the named standard and/or provider. More... | |
int | pcmk_list_providers (xmlNodePtr *xml, const char *agent_spec) |
List all available OCF providers for the given agent. More... | |
int | pcmk_list_standards (xmlNodePtr *xml) |
List all available resource agent standards. More... | |
int | pcmk_list_cluster_options (xmlNode **xml, bool all) |
List all available cluster options. More... | |
int | pcmk_list_fencing_params (xmlNode **xml, bool all) |
List common fencing resource parameters. More... | |
int | pcmk_list_primitive_meta (xmlNode **xml, bool all) |
int | pcmk_ticket_constraints (xmlNodePtr *xml, const char *ticket_id) |
Return constraints that apply to the given ticket. More... | |
int | pcmk_ticket_delete (xmlNodePtr *xml, const char *ticket_id, bool force) |
Delete a ticket's state from the local cluster site. More... | |
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's attribute. More... | |
int | pcmk_ticket_info (xmlNodePtr *xml, const char *ticket_id) |
Return information about the given ticket. More... | |
int | pcmk_ticket_remove_attr (xmlNodePtr *xml, const char *ticket_id, GList *attr_delete, bool force) |
Remove the given attribute(s) from a ticket. More... | |
int | pcmk_ticket_set_attr (xmlNodePtr *xml, const char *ticket_id, GHashTable *attr_set, bool force) |
Set the given attribute(s) on a ticket. More... | |
int | pcmk_ticket_state (xmlNodePtr *xml, const char *ticket_id) |
Return a ticket's state XML. More... | |
High Level API.
Definition in file pacemaker.h.
enum pcmk_rc_disp_flags |
Bit flags to control which fields of result code info are displayed.
Enumerator | |
---|---|
pcmk_rc_disp_none | (Does nothing) |
pcmk_rc_disp_code | Display result code number. |
pcmk_rc_disp_name | Display result code name. |
pcmk_rc_disp_desc | Display result code description. |
Definition at line 332 of file pacemaker.h.
enum pcmk_sim_flags |
Modify operation of running a cluster simulation.
Enumerator | |
---|---|
pcmk_sim_none | |
pcmk_sim_all_actions | |
pcmk_sim_show_pending | |
pcmk_sim_process | |
pcmk_sim_show_scores | |
pcmk_sim_show_utilization | |
pcmk_sim_simulate | |
pcmk_sim_sanitized | |
pcmk_sim_verbose |
Definition at line 34 of file pacemaker.h.
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.
[in,out] | xml | The destination for the result, as an XML tree |
[in] | input | The CIB XML to check (if NULL , use current CIB) |
[in] | date | Check whether the rule is in effect at this date and time (if NULL , use current date and time) |
[in] | rule_ids | The IDs of the rules to check, as a NULL - terminated list. |
Definition at line 198 of file pcmk_rule.c.
int pcmk_controller_status | ( | xmlNodePtr * | xml, |
const char * | node_name, | ||
unsigned int | message_timeout_ms | ||
) |
Get and output controller status.
[in,out] | xml | Destination for the result, as an XML tree |
[in] | node_name | Name of node whose status is desired (NULL for DC) |
[in] | message_timeout_ms | How long to wait for a reply from the pacemaker-controld API. If 0, pcmk_ipc_dispatch_sync will be used. Otherwise, pcmk_ipc_dispatch_poll will be used. |
Definition at line 497 of file pcmk_cluster_queries.c.
int pcmk_designated_controller | ( | xmlNodePtr * | xml, |
unsigned int | message_timeout_ms | ||
) |
Get and output designated controller node name.
[in,out] | xml | Destination for the result, as an XML tree |
[in] | message_timeout_ms | How long to wait for a reply from the pacemaker-controld API. If 0, pcmk_ipc_dispatch_sync will be used. Otherwise, pcmk_ipc_dispatch_poll will be used. |
Definition at line 566 of file pcmk_cluster_queries.c.
void pcmk_free_injections | ( | pcmk_injections_t * | injections | ) |
Free a :pcmk_injections_t structure.
[in,out] | injections | The structure to be freed |
Definition at line 768 of file pcmk_injections.c.
int pcmk_list_agents | ( | xmlNodePtr * | xml, |
char * | agent_spec | ||
) |
List all agents available for the named standard and/or provider.
[in,out] | xml | The destination for the result, as an XML tree |
[in] | agent_spec | STD[:PROV] |
Definition at line 121 of file pcmk_agents.c.
int pcmk_list_alternatives | ( | xmlNodePtr * | xml, |
const char * | agent_spec | ||
) |
List available providers for the given OCF agent.
[in,out] | xml | The destination for the result, as an XML tree |
[in] | agent_spec | Resource agent name |
Definition at line 50 of file pcmk_agents.c.
int pcmk_list_cluster_options | ( | xmlNode ** | xml, |
bool | all | ||
) |
List all available cluster options.
These are options that affect the entire cluster.
[in,out] | xml | The destination for the result, as an XML tree |
[in] | all | If true , include advanced and deprecated options (currently always treated as true) |
Definition at line 48 of file pcmk_options.c.
int pcmk_list_fencing_params | ( | xmlNode ** | xml, |
bool | all | ||
) |
List common fencing resource parameters.
These are parameters that are available for all fencing resources, regardless of type. They are processed by Pacemaker, rather than by the fence agent or the fencing library.
[in,out] | xml | The destination for the result, as an XML tree |
[in] | all | If true , include advanced and deprecated options (currently always treated as true) |
Definition at line 97 of file pcmk_options.c.
int pcmk_list_nodes | ( | xmlNodePtr * | xml, |
const char * | node_types | ||
) |
Get nodes list.
[in,out] | xml | The destination for the result, as an XML tree |
[in] | node_types | Node type(s) to return (default: all) |
Definition at line 887 of file pcmk_cluster_queries.c.
int pcmk_list_primitive_meta | ( | xmlNode ** | xml, |
bool | all | ||
) |
Definition at line 137 of file pcmk_options.c.
int pcmk_list_providers | ( | xmlNodePtr * | xml, |
const char * | agent_spec | ||
) |
List all available OCF providers for the given agent.
[in,out] | xml | The destination for the result, as an XML tree |
[in] | agent_spec | Resource agent name |
Definition at line 177 of file pcmk_agents.c.
int pcmk_list_result_codes | ( | xmlNodePtr * | xml, |
enum pcmk_result_type | type, | ||
uint32_t | flags | ||
) |
List all valid result codes in a particular family.
[in,out] | xml | The destination for the result, as an XML tree |
[in] | type | The family of result codes to list. Supported values: pcmk_result_legacy , pcmk_result_rc , pcmk_result_exitcode . |
[in] | flags | Group of pcmk_rc_disp_flags |
Definition at line 151 of file pcmk_result_code.c.
int pcmk_list_standards | ( | xmlNodePtr * | xml | ) |
List all available resource agent standards.
[in,out] | xml | The destination for the result, as an XML tree |
Definition at line 228 of file pcmk_agents.c.
int pcmk_pacemakerd_status | ( | xmlNodePtr * | xml, |
const char * | ipc_name, | ||
unsigned int | message_timeout_ms | ||
) |
Get and output pacemakerd
status.
[in,out] | xml | Destination for the result, as an XML tree |
[in] | ipc_name | IPC name for request |
[in] | message_timeout_ms | How long to wait for a reply from the pacemakerd API. If 0, pcmk_ipc_dispatch_sync will be used. Otherwise, pcmk_ipc_dispatch_poll will be used. |
Definition at line 785 of file pcmk_cluster_queries.c.
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.
[in,out] | xml | Destination for the result, as an XML tree |
[in,out] | node_id | ID of node whose name to get. If NULL or 0, get the local node name. If not NULL , store the true node ID here on success. |
[out] | node_name | If not NULL , where to store the node name |
[out] | uuid | If not NULL , where to store the node UUID |
[out] | state | If not NULL , where to store the membership state |
[out] | is_remote | If not NULL , where to store whether the node is a Pacemaker Remote node |
[out] | have_quorum | If not NULL , where to store whether the node has quorum |
[in] | show_output | Whether to output the node info |
[in] | message_timeout_ms | How long to wait for a reply from the pacemaker-controld API. If 0, pcmk_ipc_dispatch_sync will be used. Otherwise, pcmk_ipc_dispatch_poll will be used. |
*node_name
, *uuid
, and *state
using free()
. Definition at line 689 of file pcmk_cluster_queries.c.
int pcmk_resource_delete | ( | xmlNodePtr * | xml, |
const char * | rsc_id, | ||
const char * | rsc_type | ||
) |
Remove a resource.
[in,out] | xml | Destination for the result, as an XML tree |
[in] | rsc_id | Resource to remove |
[in] | rsc_type | Type of the resource ("primitive", "group", etc.) |
pcmk_rc_ok
if rsc_id
doesn't exist or if rsc_type
is incorrect for rsc_id
(deleting something that doesn't exist always succeeds). Definition at line 148 of file pcmk_resource.c.
int pcmk_resource_digests | ( | xmlNodePtr * | xml, |
pcmk_resource_t * | rsc, | ||
const pcmk_node_t * | node, | ||
GHashTable * | overrides | ||
) |
Calculate and output resource operation digests.
[out] | xml | Where to store XML with result |
[in,out] | rsc | Resource to calculate digests for |
[in] | node | Node whose operation history should be used |
[in] | overrides | Hash table of configuration parameters to override |
Definition at line 236 of file pcmk_resource.c.
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.
[in,out] | xml | The destination for the result, as an XML tree |
[in] | code | The result code |
[in] | type | Interpret code as this type of result code. Supported values: pcmk_result_legacy , pcmk_result_rc , pcmk_result_exitcode . |
[in] | flags | Group of pcmk_rc_disp_flags |
Definition at line 62 of file pcmk_result_code.c.
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's response to events.
This high-level function essentially implements crm_simulate(8). It operates on an input CIB file and various lists of events that can be simulated. It optionally writes out a variety of artifacts to show the results of the simulation. Output can be modified with various flags.
[in,out] | xml | The destination for the result, as an XML tree |
[in,out] | scheduler | Scheduler data |
[in] | injections | A structure containing cluster events (node up/down, tickets, injected operations) |
[in] | flags | A bitfield of :pcmk_sim_flags to modify operation of the simulation |
[in] | section_opts | Which portions of the cluster status output should be displayed? |
[in] | use_date | Date to set the cluster's time to (may be NULL) |
[in] | input_file | The source CIB file, which may be overwritten by this function (may be NULL) |
[in] | graph_file | Where to write the XML-formatted transition graph (may be NULL, in which case no file will be written) |
[in] | dot_file | Where to write the dot(1) formatted transition graph (may be NULL, in which case no file will be written) |
Definition at line 992 of file pcmk_simulate.c.
int pcmk_status | ( | xmlNodePtr * | xml | ) |
Output cluster status formatted like crm_mon --output-as=xml
[in,out] | xml | The destination for the result, as an XML tree |
Definition at line 154 of file pcmk_status.c.
int pcmk_ticket_constraints | ( | xmlNodePtr * | xml, |
const char * | ticket_id | ||
) |
Return constraints that apply to the given ticket.
[in,out] | xml | The destination for the result, as an XML tree |
[in] | ticket_id | Ticket to find constraint for, or NULL for all ticket constraints |
Definition at line 145 of file pcmk_ticket.c.
int pcmk_ticket_delete | ( | xmlNodePtr * | xml, |
const char * | ticket_id, | ||
bool | force | ||
) |
Delete a ticket's state from the local cluster site.
[in,out] | xml | The destination for the result, as an XML tree |
[in] | ticket_id | Ticket to delete |
[in] | force | If true , delete the ticket even if it has been granted |
Definition at line 234 of file pcmk_ticket.c.
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's attribute.
[in,out] | xml | The destination for the result, as an XML tree |
[in] | ticket_id | Ticket to find attribute value for |
[in] | attr_name | Attribute's name to find value for |
[in] | attr_default | If either the ticket or the attribute do not exist, use this as the value in xml |
Definition at line 291 of file pcmk_ticket.c.
int pcmk_ticket_info | ( | xmlNodePtr * | xml, |
const char * | ticket_id | ||
) |
Return information about the given ticket.
[in,out] | xml | The destination for the result, as an XML tree |
[in] | ticket_id | Ticket to find info value for, or NULL for all tickets |
Definition at line 343 of file pcmk_ticket.c.
int pcmk_ticket_remove_attr | ( | xmlNodePtr * | xml, |
const char * | ticket_id, | ||
GList * | attr_delete, | ||
bool | force | ||
) |
Remove the given attribute(s) from a ticket.
[in,out] | xml | The destination for the result, as an XML tree |
[in] | ticket_id | Ticket to remove attributes from |
[in] | attr_delete | A list of attribute names |
[in] | force | Attempting to remove the granted attribute of ticket_id will cause this function to return EACCES unless force is set to true |
Definition at line 416 of file pcmk_ticket.c.
int pcmk_ticket_set_attr | ( | xmlNodePtr * | xml, |
const char * | ticket_id, | ||
GHashTable * | attr_set, | ||
bool | force | ||
) |
Set the given attribute(s) on a ticket.
[in,out] | xml | The destination for the result, as an XML tree |
[in] | ticket_id | Ticket to set attributes on |
[in] | attr_set | A hash table of attributes, where keys are the attribute names and the values are the attribute values |
[in] | force | Attempting to change the granted status of ticket_id will cause this function to return EACCES unless force is set to true |
ticket_id
attribute exists but attr_set
is non-NULL, the ticket will be created with the given attributes. Definition at line 484 of file pcmk_ticket.c.
int pcmk_ticket_state | ( | xmlNodePtr * | xml, |
const char * | ticket_id | ||
) |
Return a ticket's state XML.
[in,out] | xml | The destination for the result, as an XML tree |
[in] | ticket_id | Ticket to find state for, or NULL for all tickets |
ticket_id
is not NULL
and more than one ticket exists with that ID, this function returns pcmk_rc_duplicate_id
. Definition at line 533 of file pcmk_ticket.c.
int pcmk_verify | ( | xmlNodePtr * | xml, |
const char * | cib_source | ||
) |
Verify that a CIB is error-free or output errors and warnings.
This high-level function essentially implements crm_verify(8). It operates on an input CIB file, which can be inputted through one of several ways. It writes out XML-formatted output.
[in,out] | xml | The destination for the result, as an XML tree |
[in] | cib_source | Source of the CIB: NULL -> use live cib, "-" -> stdin "<..." -> xml str, otherwise -> xml file name |
Definition at line 119 of file pcmk_verify.c.