ganeti
Safe HaskellNone

Ganeti.HTools.Cluster.Evacuate

Description

Implementation of node evacuation

Synopsis

Documentation

data EvacSolution Source #

Node evacuation/group change iallocator result type. This result type consists of actual opcodes (a restricted subset) that are transmitted back to Ganeti.

Constructors

EvacSolution 

Fields

Instances

Instances details
Show EvacSolution # 
Instance details

Defined in Ganeti.HTools.Cluster.Evacuate

Methods

showsPrec :: Int -> EvacSolution -> ShowS

show :: EvacSolution -> String

showList :: [EvacSolution] -> ShowS

emptyEvacSolution :: EvacSolution Source #

The empty evac solution.

reverseEvacSolution :: EvacSolution -> EvacSolution Source #

Reverses an evacuation solution.

Rationale: we always concat the results to the top of the lists, so for proper jobset execution, we should reverse all lists.

type EvacInnerState = Either String (List, Instance, Score, Ndx) Source #

A simple type for the running solution of evacuations.

failOnSecondaryChange :: MonadFail m => EvacMode -> DiskTemplate -> m () Source #

Function which fails if the requested mode is change secondary.

This is useful since except DRBD, no other disk template can execute change secondary; thus, we can just call this function instead of always checking for secondary mode. After the call to this function, whatever mode we have is just a primary change.

evacOneNodeInner Source #

Arguments

:: AlgorithmOptions 
-> List

Cluster node list

-> Instance

Instance being evacuated

-> Gdx

The group index of the instance

-> (Ndx -> IMove)

Operation constructor

-> EvacInnerState

Current best solution

-> Ndx

Node we're evaluating as target

-> EvacInnerState

New best solution

Inner fold function for changing one node of an instance.

Depending on the instance disk template, this will either change the secondary (for DRBD) or the primary node (for shared storage). However, the operation is generic otherwise.

The running solution is either a Left String, which means we don't have yet a working solution, or a Right (...), which represents a valid solution; it holds the modified node list, the modified instance (after evacuation), the score of that solution, and the new secondary node index.

evacOneNodeOnly Source #

Arguments

:: AlgorithmOptions 
-> List

The node list (cluster-wide)

-> List

Instance list (cluster-wide)

-> Instance

The instance to be evacuated

-> Gdx

The group we're targetting

-> [Ndx]

The list of available nodes for allocation

-> Result (List, List, [OpCode]) 

Generic function for changing one node of an instance.

This is similar to nodeEvacInstance but will be used in a few of its sub-patterns. It folds the inner function evacOneNodeInner over the list of available nodes, which results in the best choice for relocation.

evacDrbdAllInner Source #

Arguments

:: AlgorithmOptions 
-> List

Cluster node list

-> List

Cluster instance list

-> Instance

The instance to be moved

-> Gdx

The target group index (which can differ from the current group of the instance)

-> (Ndx, Ndx)

Tuple of new primary/secondary nodes

-> Result (List, List, [OpCode], Score) 

Compute result of changing all nodes of a DRBD instance.

Given the target primary and secondary node (which might be in a different group or not), this function will execute all the required steps and assuming all operations succceed, will return the modified node and instance lists, the opcodes needed for this and the new group score.

nodeEvacInstance Source #

Arguments

:: AlgorithmOptions 
-> List

The node list (cluster-wide)

-> List

Instance list (cluster-wide)

-> EvacMode

The evacuation mode

-> Instance

The instance to be evacuated

-> Gdx

The group we're targetting

-> [Ndx]

The list of available nodes for allocation

-> Result (List, List, [OpCode]) 

Run evacuation for a single instance.

Note: this function should correctly execute both intra-group evacuations (in all modes) and inter-group evacuations (in the ChangeAll mode). Of course, this requires that the correct list of target nodes is passed.

updateEvacSolution :: (List, List, EvacSolution) -> Idx -> Result (List, List, [OpCode]) -> (List, List, EvacSolution) Source #

Updates the evac solution with the results of an instance evacuation.

nodesToEvacuate Source #

Arguments

:: List

The cluster-wide instance list

-> EvacMode

The evacuation mode we're using

-> [Idx]

List of instance indices being evacuated

-> IntSet

Set of node indices

Compute the list of nodes that are to be evacuated, given a list of instances and an evacuation mode.

tryNodeEvac Source #

Arguments

:: AlgorithmOptions 
-> List

The cluster groups

-> List

The node list (cluster-wide, not per group)

-> List

Instance list (cluster-wide)

-> EvacMode

The evacuation mode

-> [Idx]

List of instance (indices) to be evacuated

-> Result (List, List, EvacSolution) 

Node-evacuation IAllocator mode main function.