Skip to content

Commit

Permalink
prototyping new migration logic
Browse files Browse the repository at this point in the history
  • Loading branch information
davidvossel committed Oct 22, 2013
1 parent f1bb2a8 commit 673e859
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 450 deletions.
6 changes: 6 additions & 0 deletions include/crm/pengine/status.h
Expand Up @@ -206,6 +206,7 @@ enum pe_action_flags {
pe_action_have_node_attrs = 0x00010,
pe_action_failure_is_fatal = 0x00020,
pe_action_implied_by_stonith = 0x00040,
pe_action_migrate_runnable = 0x00080,

pe_action_dumped = 0x00100,
pe_action_processed = 0x00200,
Expand Down Expand Up @@ -326,8 +327,13 @@ enum pe_ordering {
pe_order_implies_then = 0x20, /* If 'then' is required, ensure 'first' is too */
pe_order_implies_first_master = 0x40, /* Imply 'first' is required when 'then' is required and then's rsc holds Master role. */

/* first requires then to be both runnable and migrate runnable. */
pe_order_implies_first_migratable = 0x80,

pe_order_runnable_left = 0x100, /* 'then' requires 'first' to be runnable */

pe_order_pseudo_left = 0x200, /* 'then' can only be pseudo if 'first' is runnable */

pe_order_restart = 0x1000, /* 'then' is runnable if 'first' is optional or runnable */
pe_order_stonith_stop = 0x2000, /* only applies if the action is non-pseudo */
pe_order_serialize_only = 0x4000, /* serialize */
Expand Down
5 changes: 2 additions & 3 deletions pengine/allocate.c
Expand Up @@ -1740,16 +1740,15 @@ stage7(pe_working_set_t * data_set)
update_action(action);
}

crm_trace("Processing migrations");
crm_trace("Processing reloads");

gIter = data_set->resources;
for (; gIter != NULL; gIter = gIter->next) {
resource_t *rsc = (resource_t *) gIter->data;

rsc_migrate_reload(rsc, data_set);
rsc_reload(rsc, data_set);
LogActions(rsc, data_set, FALSE);
}

return TRUE;
}

Expand Down
2 changes: 1 addition & 1 deletion pengine/allocate.h
Expand Up @@ -157,7 +157,7 @@ extern gboolean expand_notification_data(notify_data_t * n_data);
extern void create_notifications(resource_t * rsc, notify_data_t * n_data,
pe_working_set_t * data_set);
extern void free_notification_data(notify_data_t * n_data);
extern void rsc_migrate_reload(resource_t * rsc, pe_working_set_t * data_set);
extern void rsc_reload(resource_t * rsc, pe_working_set_t * data_set);
extern void rsc_stonith_ordering(resource_t * rsc, action_t * stonith_op,
pe_working_set_t * data_set);

Expand Down
34 changes: 34 additions & 0 deletions pengine/graph.c
Expand Up @@ -290,6 +290,34 @@ graph_update_action(action_t * first, action_t * then, node_t * node, enum pe_ac
}
}

if (type & pe_order_implies_first_migratable) {
processed = TRUE;
if (then->rsc) {
changed |=
then->rsc->cmds->update_actions(first, then, node, flags,
pe_action_optional, pe_order_implies_first_migratable);
}
if (changed) {
pe_rsc_trace(then->rsc, "optional: %s then %s: changed", first->uuid, then->uuid);
} else {
crm_trace("optional: %s then %s", first->uuid, then->uuid);
}
}

if (type & pe_order_pseudo_left) {
processed = TRUE;
if (then->rsc) {
changed |=
then->rsc->cmds->update_actions(first, then, node, flags,
pe_action_optional, pe_order_pseudo_left);
}
if (changed) {
pe_rsc_trace(then->rsc, "optional: %s then %s: changed", first->uuid, then->uuid);
} else {
crm_trace("optional: %s then %s", first->uuid, then->uuid);
}
}

if (type & pe_order_optional) {
processed = TRUE;
if (then->rsc) {
Expand Down Expand Up @@ -962,6 +990,12 @@ should_dump_input(int last_action, action_t * action, action_wrapper_t * wrapper
wrapper->action->id, wrapper->action->uuid, action->uuid);
return FALSE;

} else if (wrapper->type & pe_order_implies_first_migratable) {
if (is_set(wrapper->action->flags, pe_action_runnable) == FALSE) {

return FALSE;
}

} else if (wrapper->type == pe_order_load) {
crm_trace("check load filter %s.%s -> %s.%s",
wrapper->action->uuid,
Expand Down

0 comments on commit 673e859

Please sign in to comment.