|
|
|
|
|
Description |
Implementation of cluster-wide logic.
This module holds all pure cluster-logic; I/O related functionality
goes into the Main module for the individual binaries.
|
|
Synopsis |
|
type AllocSolution = ([FailMode], Int, [(Score, AllocElement)]) | | data Table = Table List List Score [Placement] | | data CStats = CStats {} | | type AllocStats = (RSpec, RSpec, RSpec) | | verifyN1 :: [Node] -> [Node] | | computeBadItems :: List -> List -> ([Node], [Instance]) | | emptyCStats :: CStats | | updateCStats :: CStats -> Node -> CStats | | totalResources :: List -> CStats | | computeAllocationDelta :: CStats -> CStats -> AllocStats | | detailedCVInfo :: [(Double, String)] | | detailedCVWeights :: [Double] | | compDetailedCV :: List -> [Double] | | compCV :: List -> Double | | getOnline :: List -> [Node] | | compareTables :: Table -> Table -> Table | | applyMove :: List -> Instance -> IMove -> OpResult (List, Instance, Ndx, Ndx) | | allocateOnSingle :: List -> Instance -> Node -> OpResult AllocElement | | allocateOnPair :: List -> Instance -> Node -> Node -> OpResult AllocElement | | checkSingleStep :: Table -> Instance -> Table -> IMove -> Table | | possibleMoves :: Bool -> Ndx -> [IMove] | | checkInstanceMove :: [Ndx] -> Bool -> Table -> Instance -> Table | | checkMove :: [Ndx] -> Bool -> Table -> [Instance] -> Table | | doNextBalance :: Table -> Int -> Score -> Bool | | tryBalance :: Table -> Bool -> Bool -> Score -> Score -> Maybe Table | | collapseFailures :: [FailMode] -> FailStats | | concatAllocs :: AllocSolution -> OpResult AllocElement -> AllocSolution | | tryAlloc :: Monad m => List -> List -> Instance -> Int -> m AllocSolution | | tryReloc :: Monad m => List -> List -> Idx -> Int -> [Ndx] -> m AllocSolution | | tryEvac :: Monad m => List -> List -> [Ndx] -> m AllocSolution | | iterateAlloc :: List -> List -> Instance -> Int -> [Instance] -> Result (FailStats, List, List, [Instance]) | | tieredAlloc :: List -> List -> Instance -> Int -> [Instance] -> Result (FailStats, List, List, [Instance]) | | computeMoves :: Instance -> String -> IMove -> String -> String -> (String, [String]) | | printSolutionLine :: List -> List -> Int -> Int -> Placement -> Int -> (String, [String]) | | involvedNodes :: List -> Placement -> [Ndx] | | mergeJobs :: ([JobSet], [Ndx]) -> MoveJob -> ([JobSet], [Ndx]) | | splitJobs :: [MoveJob] -> [JobSet] | | formatJob :: Int -> Int -> (Int, MoveJob) -> [String] | | formatCmds :: [JobSet] -> String | | printNodes :: List -> [String] -> String | | printInsts :: List -> List -> String | | printStats :: List -> String | | iMoveToJob :: List -> List -> Idx -> IMove -> [OpCode] |
|
|
|
Types
|
|
|
Allocation/relocation solution.
|
|
|
The complete state for the balancing solution
| Constructors | |
|
|
|
Constructors | CStats | | csFmem :: Int | Cluster free mem
| csFdsk :: Int | Cluster free disk
| csAmem :: Int | Cluster allocatable mem
| csAdsk :: Int | Cluster allocatable disk
| csAcpu :: Int | Cluster allocatable cpus
| csMmem :: Int | Max node allocatable mem
| csMdsk :: Int | Max node allocatable disk
| csMcpu :: Int | Max node allocatable cpu
| csImem :: Int | Instance used mem
| csIdsk :: Int | Instance used disk
| csIcpu :: Int | Instance used cpu
| csTmem :: Double | Cluster total mem
| csTdsk :: Double | Cluster total disk
| csTcpu :: Double | Cluster total cpus
| csVcpu :: Int | Cluster virtual cpus (if
node pCpu has been set,
otherwise -1)
| csXmem :: Int | Unnacounted for mem
| csNmem :: Int | Node own memory
| csScore :: Score | The cluster score
| csNinst :: Int | The total number of instances
|
|
|
|
|
|
Currently used, possibly to allocate, unallocable
|
|
Utility functions
|
|
|
Verifies the N+1 status and return the affected nodes.
|
|
|
Computes the pair of bad nodes and instances.
The bad node list is computed via a simple verifyN1 check, and the
bad instance list is the list of primary and secondary instances of
those nodes.
|
|
|
Zero-initializer for the CStats type
|
|
|
Update stats with data from a new node
|
|
|
Compute the total free disk and memory in the cluster.
|
|
|
Compute the delta between two cluster state.
This is used when doing allocations, to understand better the
available cluster resources. The return value is a triple of the
current used values, the delta that was still allocated, and what
was left unallocated.
|
|
detailedCVInfo :: [(Double, String)] | Source |
|
The names and weights of the individual elements in the CV list
|
|
detailedCVWeights :: [Double] | Source |
|
|
|
Compute the mem and disk covariance.
|
|
|
Compute the total variance.
|
|
|
Compute online nodes from a Node.List
|
|
hbal functions
|
|
|
Compute best table. Note that the ordering of the arguments is important.
|
|
|
Applies an instance move to a given node list and instance.
|
|
|
Tries to allocate an instance on one given node.
|
|
|
Tries to allocate an instance on a given pair of nodes.
|
|
|
:: Table | The original table
| -> Instance | The instance to move
| -> Table | The current best table
| -> IMove | The move to apply
| -> Table | The final best table
| Tries to perform an instance move and returns the best table
between the original one and the new one.
|
|
|
|
:: Bool | Whether the secondary node is a valid new node
| -> Ndx | Target node candidate
| -> [IMove] | List of valid result moves
| Given the status of the current secondary as a valid new node and
the current candidate target node, generate the possible moves for
a instance.
|
|
|
|
:: [Ndx] | Allowed target node indices
| -> Bool | Whether disk moves are allowed
| -> Table | Original table
| -> Instance | Instance to move
| -> Table | Best new table for this instance
| Compute the best move for a given instance.
|
|
|
|
:: [Ndx] | Allowed target node indices
| -> Bool | Whether disk moves are allowed
| -> Table | The current solution
| -> [Instance] | List of instances still to move
| -> Table | The new solution
| Compute the best next move.
|
|
|
|
:: Table | The starting table
| -> Int | Remaining length
| -> Score | Score at which to stop
| -> Bool | The resulting table and commands
| Check if we are allowed to go deeper in the balancing
|
|
|
|
:: Table | The starting table
| -> Bool | Allow disk moves
| -> Bool | Only evacuate moves
| -> Score | Min gain threshold
| -> Score | Min gain
| -> Maybe Table | The resulting table and commands
| Run a balance move
|
|
|
Allocation functions
|
|
|
Build failure stats out of a list of failures
|
|
|
Update current Allocation solution and failure stats with new
elements
|
|
|
:: Monad m | | => List | The instance list
| -> List | The instance to allocate
| -> Instance | Required number of nodes
| -> Int | Possible solution list
| -> m AllocSolution | | Try to allocate an instance on the cluster.
|
|
|
|
:: Monad m | | => List | The instance list
| -> List | The index of the instance to move
| -> Idx | The number of nodes required
| -> Int | Nodes which should not be used
| -> [Ndx] | Solution list
| -> m AllocSolution | | Try to allocate an instance on the cluster.
|
|
|
|
:: Monad m | | => List | The instance list
| -> List | Nodes to be evacuated
| -> [Ndx] | Solution list
| -> m AllocSolution | | Try to evacuate a list of nodes.
|
|
|
|
Recursively place instances on the cluster until we're out of space
|
|
|
|
Formatting functions
|
|
|
:: Instance | The instance to be moved
| -> String | The instance name
| -> IMove | The move being performed
| -> String | New primary
| -> String | New secondary
| -> (String, [String]) | Tuple of moves and commands list; moves is containing
either f for failover or r:name for replace
secondary, while the command list holds gnt-instance
commands (without that prefix), e.g "failover instance1"
| Given the original and final nodes, computes the relocation description.
|
|
|
|
:: List | The node list
| -> List | The instance list
| -> Int | Maximum node name length
| -> Int | Maximum instance name length
| -> Placement | The current placement
| -> Int | The index of the placement in
the solution
| -> (String, [String]) | | Converts a placement to string format.
|
|
|
|
Return the instance and involved nodes in an instance move.
|
|
|
Inner function for splitJobs, that either appends the next job to
the current jobset, or starts a new jobset.
|
|
|
Break a list of moves into independent groups. Note that this
will reverse the order of jobs.
|
|
|
Given a list of commands, prefix them with gnt-instance and
also beautify the display a little.
|
|
|
Given a list of commands, prefix them with gnt-instance and
also beautify the display a little.
|
|
|
Print the node list.
|
|
|
Print the instance list.
|
|
|
Shows statistics for a given node list.
|
|
|
Convert a placement into a list of OpCodes (basically a job).
|
|
Produced by Haddock version 2.6.0 |