paradrop.core.plan package

Submodules

paradrop.core.plan.executionplan module

This module contains the methods required to generate and act upon execution plans.

An execution plan is a set of operations that must be performed to update a Chute from some old state into the new state provided by the API server.

All plans that are generated are function pointers, as in no actual operations are performed during the generation process.

abortPlans(update)[source]

This function should be called if one of the Plan objects throws an Exception. It takes the PlanMap argument and calls the getNextAbort function just like executePlans does with todoPlans. This dynamically generates an abort plan list based on what plans were originally executed. Returns:

True in error : This is really bad False otherwise : we were able to restore system state back to before the executeplans function was called
aggregatePlans(update)[source]

Takes the PlanMap provided which can be a combination of changes for multiple different chutes and it puts things into a sane order and removes duplicates where possible.

This keeps things like reloading networking from happening twice if 2 chutes make changes.

Returns:
A new PlanMap that should be executed
executePlans(update)[source]

Primary function that actually executes all the functions that were added to plans by all the exc modules. This function can heavily modify the OS/files/etc.. so the return value is very important. Returns:

True in error : abortPlans function should be called False otherwise : everything is OK
generatePlans(update)[source]

For an update object provided this function references the updateModuleList which lets all exc modules determine if they need to add functions to change the state of the system when new chutes are added to the OS.

Returns: True in error, as in we should stop with this update plan

paradrop.core.plan.hostconfig module

This module generates update plans for a host configuration operation. It is separate from the modules that generate plans for chute operations because we only need to do a subset of the operations.

generatePlans(update)[source]

paradrop.core.plan.name module

generatePlans(update)[source]

This function looks at a diff of the current Chute (in @chuteStor) and the @newChute, then adds Plan() calls to make the Chute match the @newChute.

Returns:
True: abort the plan generation process

paradrop.core.plan.plangraph module

class Plan(func, *args)[source]

Helper class to hold onto the actual plan data associated with each plan

class PlanMap(name)[source]

This class helps build a dependency graph required to determine what steps are required to update a Chute from a previous version of its configuration.

addMap(other)[source]

Takes another PlanMap object and appends whatever the plans are into this plans object.

addPlans(priority, todoPlan, abortPlan=[])[source]

Adds new Plan objects into the list of plans for this PlanMap.

Arguments:

@priority : The priority number (1 is done first, 99 done last - see PRIORITYFLAGS section at top of this file) @todoPlan : A tuple of (function, (args)), this is the function that completes the actual task requested

the args can either be a single variable, a tuple of variables, or None.
@abortPlan : A tuple of (function, (args)) or a list of tuple or None.
This is what should be called if a plan somewhere in the chain fails and we need to undo the work we did here - this function is only called if a higher priority function fails (ie we were called, then something later on fails that would cause us to undo everything we did to setup/change the Chute).
getNextAbort()[source]

Like an iterator function, it returns each element in the list of abort plans in order.

Returns:
(function, args) : Each todo is returned just how the user first added it None : None is returned when there are no more todo’s
getNextTodo()[source]

Like an iterator function, it returns each element in the list of plans in order.

Returns:
(function, args) : Each todo is returned just how the user first added it None : None is returned when there are no more todo’s
registerSkip(func)[source]

Register this function as one to skip execution on, if provided it shouldn’t return the (func, args) tuple as a result from the getNextTodo function.

sort()[source]

Sorts the plans based on priority.

paradrop.core.plan.resource module

generatePlans(update)[source]

This function looks at a diff of the current Chute (in @chuteStor) and the @newChute, then adds Plan() calls to make the Chute match the @newChute.

Returns:
True: abort the plan generation process

paradrop.core.plan.router module

This module generates update plans for router operations such as factory reset.

generatePlans(update)[source]

paradrop.core.plan.runtime module

generatePlans(update)[source]

This function looks at a diff of the current Chute (in @chuteStor) and the @newChute, then adds Plan() calls to make the Chute match the @newChute.

Returns:
True: abort the plan generation process

paradrop.core.plan.snap module

This module generates update plans for a snap operation.

generatePlans(update)[source]

paradrop.core.plan.state module

generatePlans(update)[source]

This function looks at a diff of the current Chute (in @chuteStor) and the @newChute, then adds Plan() calls to make the Chute match the @newChute.

Returns:
True: abort the plan generation process
generate_service_plans(update)[source]

Generate plans that depend on the services configured for the chute.

This needs to happen after the chute configuration has been parsed.

validate_change(update)[source]

Check if the update is a valid change.

paradrop.core.plan.struct module

generatePlans(update)[source]

This function looks at a diff of the current Chute (in @chuteStor) and the @newChute, then adds Plan() calls to make the Chute match the @newChute.

Returns:
True: abort the plan generation process

paradrop.core.plan.traffic module

generatePlans(update)[source]

This function looks at a diff of the current Chute (in @chuteStor) and the @newChute, then adds Plan() calls to make the Chute match the @newChute.

Returns:
True: abort the plan generation process

Module contents