105 const xmlNode *rsc_entry,
bool active_on_node)
107 bool changed =
false;
108 const char *attr_list[] = {
122 if (active_on_node) {
124 "because %s changed from '%s' to '%s'",
130 if (changed && active_on_node) {
152 if ((strcmp(rsc->
id,
id) == 0)
156 for (GList *iter = rsc->
children; iter != NULL; iter = iter->next) {
195 set_allocation_methods_for_rsc(
pe_resource_t *rsc,
void *ignored)
198 g_list_foreach(rsc->
children, (GFunc) set_allocation_methods_for_rsc, NULL);
217 GList *colocated_rscs)
221 if (orig_rsc == NULL) {
225 if ((rsc == NULL) || (g_list_find(colocated_rscs, rsc) != NULL)) {
226 return colocated_rscs;
229 pe_rsc_trace(orig_rsc,
"%s is in colocation chain with %s",
230 rsc->
id, orig_rsc->
id);
231 colocated_rscs = g_list_append(colocated_rscs, rsc);
234 for (gIter = rsc->
rsc_cons; gIter != NULL; gIter = gIter->next) {
238 if (primary == orig_rsc) {
253 for (gIter = rsc->
rsc_cons_lhs; gIter != NULL; gIter = gIter->next) {
257 if (dependent == orig_rsc) {
261 if (pe_rsc_is_clone(rsc) && !pe_rsc_is_clone(dependent)) {
275 return colocated_rscs;
287 for (GList *iter = rsc->
children; iter != NULL; iter = iter->next) {
297 current = pe__current_node(rsc);
312 out->
message(out,
"rsc-action", rsc, current, next);
343 if (!force && (chosen != NULL)) {
348 crm_debug(
"All nodes for resource %s are unavailable, unclean or " 349 "shutting down (%s can%s run resources, with weight %d)",
361 if (chosen == NULL) {
362 crm_debug(
"Could not allocate a node for %s", rsc->
id);
365 for (GList *iter = rsc->
actions; iter != NULL; iter = iter->next) {
379 const char *interval_ms_s = NULL;
380 const char *target_rc_s = NULL;
383 interval_ms_s = g_hash_table_lookup(op->
meta,
385 target_rc_s = g_hash_table_lookup(op->
meta,
387 if ((interval_ms_s != NULL)
408 out->
message(out,
"resource-util", rsc, chosen, __func__);
436 bool changed =
false;
445 for (GList *iter = rsc->
children; iter != NULL; iter = iter->next) {
502 int fail_count, remaining_tries;
519 if (fail_count <= 0) {
531 if (remaining_tries <= 0) {
532 crm_warn(
"%s cannot run on %s due to reaching migration threshold " 533 "(clean up resource to allow again)" 534 CRM_XS " failures=%d migration-threshold=%d",
537 if (failed != NULL) {
538 *failed = rsc_to_ban;
543 crm_info(
"%s can fail %d more time%s on " 544 "%s before reaching migration threshold (%d)",
551 convert_const_pointer(
const void *ptr)
567 get_node_weight(
pe_node_t *node, GHashTable *nodes)
571 if ((node != NULL) && (nodes != NULL)) {
572 weighted_node = g_hash_table_lookup(nodes, node->
details->
id);
574 return (weighted_node == NULL)? -
INFINITY : weighted_node->
weight;
589 cmp_resources(gconstpointer a, gconstpointer b, gpointer
data)
593 GList *nodes = (GList *)
data;
600 GHashTable *r1_nodes = NULL;
601 GHashTable *r2_nodes = NULL;
602 const char *reason = NULL;
608 if (r1_weight > r2_weight) {
612 if (r1_weight < r2_weight) {
618 reason =
"no node list";
625 resource1->
id, NULL, NULL, 1,
628 resource2->
id, NULL, NULL, 1,
636 reason =
"current location";
638 r1_node = pe__current_node(resource1);
641 r2_node = pe__current_node(resource2);
643 r1_weight = get_node_weight(r1_node, r1_nodes);
644 r2_weight = get_node_weight(r2_node, r2_nodes);
645 if (r1_weight > r2_weight) {
649 if (r1_weight < r2_weight) {
656 for (GList *iter = nodes; iter != NULL; iter = iter->next) {
659 r1_weight = get_node_weight(node, r1_nodes);
660 r2_weight = get_node_weight(node, r2_nodes);
661 if (r1_weight > r2_weight) {
665 if (r1_weight < r2_weight) {
672 crm_trace(
"%s (%d)%s%s %c %s (%d)%s%s: %s",
673 resource1->
id, r1_weight,
674 ((r1_node == NULL)?
"" :
" on "),
675 ((r1_node == NULL)?
"" : r1_node->
details->
id),
676 ((rc < 0)?
'>' : ((rc > 0)?
'<' :
'=')),
677 resource2->
id, r2_weight,
678 ((r2_node == NULL)?
"" :
" on "),
679 ((r2_node == NULL)?
"" : r2_node->
details->
id),
681 if (r1_nodes != NULL) {
682 g_hash_table_destroy(r1_nodes);
684 if (r2_nodes != NULL) {
685 g_hash_table_destroy(r2_nodes);
703 cmp_resources, nodes);
void pcmk__set_allocation_methods(pe_working_set_t *data_set)
#define CRM_CHECK(expr, failure_action)
void group_append_meta(pe_resource_t *rsc, xmlNode *xml)
enum pe_action_flags clone_action_flags(pe_action_t *action, pe_node_t *node)
void clone_append_meta(pe_resource_t *rsc, xmlNode *xml)
#define crm_notice(fmt, args...)
enum pe_action_flags pcmk__bundle_action_flags(pe_action_t *action, pe_node_t *node)
GList * pcmk__colocated_resources(pe_resource_t *rsc, pe_resource_t *orig_rsc, GList *colocated_rscs)
#define pe__show_node_weights(level, rsc, text, nodes, data_set)
int(* message)(pcmk__output_t *out, const char *message_id,...)
G_GNUC_INTERNAL bool pcmk__node_available(const pe_node_t *node)
resource_alloc_functions_t * cmds
void pcmk__primitive_shutdown_lock(pe_resource_t *rsc)
void pcmk__group_add_utilization(pe_resource_t *rsc, pe_resource_t *orig_rsc, GList *all_rscs, GHashTable *utilization)
pe_node_t * pe__copy_node(const pe_node_t *this_node)
void pcmk__output_resource_actions(pe_resource_t *rsc)
pe_resource_t * dependent
void pcmk__primitive_add_utilization(pe_resource_t *rsc, pe_resource_t *orig_rsc, GList *all_rscs, GHashTable *utilization)
bool pcmk__rsc_agent_changed(pe_resource_t *rsc, pe_node_t *node, const xmlNode *rsc_entry, bool active_on_node)
void group_rsc_location(pe_resource_t *rsc, pe__location_t *constraint)
enum pe_graph_flags native_update_actions(pe_action_t *first, pe_action_t *then, pe_node_t *node, enum pe_action_flags flags, enum pe_action_flags filter, enum pe_ordering type, pe_working_set_t *data_set)
void native_expand(pe_resource_t *rsc, pe_working_set_t *data_set)
void native_rsc_location(pe_resource_t *rsc, pe__location_t *constraint)
void native_rsc_colocation_lh(pe_resource_t *dependent, pe_resource_t *primary, pcmk__colocation_t *constraint, pe_working_set_t *data_set)
GHashTable * pcmk__native_merge_weights(pe_resource_t *rsc, const char *rhs, GHashTable *nodes, const char *attr, float factor, uint32_t flags)
void pcmk__group_shutdown_lock(pe_resource_t *rsc)
void native_rsc_colocation_rh(pe_resource_t *dependent, pe_resource_t *primary, pcmk__colocation_t *constraint, pe_working_set_t *data_set)
void pcmk__bundle_rsc_colocation_rh(pe_resource_t *dependent, pe_resource_t *primary, pcmk__colocation_t *constraint, pe_working_set_t *data_set)
void pcmk__clone_add_utilization(pe_resource_t *rsc, pe_resource_t *orig_rsc, GList *all_rscs, GHashTable *utilization)
#define pe__set_resource_flags(resource, flags_to_set)
void trigger_unfencing(pe_resource_t *rsc, pe_node_t *node, const char *reason, pe_action_t *dependency, pe_working_set_t *data_set)
void pcmk__bundle_rsc_colocation_lh(pe_resource_t *dependent, pe_resource_t *primary, pcmk__colocation_t *constraint, pe_working_set_t *data_set)
#define pe_rsc_provisional
void native_internal_constraints(pe_resource_t *rsc, pe_working_set_t *data_set)
void group_rsc_colocation_lh(pe_resource_t *dependent, pe_resource_t *primary, pcmk__colocation_t *constraint, pe_working_set_t *data_set)
#define crm_warn(fmt, args...)
void native_create_actions(pe_resource_t *rsc, pe_working_set_t *data_set)
void clone_expand(pe_resource_t *rsc, pe_working_set_t *data_set)
#define crm_debug(fmt, args...)
G_GNUC_INTERNAL GList * pcmk__sort_nodes(GList *nodes, pe_node_t *active_node, pe_working_set_t *data_set)
pe_resource_t * uber_parent(pe_resource_t *rsc)
pe_node_t * pcmk__clone_allocate(pe_resource_t *rsc, pe_node_t *preferred, pe_working_set_t *data_set)
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
bool pe__is_guest_node(const pe_node_t *node)
enum pe_graph_flags group_update_actions(pe_action_t *first, pe_action_t *then, pe_node_t *node, enum pe_action_flags flags, enum pe_action_flags filter, enum pe_ordering type, pe_working_set_t *data_set)
#define pe_rsc_start_pending
#define pe__clear_action_flags(action, flags_to_clear)
#define crm_trace(fmt, args...)
G_GNUC_INTERNAL GList * pcmk__group_colocated_resources(pe_resource_t *rsc, pe_resource_t *orig_rsc, GList *colocated_rscs)
GList *(* colocated_resources)(pe_resource_t *rsc, pe_resource_t *orig_rsc, GList *colocated_rscs)
void pcmk__bundle_shutdown_lock(pe_resource_t *rsc)
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
bool pcmk__assign_primitive(pe_resource_t *rsc, pe_node_t *chosen, bool force)
struct pe_node_shared_s * details
#define XML_AGENT_ATTR_PROVIDER
GHashTable * pcmk__group_merge_weights(pe_resource_t *rsc, const char *rhs, GHashTable *nodes, const char *attr, float factor, uint32_t flags)
pe_working_set_t * data_set
void(* output_actions)(pe_resource_t *rsc)
gboolean native_create_probe(pe_resource_t *rsc, pe_node_t *node, pe_action_t *complete, gboolean force, pe_working_set_t *data_set)
bool pcmk__threshold_reached(pe_resource_t *rsc, pe_node_t *node, pe_resource_t **failed)
void group_internal_constraints(pe_resource_t *rsc, pe_working_set_t *data_set)
pe_node_t * pcmk__bundle_allocate(pe_resource_t *rsc, pe_node_t *preferred, pe_working_set_t *data_set)
enum pe_obj_types variant
G_GNUC_INTERNAL void pcmk__output_bundle_actions(pe_resource_t *rsc)
gboolean pcmk__bundle_create_probe(pe_resource_t *rsc, pe_node_t *node, pe_action_t *complete, gboolean force, pe_working_set_t *data_set)
void group_create_actions(pe_resource_t *rsc, pe_working_set_t *data_set)
enum pe_action_flags group_action_flags(pe_action_t *action, pe_node_t *node)
pcmk__action_result_t result
#define pe_flag_show_utilization
void pcmk__bundle_rsc_location(pe_resource_t *rsc, pe__location_t *constraint)
void clone_rsc_location(pe_resource_t *rsc, pe__location_t *constraint)
G_GNUC_INTERNAL void pcmk__release_node_capacity(GHashTable *current_utilization, pe_resource_t *rsc)
void group_rsc_colocation_rh(pe_resource_t *dependent, pe_resource_t *primary, pcmk__colocation_t *constraint, pe_working_set_t *data_set)
void pe__set_next_role(pe_resource_t *rsc, enum rsc_role_e role, const char *why)
void pcmk__bundle_add_utilization(pe_resource_t *rsc, pe_resource_t *orig_rsc, GList *all_rscs, GHashTable *utilization)
G_GNUC_INTERNAL void pcmk__consume_node_capacity(GHashTable *current_utilization, pe_resource_t *rsc)
This structure contains everything that makes up a single output formatter.
#define XML_LRM_ATTR_INTERVAL_MS
void clone_create_actions(pe_resource_t *rsc, pe_working_set_t *data_set)
void pcmk__sort_resources(pe_working_set_t *data_set)
#define pe__clear_resource_flags(resource, flags_to_clear)
void pcmk__bundle_expand(pe_resource_t *rsc, pe_working_set_t *data_set)
gboolean clone_create_probe(pe_resource_t *rsc, pe_node_t *node, pe_action_t *complete, gboolean force, pe_working_set_t *data_set)
#define pcmk__plural_s(i)
void clone_rsc_colocation_lh(pe_resource_t *dependent, pe_resource_t *primary, pcmk__colocation_t *constraint, pe_working_set_t *data_set)
void native_append_meta(pe_resource_t *rsc, xmlNode *xml)
#define pe_rsc_failure_ignored
pe_working_set_t * cluster
void clone_rsc_colocation_rh(pe_resource_t *dependent, pe_resource_t *primary, pcmk__colocation_t *constraint, pe_working_set_t *data_set)
void pcmk__unassign_resource(pe_resource_t *rsc)
G_GNUC_INTERNAL enum pcmk__coloc_affects pcmk__colocation_affects(pe_resource_t *dependent, pe_resource_t *primary, pcmk__colocation_t *constraint, bool preview)
bool pcmk__assign_resource(pe_resource_t *rsc, pe_node_t *node, bool force)
#define pe_rsc_trace(rsc, fmt, args...)
void clone_internal_constraints(pe_resource_t *rsc, pe_working_set_t *data_set)
GList * pcmk__rscs_matching_id(const char *id, pe_working_set_t *data_set)
void group_expand(pe_resource_t *rsc, pe_working_set_t *data_set)
void pcmk__bundle_create_actions(pe_resource_t *rsc, pe_working_set_t *data_set)
#define crm_info(fmt, args...)
enum pe_action_flags native_action_flags(pe_action_t *action, pe_node_t *node)
enum pe_graph_flags pcmk__multi_update_actions(pe_action_t *first, pe_action_t *then, pe_node_t *node, enum pe_action_flags flags, enum pe_action_flags filter, enum pe_ordering type, pe_working_set_t *data_set)
void pcmk__bundle_internal_constraints(pe_resource_t *rsc, pe_working_set_t *data_set)
void pcmk__bundle_append_meta(pe_resource_t *rsc, xmlNode *xml)
#define XML_ATTR_TE_TARGET_RC
int pe_get_failcount(pe_node_t *node, pe_resource_t *rsc, time_t *last_failure, uint32_t flags, xmlNode *xml_op, pe_working_set_t *data_set)
void pcmk__clone_shutdown_lock(pe_resource_t *rsc)
pe_node_t * pcmk__native_allocate(pe_resource_t *rsc, pe_node_t *preferred, pe_working_set_t *data_set)
#define XML_AGENT_ATTR_CLASS
pe_action_t * custom_action(pe_resource_t *rsc, char *key, const char *task, pe_node_t *on_node, gboolean optional, gboolean foo, pe_working_set_t *data_set)
Create or update an action object.
pe_node_t * pcmk__group_allocate(pe_resource_t *rsc, pe_node_t *preferred, pe_working_set_t *data_set)