42 free(
data->digest_all_calc);
43 free(
data->digest_restart_calc);
44 free(
data->digest_secure_calc);
52 attr_not_in_string(xmlAttrPtr a,
void *user_data)
57 if (strstr((
const char *) user_data,
name) == NULL) {
58 crm_trace(
"Filtering %s (not found in '%s')",
59 (
const char *) a->name, (
const char *) user_data);
68 attr_in_string(xmlAttrPtr a,
void *user_data)
73 if (strstr((
const char *) user_data,
name) != NULL) {
75 (
const char *) a->name, (
const char *) user_data);
100 const char *task, guint *interval_ms,
101 const xmlNode *xml_op,
const char *op_version,
104 xmlNode *action_config = NULL;
114 if (overrides != NULL) {
117 const char *interval_s = g_hash_table_lookup(overrides, meta_name);
119 if (interval_s != NULL) {
123 && (value_ll >= 0) && (value_ll <= G_MAXUINT)) {
124 *interval_ms = (guint) value_ll;
150 if ((*interval_ms == 0) && (g_hash_table_size(params) > 0)) {
154 g_hash_table_destroy(params);
160 g_hash_table_destroy(params);
169 is_fence_param(xmlAttrPtr attr,
void *user_data)
187 GHashTable *params,
const xmlNode *xml_op,
188 const char *op_version, GHashTable *overrides)
191 const char *secure_list = NULL;
194 if (xml_op == NULL) {
195 secure_list =
" passwd password user ";
202 if (overrides != NULL) {
213 if (secure_list != NULL) {
215 (
void *) secure_list);
257 const char *op_version)
259 const char *value = NULL;
262 if (xml_op == NULL) {
305 const xmlNode *xml_op, GHashTable *overrides,
309 const char *op_version = NULL;
310 GHashTable *params = NULL;
317 "Could not allocate memory for operation digest");
323 if (xml_op != NULL) {
332 if (op_version == NULL) {
337 calculate_main_digest(
data, rsc, node, params, task, interval_ms, xml_op,
340 calculate_secure_digest(
data, rsc, params, xml_op, op_version,
343 calculate_restart_digest(
data, xml_op, op_version);
362 rsc_action_digest(
pcmk_resource_t *rsc,
const char *task, guint interval_ms,
396 guint interval_ms = 0;
398 const char *op_version;
400 const char *digest_all;
401 const char *digest_restart;
410 data = rsc_action_digest(rsc, task, interval_ms, node, xml_op,
415 if (digest_restart &&
data->digest_restart_calc && strcmp(
data->digest_restart_calc, digest_restart) != 0) {
417 "Parameters to %ums-interval %s action for %s on %s " 418 "changed: hash was %s vs. now %s (restart:%s) %s",
419 interval_ms, task, rsc->
id, pcmk__node_name(node),
420 pcmk__s(digest_restart,
"missing"),
421 data->digest_restart_calc, op_version,
425 }
else if (digest_all == NULL) {
429 }
else if (strcmp(digest_all,
data->digest_all_calc) != 0) {
441 "Parameters containing extra ones to %ums-interval" 442 " %s action for %s on %s " 443 "changed: hash was %s vs. now %s (restart:%s) %s",
444 interval_ms, task, rsc->
id, pcmk__node_name(node),
445 pcmk__s(digest_all,
"missing"),
446 data->digest_all_calc, op_version,
452 "Parameters to %ums-interval %s action for %s on %s " 453 "changed: hash was %s vs. now %s (%s:%s) %s",
454 interval_ms, task, rsc->
id, pcmk__node_name(node),
455 pcmk__s(digest_all,
"missing"),
456 data->digest_all_calc,
457 (interval_ms > 0)?
"reschedule" :
"reload",
488 create_unfencing_summary(
const char *rsc_id,
const char *agent_type,
489 const char *param_digest)
511 unfencing_digest_matches(
const char *rsc_id,
const char *agent,
512 const char *digest_calc,
const char *node_summary)
514 bool matches = FALSE;
516 if (rsc_id && agent && digest_calc && node_summary) {
517 char *search_secure = create_unfencing_summary(rsc_id, agent,
523 matches = (strstr(node_summary, search_secure) != NULL);
524 crm_trace(
"Calculated unfencing digest '%s' %sfound in '%s'",
525 search_secure, matches?
"" :
"not ", node_summary);
535 #define STONITH_DIGEST_TASK "stonith-on" 552 const char *node_summary = NULL;
561 if (node_summary == NULL) {
567 if (unfencing_digest_matches(rsc->
id, agent,
data->digest_all_calc,
576 if (unfencing_digest_matches(rsc->
id, agent,
data->digest_secure_calc,
582 out->
info(out,
"Only 'private' parameters to %s " 583 "for unfencing %s changed", rsc->
id,
584 pcmk__node_name(node));
592 && (
data->digest_secure_calc != NULL)) {
596 char *digest = create_unfencing_summary(rsc->
id, agent,
597 data->digest_secure_calc);
599 out->
info(out,
"Parameters to %s for unfencing " 600 "%s changed, try '%s'", rsc->
id,
601 pcmk__node_name(node), digest);
604 char *digest = create_unfencing_summary(rsc->
id, agent,
605 data->digest_secure_calc);
607 printf(
"Parameters to %s for unfencing %s changed, try '%s'\n",
608 rsc->
id, pcmk__node_name(node), digest);
#define PCMK__XA_OP_FORCE_RESTART
#define CRM_CHECK(expr, failure_action)
xmlNode * pcmk__xml_copy(xmlNode *parent, xmlNode *src)
#define pcmk__sched_err(scheduler, fmt...)
void pcmk__filter_op_for_digest(xmlNode *param_set)
void hash2field(gpointer key, gpointer value, gpointer user_data)
Set XML attribute based on hash table entry.
#define PCMK__XA_TRANSITION_MAGIC
#define pcmk__rsc_info(rsc, fmt, args...)
const char * pe__add_bundle_remote_name(pcmk_resource_t *rsc, xmlNode *xml, const char *field)
bool pcmk_stonith_param(const char *param)
Check whether a given stonith parameter is handled by Pacemaker.
#define PCMK_REMOTE_RA_ADDR
GHashTable * pcmk__unpack_action_rsc_params(const xmlNode *action_xml, GHashTable *node_attrs, pcmk_scheduler_t *data_set)
pcmk__scheduler_private_t * priv
#define PCMK_XE_PARAMETERS
#define CRM_ATTR_DIGESTS_ALL
#define PCMK__XA_OP_RESTART_DIGEST
int(* info)(pcmk__output_t *out, const char *format,...) G_GNUC_PRINTF(2
void pcmk__xe_remove_attr(xmlNode *element, const char *name)
#define PCMK_XA_OPERATION
xmlNode * pcmk__xe_create(xmlNode *parent, const char *name)
void pcmk__xml_free(xmlNode *xml)
pcmk__node_private_t * priv
int pcmk__scan_ll(const char *text, long long *result, long long default_value)
int crm_element_value_ms(const xmlNode *data, const char *name, guint *dest)
Retrieve the millisecond value of an XML attribute.
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
#define PCMK__XA_OP_DIGEST
#define crm_trace(fmt, args...)
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
Wrappers for and extensions to libxml2.
pcmk__op_digest_t * rsc_action_digest_cmp(pcmk_resource_t *rsc, const xmlNode *xml_op, pcmk_node_t *node, pcmk_scheduler_t *scheduler)
#define CRM_ATTR_DIGESTS_SECURE
GHashTable * digest_cache
char * pcmk__op_key(const char *rsc_id, const char *op_type, guint interval_ms)
Generate an operation key (RESOURCE_ACTION_INTERVAL)
#define PCMK_META_TIMEOUT
#define pcmk__assert(expr)
#define PCMK_XA_CRM_FEATURE_SET
pcmk__op_digest_t * pe__compare_fencing_digest(pcmk_resource_t *rsc, const char *agent, pcmk_node_t *node, pcmk_scheduler_t *scheduler)
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)
xmlNode * pcmk__find_action_config(const pcmk_resource_t *rsc, const char *action_name, guint interval_ms, bool include_disabled)
#define PCMK_META_INTERVAL
pcmk_scheduler_t * scheduler
#define STONITH_DIGEST_TASK
const char * pcmk__node_attr(const pcmk_node_t *node, const char *name, const char *target, enum pcmk__rsc_node node_type)
This structure contains everything that makes up a single output formatter.
int compare_version(const char *version1, const char *version2)
void hash2metafield(gpointer key, gpointer value, gpointer user_data)
Set XML attribute based on hash table entry, as meta-attribute name.
char * pcmk__digest_operation(xmlNode *input)
#define PCMK__XA_OP_SECURE_PARAMS
uint32_t pcmk_get_ra_caps(const char *standard)
Get capabilities of a resource agent standard.
void pe__free_digests(gpointer ptr)
GHashTable * pe_rsc_params(pcmk_resource_t *rsc, const pcmk_node_t *node, pcmk_scheduler_t *scheduler)
Get a table of resource parameters.
GHashTable * pcmk__unpack_action_meta(pcmk_resource_t *rsc, const pcmk_node_t *node, const char *action_name, guint interval_ms, const xmlNode *action_config)
void pcmk__xe_remove_matching_attrs(xmlNode *element, bool(*match)(xmlAttrPtr, void *), void *user_data)
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1