Skip to content

Commit

Permalink
Refactor: PE: More easily allow us to determine who changed an action…
Browse files Browse the repository at this point in the history
…'s flag
  • Loading branch information
beekhof committed Jun 1, 2015
1 parent 5f8d021 commit d939d11
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 23 deletions.
28 changes: 28 additions & 0 deletions pengine/allocate.c
Expand Up @@ -96,6 +96,34 @@ resource_alloc_functions_t resource_class_alloc_functions[] = {
}
};

gboolean
update_action_flags(action_t * action, enum pe_action_flags flags)
{
static unsigned long calls = 0;
gboolean changed = FALSE;
gboolean clear = is_set(flags, pe_action_clear);
enum pe_action_flags last = action->flags;

if (clear) {
pe_clear_action_bit(action, flags);
} else {
pe_set_action_bit(action, flags);
}

if (last != action->flags) {
calls++;
changed = TRUE;
/* Useful for tracking down _who_ changed a specific flag */
/* CRM_ASSERT(calls != 534); */
clear_bit(flags, pe_action_clear);
crm_trace("%s on %s: %sset flags 0x%.6x (was 0x%.6x, now 0x%.6x, %lu)",
action->uuid, action->node ? action->node->details->uname : "[none]",
clear ? "un-" : "", flags, last, action->flags, calls);
}

return changed;
}

static gboolean
check_rsc_parameters(resource_t * rsc, node_t * node, xmlNode * rsc_entry,
gboolean active_here, pe_working_set_t * data_set)
Expand Down
24 changes: 1 addition & 23 deletions pengine/allocate.h
Expand Up @@ -170,28 +170,6 @@ extern enum pe_graph_flags clone_update_actions(action_t * first, action_t * the
enum pe_action_flags flags,
enum pe_action_flags filter, enum pe_ordering type);

static inline gboolean
update_action_flags(action_t * action, enum pe_action_flags flags)
{
gboolean changed = FALSE;
gboolean clear = is_set(flags, pe_action_clear);
enum pe_action_flags last = action->flags;

if (clear) {
pe_clear_action_bit(action, flags);
} else {
pe_set_action_bit(action, flags);
}

if (last != action->flags) {
changed = TRUE;
clear_bit(flags, pe_action_clear);
crm_trace("%s on %s: %sset flags 0x%.6x (was 0x%.6x, now 0x%.6x)",
action->uuid, action->node ? action->node->details->uname : "[none]",
clear ? "un-" : "", flags, last, action->flags);
}

return changed;
}
gboolean update_action_flags(action_t * action, enum pe_action_flags flags);

#endif

0 comments on commit d939d11

Please sign in to comment.