16 #define VARIANT_GROUP 1
26 group_variant_data_t *group_data = NULL;
28 get_group_variant_data(group_data, rsc);
34 pe_rsc_debug(rsc,
"Dependency loop detected involving %s", rsc->
id);
38 if (group_data->first_child == NULL) {
45 rsc->
role = group_data->first_child->role;
47 group_data->first_child->rsc_cons =
48 g_list_concat(group_data->first_child->rsc_cons, rsc->
rsc_cons);
51 group_data->last_child->rsc_cons_lhs =
52 g_list_concat(group_data->last_child->rsc_cons_lhs, rsc->
rsc_cons_lhs);
58 for (; gIter != NULL; gIter = gIter->next) {
62 rsc->
id, child_rsc->
id);
63 node = child_rsc->
cmds->
allocate(child_rsc, prefer, data_set);
64 if (group_node == NULL) {
69 rsc->
next_role = group_data->first_child->next_role;
73 if (group_data->colocated) {
85 const char *value = NULL;
90 for (; gIter != NULL; gIter = gIter->next) {
133 group_variant_data_t *group_data = NULL;
135 get_group_variant_data(group_data, parent);
137 if (group_data->ordered == FALSE) {
142 if (group_data->child_stopping && group_data->child_starting) {
146 for (; gIter != NULL; gIter = gIter->next) {
153 group_data->child_stopping = TRUE;
158 group_data->child_starting = TRUE;
171 group_variant_data_t *group_data = NULL;
173 get_group_variant_data(group_data, rsc);
179 for (; gIter != NULL; gIter = gIter->next) {
189 if (last_rsc == NULL) {
190 if (group_data->ordered) {
195 }
else if (group_data->colocated) {
197 child_rsc, last_rsc, NULL, NULL, data_set);
220 if (group_data->ordered == FALSE) {
227 }
else if (last_rsc != NULL) {
259 if (group_data->ordered
264 last_active = child_rsc;
267 last_rsc = child_rsc;
270 if (group_data->ordered && last_rsc != NULL) {
290 group_variant_data_t *group_data = NULL;
292 if (rsc_lh == NULL) {
293 pe_err(
"rsc_lh was NULL for %s", constraint->
id);
296 }
else if (rsc_rh == NULL) {
297 pe_err(
"rsc_rh was NULL for %s", constraint->
id);
300 if (constraint->
score == 0) {
305 pe_rsc_trace(rsc_lh,
"Processing constraints from %s", rsc_lh->
id);
307 get_group_variant_data(group_data, rsc_lh);
309 if (group_data->colocated) {
310 group_data->first_child->cmds->rsc_colocation_lh(group_data->first_child,
317 "between non-colocated group and %s",
318 rsc_lh->
id, rsc_rh->
id);
322 for (; gIter != NULL; gIter = gIter->next) {
336 group_variant_data_t *group_data = NULL;
338 get_group_variant_data(group_data, rsc_rh);
341 if (constraint->
score == 0) {
344 pe_rsc_trace(rsc_rh,
"Processing RH %s of constraint %s (LH is %s)",
345 rsc_rh->
id, constraint->
id, rsc_lh->
id);
350 }
else if (group_data->colocated && group_data->first_child) {
353 group_data->last_child->cmds->rsc_colocation_rh(rsc_lh,
354 group_data->last_child,
359 group_data->first_child->cmds->rsc_colocation_rh(rsc_lh,
360 group_data->first_child,
369 " non-colocated group %s", rsc_lh->
id, rsc_rh->
id);
373 for (; gIter != NULL; gIter = gIter->next) {
387 for (gIter = action->
rsc->
children; gIter != NULL; gIter = gIter->next) {
413 pe_rsc_trace(action->
rsc,
"%s is not runnable because of %s (not found in %s)",
414 action->
uuid, task_s, child->
id);
434 for (; gIter != NULL; gIter = gIter->next) {
454 gboolean reset_scores = TRUE;
455 group_variant_data_t *group_data = NULL;
457 get_group_variant_data(group_data, rsc);
459 pe_rsc_debug(rsc,
"Processing rsc_location %s for %s", constraint->
id, rsc->
id);
463 for (; gIter != NULL; gIter = gIter->next) {
467 if (group_data->colocated && reset_scores) {
468 reset_scores = FALSE;
474 g_list_free_full(zero, free);
494 GHashTable *nodes,
const char *attr,
float factor,
498 group_variant_data_t *group_data = NULL;
500 get_group_variant_data(group_data, rsc);
503 pe_rsc_info(rsc,
"Breaking dependency loop with %s at %s", rsc->
id, rhs);
510 group_data->first_child->cmds->merge_weights(group_data->first_child, rhs, nodes, attr,
513 for (; gIter != NULL; gIter = gIter->next) {
516 if (constraint->
score == 0) {
GList * pcmk__copy_node_list(const GList *list, bool reset)
#define CRM_CHECK(expr, failure_action)
gboolean rsc_colocation_new(const char *id, const char *node_attr, int score, pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, const char *state_lh, const char *state_rh, pe_working_set_t *data_set)
void group_append_meta(pe_resource_t *rsc, xmlNode *xml)
const char * task2text(enum action_tasks task)
#define pe_rsc_debug(rsc, fmt, args...)
gboolean safe_str_neq(const char *a, const char *b)
#define stop_action(rsc, node, optional)
resource_alloc_functions_t * cmds
#define pcmk__config_err(fmt...)
enum pe_action_flags(* action_flags)(pe_action_t *, pe_node_t *)
enum rsc_role_e next_role
#define pe__show_node_weights(level, rsc, text, nodes)
void(* rsc_colocation_lh)(pe_resource_t *, pe_resource_t *, rsc_colocation_t *, pe_working_set_t *)
enum pe_graph_flags(* update_actions)(pe_action_t *, pe_action_t *, pe_node_t *, enum pe_action_flags, enum pe_action_flags, enum pe_ordering, pe_working_set_t *data_set)
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)
#define clear_bit(word, bit)
void native_rsc_location(pe_resource_t *rsc, pe__location_t *constraint)
GHashTable * pcmk__native_merge_weights(pe_resource_t *rsc, const char *rhs, GHashTable *nodes, const char *attr, float factor, uint32_t flags)
void(* rsc_colocation_rh)(pe_resource_t *, pe_resource_t *, rsc_colocation_t *, pe_working_set_t *)
void group_rsc_colocation_lh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, rsc_colocation_t *constraint, pe_working_set_t *data_set)
void group_update_pseudo_status(pe_resource_t *parent, pe_resource_t *child)
#define pe_rsc_provisional
#define XML_RSC_ATTR_PROMOTABLE
#define set_bit(word, bit)
void(* create_actions)(pe_resource_t *, pe_working_set_t *)
#define order_stop_stop(rsc1, rsc2, type)
pe_resource_t * uber_parent(pe_resource_t *rsc)
const char * node_attribute
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)
void group_rsc_colocation_rh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc, rsc_colocation_t *constraint, pe_working_set_t *data_set)
enum action_tasks get_complex_task(pe_resource_t *rsc, const char *name, gboolean allow_non_atomic)
#define pe_rsc_promotable
GHashTable * pcmk__group_merge_weights(pe_resource_t *rsc, const char *rhs, GHashTable *nodes, const char *attr, float factor, uint32_t flags)
void(* expand)(pe_resource_t *, pe_working_set_t *)
enum pe_restart restart_type
#define pe_rsc_allocating
void group_internal_constraints(pe_resource_t *rsc, pe_working_set_t *data_set)
enum pe_obj_types variant
int new_rsc_order(pe_resource_t *lh_rsc, const char *lh_task, pe_resource_t *rh_rsc, const char *rh_task, enum pe_ordering type, pe_working_set_t *data_set)
void(* rsc_location)(pe_resource_t *, pe__location_t *)
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)
#define promoted_key(rsc)
#define start_action(rsc, node, optional)
#define pe_clear_action_bit(action, bit)
void(* internal_constraints)(pe_resource_t *, pe_working_set_t *)
enum pe_action_flags flags
#define order_start_start(rsc1, rsc2, type)
gboolean crm_is_true(const char *s)
#define pe_rsc_trace(rsc, fmt, args...)
pe_action_t * find_first_action(GListPtr input, const char *uuid, const char *task, pe_node_t *on_node)
#define safe_str_eq(a, b)
void group_expand(pe_resource_t *rsc, pe_working_set_t *data_set)
enum crm_ais_msg_types type
#define pe_rsc_info(rsc, fmt, args...)
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)
GHashTable * allowed_nodes
pe_node_t *(* allocate)(pe_resource_t *, pe_node_t *, pe_working_set_t *)
pe_node_t * pcmk__group_allocate(pe_resource_t *rsc, pe_node_t *preferred, pe_working_set_t *data_set)