14 #include <libxml/tree.h> 26 #define XPATH_OP_HISTORY "//" PCMK_XE_STATUS \ 27 "/" PCMK__XE_NODE_STATE \ 28 "[@" PCMK_XA_UNAME "='%s']" \ 29 "/" PCMK__XE_LRM "/" PCMK__XE_LRM_RESOURCES \ 30 "/" PCMK__XE_LRM_RESOURCE "[@" PCMK_XA_ID "='%s']" 36 xmlNode *history = NULL;
38 bool best_effective_op =
false;
39 guint best_interval = 0;
40 bool best_failure =
false;
41 const char *best_digest = NULL;
57 guint interval_ms = 0;
59 bool effective_op =
false;
65 effective_op = interval_ms == 0
75 if (best_effective_op) {
81 }
else if (best_interval != 0
83 && interval_ms == 0) {
88 if (!best_failure && failure) {
93 if (best_digest != NULL && digest == NULL) {
104 best_effective_op = effective_op;
105 best_interval = interval_ms;
106 best_failure = failure;
107 best_digest = digest;
125 const char *rsc_type)
128 xmlNode *msg_data = NULL;
134 if (rsc_id == NULL || rsc_type == NULL) {
200 const char *task = NULL;
201 xmlNode *xml_op = NULL;
203 guint interval_ms = 0;
206 if ((out == NULL) || (rsc == NULL) || (node == NULL)) {
210 if (!pcmk__is_primitive(rsc)) {
216 xml_op = best_op(rsc, node);
219 if (xml_op != NULL) {
231 rc = out->
message(out,
"digests", rsc, node, task, interval_ms, digests);
xmlNode * pcmk__xe_first_child(const xmlNode *parent, const char *node_name, const char *attr_n, const char *attr_v)
int pcmk_resource_delete(xmlNodePtr *xml, const char *rsc_id, const char *rsc_type)
Remove a resource.
cib_t * cib_new(void)
Create a new CIB connection object.
bool pcmk__strcase_any_of(const char *s,...) G_GNUC_NULL_TERMINATED
int(* message)(pcmk__output_t *out, const char *message_id,...)
#define PCMK_ACTION_MONITOR
crm_exit_t pcmk_rc2exitc(int rc)
Map a function return code to the most similar exit code.
void pcmk__xml_output_finish(pcmk__output_t *out, crm_exit_t exit_status, xmlNodePtr *xml)
#define PCMK__XA_OP_RESTART_DIGEST
bool pcmk__ends_with(const char *s, const char *match)
#define PCMK_XA_OPERATION
xmlNode * get_xpath_object(const char *xpath, xmlNode *xml_obj, int error_level)
Wrappers for and extensions to glib mainloop.
xmlNode * pcmk__xe_create(xmlNode *parent, const char *name)
void pcmk__xml_free(xmlNode *xml)
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value.
pcmk__node_private_t * priv
Formatted output for pacemaker tools.
cib_api_operations_t * cmds
int crm_element_value_ms(const xmlNode *data, const char *name, guint *dest)
Retrieve the millisecond value of an XML attribute.
pcmk_scheduler_t * scheduler
int(* signon)(cib_t *cib, const char *name, enum cib_conn_type type)
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
int pcmk__xml_output_new(pcmk__output_t **out, xmlNodePtr *xml)
pcmk__op_digest_t * pe__calculate_digests(pcmk_resource_t *rsc, const char *task, guint *interval_ms, const pcmk_node_t *node, const xmlNode *xml_op, GHashTable *overrides, bool calc_secure, pcmk_scheduler_t *scheduler)
int pcmk_resource_digests(xmlNodePtr *xml, pcmk_resource_t *rsc, const pcmk_node_t *node, GHashTable *overrides)
Calculate and output resource operation digests.
#define PCMK_ACTION_START
pcmk__resource_private_t * priv
void pcmk__register_lib_messages(pcmk__output_t *out)
int pcmk_legacy2rc(int legacy_rc)
void pe__free_digests(gpointer ptr)
int cib__clean_up_connection(cib_t **cib)
Function and executable result codes.
int pe__is_newer_op(const xmlNode *xml_a, const xmlNode *xml_b)
xmlNode * pcmk__xe_next(const xmlNode *node, const char *element_name)
#define PCMK_META_INTERVAL
#define PCMK__XE_LRM_RSC_OP
#define PCMK_ACTION_MIGRATE_FROM
This structure contains everything that makes up a single output formatter.
int pcmk__resource_delete(cib_t *cib, uint32_t cib_opts, const char *rsc_id, const char *rsc_type)
#define PCMK_ACTION_PROMOTE
int(* remove)(cib_t *cib, const char *section, xmlNode *data, int call_options)
#define PCMK_XE_RESOURCES
int pcmk__resource_digests(pcmk__output_t *out, pcmk_resource_t *rsc, const pcmk_node_t *node, GHashTable *overrides)
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1