50 pe_rsc_debug(rsc,
"Assignment dependency loop detected involving %s",
69 for (GList *iter = rsc->
children; iter != NULL; iter = iter->next) {
75 node = member->
cmds->
assign(member, prefer, stop_if_fail);
76 if (first_assigned_node == NULL) {
77 first_assigned_node = node;
87 return first_assigned_node;
122 for (GList *iter = rsc->
children; iter != NULL; iter = iter->next) {
160 member_internal_constraints(gpointer
data, gpointer user_data)
163 struct member_data *member_data = (
struct member_data *) user_data;
174 if (member_data->previous_member == NULL) {
176 if (member_data->ordered) {
181 }
else if (member_data->colocated) {
190 member_data->previous_member, NULL, NULL,
flags);
193 if (member_data->promotable) {
227 if (!member_data->ordered) {
232 if (member_data->promotable) {
240 }
else if (member_data->previous_member == NULL) {
242 if (member_data->promotable) {
264 && (member_data->previous_member->running_on == NULL)) {
266 member_data->previous_member,
272 if (member_data->promotable) {
279 member_data->previous_member,
286 if (member_data->ordered && (member_data->previous_member != NULL)
287 && (member_data->previous_member->running_on == NULL)
288 && (member_data->last_active != NULL)
289 && (member_data->last_active->running_on != NULL)) {
293 member_data->last_active = member;
296 member_data->previous_member = member;
308 struct member_data member_data = {
false, };
331 g_list_foreach(rsc->
children, member_internal_constraints, &member_data);
356 pe_rsc_trace(primary,
"Processing %s (group %s with %s) for dependent",
357 colocation->
id, dependent->
id, primary->
id);
368 "non-colocated group and %s",
369 dependent->
id, primary->
id);
374 for (GList *iter = dependent->
children; iter != NULL; iter = iter->next) {
399 "Processing colocation %s (%s with group %s) for primary",
400 colocation->
id, dependent->
id, primary->
id);
414 }
else if (primary->
children != NULL) {
421 if (member == NULL) {
431 " non-colocated group %s",
432 dependent->
id, primary->
id);
437 for (
const GList *iter = primary->
children; iter != NULL;
463 CRM_ASSERT((dependent != NULL) && (primary != NULL)
464 && (colocation != NULL));
467 colocate_group_with(dependent, primary, colocation);
473 colocate_with_group(dependent, primary, colocation);
497 for (GList *iter =
action->rsc->children; iter != NULL; iter = iter->next) {
506 if (member_action != NULL) {
537 "%s is not runnable because %s will not %s",
572 uint32_t filter, uint32_t
type,
578 CRM_ASSERT((first != NULL) && (then != NULL) && (then->
rsc != NULL)
586 for (GList *iter = then->
rsc->
children; iter != NULL; iter = iter->next) {
592 if (member_action != NULL) {
612 GList *node_list_orig = NULL;
613 GList *node_list_copy = NULL;
614 bool reset_scores =
true;
617 && (location != NULL));
627 for (GList *iter = rsc->
children; iter != NULL; iter = iter->next) {
637 reset_scores =
false;
643 g_list_free_full(node_list_copy, free);
650 GList *colocated_rscs)
656 if (orig_rsc == NULL) {
661 || pe_rsc_is_clone(rsc->
parent)) {
666 colocated_rscs = g_list_prepend(colocated_rscs, (gpointer) rsc);
667 for (
const GList *iter = rsc->children;
668 iter != NULL; iter = iter->next) {
683 return colocated_rscs;
693 && (orig_rsc != NULL) && (list != NULL));
708 pe_rsc_trace(rsc,
"Adding 'with %s' colocations to list for %s",
709 rsc->
id, orig_rsc->
id);
715 if (rsc->
parent != NULL) {
726 for (
const GList *iter = rsc->
children; iter != NULL; iter = iter->next) {
729 if (member != orig_rsc) {
743 && (orig_rsc != NULL) && (list != NULL));
753 if ((rsc == orig_rsc)
755 pe_rsc_trace(rsc,
"Adding '%s with' colocations to list for %s",
756 rsc->
id, orig_rsc->
id);
762 if (rsc->
parent != NULL) {
773 for (
const GList *iter = rsc->
children;
774 iter != NULL; iter = iter->next) {
776 if (member != orig_rsc) {
788 for (
const GList *iter = rsc->
children; iter != NULL; iter = iter->next) {
790 if (orig_rsc == member) {
795 crm_trace(
"Adding mandatory '%s with' colocations to list for " 796 "member %s because earlier member %s is unmanaged",
797 rsc->
id, orig_rsc->
id, member->
id);
798 for (
const GList *cons_iter = rsc->
rsc_cons; cons_iter != NULL;
799 cons_iter = cons_iter->next) {
846 const char *log_id, GHashTable **nodes,
848 float factor, uint32_t
flags)
855 && ((colocation != NULL)
856 || ((target_rsc == NULL) && (*nodes == NULL))));
858 if (log_id == NULL) {
859 log_id = source_rsc->
id;
864 pe_rsc_info(source_rsc,
"%s: Breaking dependency loop at %s",
865 log_id, source_rsc->
id);
885 if (*nodes == NULL) {
888 member = source_rsc->
children->data;
890 pe_rsc_trace(source_rsc,
"%s: Merging scores from group %s using member %s " 891 "(at %.6f)", log_id, source_rsc->
id, member->
id, factor);
893 colocation, factor,
flags);
901 GHashTable *utilization)
906 && (orig_rsc != NULL) && (utilization != NULL));
912 pe_rsc_trace(orig_rsc,
"%s: Adding group %s as colocated utilization",
913 orig_rsc->
id, rsc->
id);
915 || pe_rsc_is_clone(rsc->
parent)) {
917 for (GList *iter = rsc->
children; iter != NULL; iter = iter->next) {
921 && (g_list_find(all_rscs, member) == NULL)) {
932 && (g_list_find(all_rscs, member) == NULL)) {
945 for (GList *iter = rsc->
children; iter != NULL; iter = iter->next) {
pcmk_assignment_methods_t * cmds
Resource assignment methods.
const pcmk_resource_t * pe__const_top_resource(const pcmk_resource_t *rsc, bool include_bundle)
void pcmk__group_create_actions(pcmk_resource_t *rsc)
pcmk_node_t * pcmk__group_assign(pcmk_resource_t *rsc, const pcmk_node_t *prefer, bool stop_if_fail)
G_GNUC_INTERNAL GList * pcmk__colocated_resources(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList *colocated_rscs)
const char * task2text(enum action_tasks task)
#define pcmk__order_starts(rsc1, rsc2, flags)
void pcmk__group_add_colocated_node_scores(pcmk_resource_t *source_rsc, const pcmk_resource_t *target_rsc, const char *log_id, GHashTable **nodes, const pcmk__colocation_t *colocation, float factor, uint32_t flags)
'then' is runnable (and migratable) only if 'first' is runnable
pcmk_scheduler_t * cluster
Cluster that resource is part of.
#define pe_rsc_debug(rsc, fmt, args...)
void pcmk__group_apply_coloc_score(pcmk_resource_t *dependent, const pcmk_resource_t *primary, const pcmk__colocation_t *colocation, bool for_dependent)
Whether action should not be executed.
#define pe__set_action_flags(action, flags_to_set)
void(* create_actions)(pcmk_resource_t *rsc)
uint32_t(* action_flags)(pcmk_action_t *action, const pcmk_node_t *node)
enum rsc_role_e role
Resource's current role.
GList * children
Resource's child resources, if any.
#define pcmk__order_stops(rsc1, rsc2, flags)
enum rsc_role_e next_role
Resource's scheduled next role.
Implementation of pcmk_action_t.
#define pcmk__config_err(fmt...)
Whether node scores should be output instead of logged.
GHashTable * meta
Resource's meta-attributes.
void(* add_colocated_node_scores)(pcmk_resource_t *source_rsc, const pcmk_resource_t *target_rsc, const char *log_id, GHashTable **nodes, const pcmk__colocation_t *colocation, float factor, uint32_t flags)
action_tasks
Possible actions (including some pseudo-actions)
pcmk_node_t *(* assign)(pcmk_resource_t *rsc, const pcmk_node_t *prefer, bool stop_if_fail)
G_GNUC_INTERNAL uint32_t pcmk__update_ordered_actions(pcmk_action_t *first, pcmk_action_t *then, const pcmk_node_t *node, uint32_t flags, uint32_t filter, uint32_t type, pcmk_scheduler_t *scheduler)
enum crm_ais_msg_types type
Implementation of pcmk_scheduler_t.
uint32_t pcmk__group_update_ordered_actions(pcmk_action_t *first, pcmk_action_t *then, const pcmk_node_t *node, uint32_t flags, uint32_t filter, uint32_t type, pcmk_scheduler_t *scheduler)
#define pe__set_resource_flags(resource, flags_to_set)
void(* with_this_colocations)(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList **list)
#define XML_RSC_ATTR_PROMOTABLE
#define PCMK_ACTION_DEMOTE
pcmk_resource_t * parent
Resource's parent resource, if any.
void pe__set_next_role(pcmk_resource_t *rsc, enum rsc_role_e role, const char *why)
Whether resource is in the process of being assigned to a node.
G_GNUC_INTERNAL void pcmk__add_with_this_list(GList **list, GList *addition, const pcmk_resource_t *rsc)
Implementation of pcmk_resource_t.
uint32_t pcmk__group_action_flags(pcmk_action_t *action, const pcmk_node_t *node)
Actions are ordered (optionally, if no other flags are set)
void(* apply_location)(pcmk_resource_t *rsc, pe__location_t *location)
pcmk_resource_t * pe__last_group_member(const pcmk_resource_t *group)
G_GNUC_INTERNAL void pcmk__add_this_with(GList **list, const pcmk__colocation_t *colocation, const pcmk_resource_t *rsc)
void(* this_with_colocations)(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList **list)
#define pe__clear_action_flags(action, flags_to_clear)
#define crm_trace(fmt, args...)
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
#define PCMK_ACTION_START
void(* shutdown_lock)(pcmk_resource_t *rsc)
unsigned long long flags
Group of enum pcmk_rsc_flags.
GList * pcmk__group_colocated_resources(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList *colocated_rscs)
GList *(* colocated_resources)(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList *colocated_rscs)
void pcmk__group_with_colocations(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList **list)
char * pcmk__op_key(const char *rsc_id, const char *op_type, guint interval_ms)
Generate an operation key (RESOURCE_ACTION_INTERVAL)
Implementation of pcmk_node_t.
enum pe_obj_types variant
Resource variant.
G_GNUC_INTERNAL void pcmk__apply_location(pcmk_resource_t *rsc, pe__location_t *constraint)
#define pcmk__order_resource_actions(first_rsc, first_task, then_rsc, then_task, flags)
void(* apply_coloc_score)(pcmk_resource_t *dependent, const pcmk_resource_t *primary, const pcmk__colocation_t *colocation, bool for_dependent)
pcmk_action_t * custom_action(pcmk_resource_t *rsc, char *key, const char *task, const pcmk_node_t *on_node, gboolean optional, pcmk_scheduler_t *scheduler)
Create or update an action object.
Whether resource has "critical" meta-attribute enabled.
Whether resource has not yet been assigned to a node.
Whether resource is in the process of modifying allowed node scores.
If 'then' is required, 'first' must be added to the transition graph.
Whether action is runnable.
void(* internal_constraints)(pcmk_resource_t *rsc)
void pcmk__group_apply_location(pcmk_resource_t *rsc, pe__location_t *location)
GList * pcmk__copy_node_list(const GList *list, bool reset)
pcmk_action_t * find_first_action(const GList *input, const char *uuid, const char *task, const pcmk_node_t *on_node)
pcmk_scheduler_t * scheduler
Whether action does not require invoking an agent.
G_GNUC_INTERNAL void pcmk__add_this_with_list(GList **list, GList *addition, const pcmk_resource_t *rsc)
If 'first' is required and runnable, 'then' must be in graph.
#define PCMK_ACTION_STOPPED
void pcmk__group_add_utilization(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList *all_rscs, GHashTable *utilization)
pcmk_node_t * allocated_to
Node resource is assigned to.
#define pe__clear_resource_flags(resource, flags_to_clear)
void pcmk__group_shutdown_lock(pcmk_resource_t *rsc)
#define PCMK_ACTION_PROMOTE
void pcmk__with_group_colocations(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList **list)
#define pe__show_node_scores(level, rsc, text, nodes, scheduler)
GList * running_on
Nodes where resource may be active.
uint32_t(* update_ordered_actions)(pcmk_action_t *first, pcmk_action_t *then, const pcmk_node_t *node, uint32_t flags, uint32_t filter, uint32_t type, pcmk_scheduler_t *scheduler)
#define PCMK_ACTION_PROMOTED
gboolean crm_is_true(const char *s)
pcmk_resource_t * rsc
Resource to apply action to, if any.
Whether resource can be promoted and demoted.
G_GNUC_INTERNAL void pcmk__new_colocation(const char *id, const char *node_attr, int score, pcmk_resource_t *dependent, pcmk_resource_t *primary, const char *dependent_role, const char *primary_role, uint32_t flags)
#define pe_rsc_trace(rsc, fmt, args...)
#define pe__set_order_flags(order_flags, flags_to_set)
#define PCMK_ACTION_RUNNING
unsigned long long flags
Group of enum pcmk_scheduler_flags.
bool pe__group_flag_is_set(const pcmk_resource_t *group, uint32_t flags)
#define PCMK_ACTION_DEMOTED
enum action_tasks get_complex_task(const pcmk_resource_t *rsc, const char *name)
Whether resource is managed.
#define pe__clear_raw_action_flags(action_flags, action_name, flags_to_clear)
void(* add_utilization)(const pcmk_resource_t *rsc, const pcmk_resource_t *orig_rsc, GList *all_rscs, GHashTable *utilization)
void pcmk__group_internal_constraints(pcmk_resource_t *rsc)
#define pe_rsc_info(rsc, fmt, args...)
No relation (compare with equality rather than bit set)
char * id
Resource ID in configuration.
GHashTable * allowed_nodes
Nodes where resource may run (key is node ID, not name)