Class ShutdownVM
java.lang.Object
org.btrplace.scheduler.choco.transition.ShutdownVM
- All Implemented Interfaces:
Transition<VMState>
,VMTransition
public class ShutdownVM extends Object implements VMTransition
Model an action that stop a running VM.
An estimation of the action duration must be provided through a
ActionDurationEvaluator
accessible from
ReconfigurationProblem.getDurationEvaluators()
with the key ShutdownVM.class
If the reconfiguration problem has a solution, a ShutdownVM
action is inserted
into the resulting reconfiguration plan.
- Author:
- Fabien Hermenier
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ShutdownVM.Builder
The builder devoted to a running -> ready transition. -
Field Summary
Fields Modifier and Type Field Description static String
VAR_PREFIX
The prefix to use for the variables -
Constructor Summary
Constructors Constructor Description ShutdownVM(ReconfigurationProblem p, VM e)
Make a new model. -
Method Summary
Modifier and Type Method Description Slice
getCSlice()
Get the slice denoting the possible current placement of the subject on a node.Slice
getDSlice()
Get the slice denoting the possible future placement off the subjectorg.chocosolver.solver.variables.IntVar
getDuration()
Get the action duration.org.chocosolver.solver.variables.IntVar
getEnd()
Get the moment the action ends.VMState
getFutureState()
Get the future VM state.VMState
getSourceState()
Get the VM initial state.org.chocosolver.solver.variables.IntVar
getStart()
Get the moment the action starts.org.chocosolver.solver.variables.BoolVar
getState()
Get the next state of the subject manipulated by the action.VM
getVM()
Get the VM manipulated by the action.boolean
insertActions(org.chocosolver.solver.Solution s, ReconfigurationPlan plan)
Insert into a plan the actions resulting from the model.boolean
isManaged()
Tell if this actions allow the management of the VM.String
toString()
-
Field Details
-
VAR_PREFIX
The prefix to use for the variables- See Also:
- Constant Field Values
-
-
Constructor Details
-
ShutdownVM
Make a new model.- Parameters:
p
- the RP to use as a basis.e
- the VM managed by the action- Throws:
SchedulerException
- if an error occurred
-
-
Method Details
-
isManaged
public boolean isManaged()Description copied from interface:VMTransition
Tell if this actions allow the management of the VM. Typically if it is possible to have a resulting action.- Specified by:
isManaged
in interfaceVMTransition
- Returns:
true
if the VM must be manipulated
-
insertActions
Description copied from interface:Transition
Insert into a plan the actions resulting from the model. The variable values must be extracted from the solution objects
and not directly.- Specified by:
insertActions
in interfaceTransition<VMState>
- Parameters:
s
- the solution computed by the solver.plan
- the plan to modify- Returns:
true
iff success
-
getVM
Description copied from interface:VMTransition
Get the VM manipulated by the action.- Specified by:
getVM
in interfaceVMTransition
- Returns:
- the VM identifier
-
getStart
public org.chocosolver.solver.variables.IntVar getStart()Description copied from interface:Transition
Get the moment the action starts.- Specified by:
getStart
in interfaceTransition<VMState>
- Returns:
- a variable that must be positive
-
getEnd
public org.chocosolver.solver.variables.IntVar getEnd()Description copied from interface:Transition
Get the moment the action ends.- Specified by:
getEnd
in interfaceTransition<VMState>
- Returns:
- a variable that must be greater than
Transition.getStart()
-
getDuration
public org.chocosolver.solver.variables.IntVar getDuration()Description copied from interface:Transition
Get the action duration.- Specified by:
getDuration
in interfaceTransition<VMState>
- Returns:
- a duration equals to
getEnd() - getStart()
-
getCSlice
Description copied from interface:VMTransition
Get the slice denoting the possible current placement of the subject on a node.- Specified by:
getCSlice
in interfaceVMTransition
- Returns:
- a
Slice
that may benull
-
getDSlice
Description copied from interface:VMTransition
Get the slice denoting the possible future placement off the subject- Specified by:
getDSlice
in interfaceVMTransition
- Returns:
- a
Slice
that may benull
-
getState
public org.chocosolver.solver.variables.BoolVar getState()Description copied from interface:Transition
Get the next state of the subject manipulated by the action.- Specified by:
getState
in interfaceTransition<VMState>
- Returns:
0
for offline,1
for online.
-
getSourceState
Description copied from interface:VMTransition
Get the VM initial state.- Specified by:
getSourceState
in interfaceVMTransition
- Returns:
- a state
-
getFutureState
Description copied from interface:VMTransition
Get the future VM state.- Specified by:
getFutureState
in interfaceVMTransition
- Returns:
- a state
-
toString
-