pacemaker
2.1.7-0f7f88312f
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_digests (xmlNodePtr *xml, pcmk_resource_t *rsc, const pcmk_node_t *node, GHashTable *overrides, pcmk_scheduler_t *scheduler) |
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_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... | |
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 304 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 280 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 498 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 567 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 769 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_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 884 of file pcmk_cluster_queries.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 786 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 690 of file pcmk_cluster_queries.c.
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.
[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 |
[in] | scheduler | Scheduler data (with status) |
Definition at line 158 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 985 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.