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);
170 is_fence_param(xmlAttrPtr attr,
void *user_data)
188 GHashTable *params,
const xmlNode *xml_op,
189 const char *op_version, GHashTable *overrides)
192 const char *secure_list = NULL;
195 if (xml_op == NULL) {
196 secure_list =
" passwd password user ";
203 if (overrides != NULL) {
214 if (secure_list != NULL) {
216 (
void *) secure_list);
259 const char *op_version)
261 const char *value = NULL;
264 if (xml_op == NULL) {
308 const xmlNode *xml_op, GHashTable *overrides,
312 const char *op_version = NULL;
313 GHashTable *params = NULL;
325 if (xml_op != NULL) {
334 if (op_version == NULL) {
339 calculate_main_digest(
data, rsc, node, params, task, interval_ms, xml_op,
342 calculate_secure_digest(
data, rsc, params, xml_op, op_version,
345 calculate_restart_digest(
data, xml_op, op_version);
364 rsc_action_digest(
pcmk_resource_t *rsc,
const char *task, guint interval_ms,
398 guint interval_ms = 0;
400 const char *op_version;
402 const char *digest_all;
403 const char *digest_restart;
412 data = rsc_action_digest(rsc, task, interval_ms, node, xml_op,
417 if (digest_restart &&
data->digest_restart_calc && strcmp(
data->digest_restart_calc, digest_restart) != 0) {
419 "Parameters to %ums-interval %s action for %s on %s " 420 "changed: hash was %s vs. now %s (restart:%s) %s",
421 interval_ms, task, rsc->
id, pcmk__node_name(node),
422 pcmk__s(digest_restart,
"missing"),
423 data->digest_restart_calc, op_version,
427 }
else if (digest_all == NULL) {
431 }
else if (strcmp(digest_all,
data->digest_all_calc) != 0) {
443 "Parameters containing extra ones to %ums-interval" 444 " %s action for %s on %s " 445 "changed: hash was %s vs. now %s (restart:%s) %s",
446 interval_ms, task, rsc->
id, pcmk__node_name(node),
447 pcmk__s(digest_all,
"missing"),
448 data->digest_all_calc, op_version,
454 "Parameters to %ums-interval %s action for %s on %s " 455 "changed: hash was %s vs. now %s (%s:%s) %s",
456 interval_ms, task, rsc->
id, pcmk__node_name(node),
457 pcmk__s(digest_all,
"missing"),
458 data->digest_all_calc,
459 (interval_ms > 0)?
"reschedule" :
"reload",
490 create_unfencing_summary(
const char *rsc_id,
const char *agent_type,
491 const char *param_digest)
513 unfencing_digest_matches(
const char *rsc_id,
const char *agent,
514 const char *digest_calc,
const char *node_summary)
516 bool matches = FALSE;
518 if (rsc_id && agent && digest_calc && node_summary) {
519 char *search_secure = create_unfencing_summary(rsc_id, agent,
525 matches = (strstr(node_summary, search_secure) != NULL);
526 crm_trace(
"Calculated unfencing digest '%s' %sfound in '%s'",
527 search_secure, matches?
"" :
"not ", node_summary);
537 #define STONITH_DIGEST_TASK "stonith-on" 554 const char *node_summary = NULL;
563 if (node_summary == NULL) {
569 if (unfencing_digest_matches(rsc->
id, agent,
data->digest_all_calc,
578 if (unfencing_digest_matches(rsc->
id, agent,
data->digest_secure_calc,
583 out->
info(out,
"Only 'private' parameters to %s " 584 "for unfencing %s changed", rsc->
id,
585 pcmk__node_name(node));
593 && (
data->digest_secure_calc != NULL)) {
597 char *digest = create_unfencing_summary(rsc->
id, agent,
598 data->digest_secure_calc);
600 out->
info(out,
"Parameters to %s for unfencing " 601 "%s changed, try '%s'", rsc->
id,
602 pcmk__node_name(node), digest);
605 char *digest = create_unfencing_summary(rsc->
id, agent,
606 data->digest_secure_calc);
608 printf(
"Parameters to %s for unfencing %s changed, try '%s'\n",
609 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)
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)
#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
#define PCMK_XA_OPERATION
int pcmk__scan_ll(const char *text, long long *result, long long default_value)
char * calculate_operation_digest(xmlNode *local_cib, const char *version)
Calculate and return digest of XML operation.
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__sched_err(fmt...)
void pcmk__xe_remove_matching_attrs(xmlNode *element, bool(*match)(xmlAttrPtr, void *), void *user_data)
#define PCMK__XA_OP_DIGEST
#define crm_trace(fmt, args...)
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
struct pe_node_shared_s * details
Wrappers for and extensions to libxml2.
void pcmk__xe_remove_attr(xmlNode *element, const char *name)
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
char * pcmk__op_key(const char *rsc_id, const char *op_type, guint interval_ms)
Generate an operation key (RESOURCE_ACTION_INTERVAL)
void free_xml(xmlNode *child)
#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.
GHashTable * digest_cache
#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.
xmlNode * pcmk__xe_create(xmlNode *parent, const char *name)
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)
Where resource is running.