ganeti

Safe HaskellSafe-Infered

Ganeti.HTools.Cluster.AllocationSolution

Contents

Description

Implementation of handling of Allocation Solutions

Synopsis

Documentation

type GenericAllocElement a = (List, Instance, [Node], a)Source

A simple name for an allocation element (here just for logistic reasons), generic in the type of the metric.

type AllocElement = GenericAllocElement ScoreSource

A simple name for an allocation element (here just for logistic reasons).

data GenericAllocSolution a Source

Allocation/relocation solution.

Constructors

AllocSolution 

Fields

asFailures :: [FailMode]

Failure counts

asAllocs :: Int

Good allocation count

asSolution :: Maybe (GenericAllocElement a)

The actual allocation result

asLog :: [String]

Informational messages

emptyAllocSolution :: GenericAllocSolution aSource

The empty solution we start with when computing allocations.

updateIlSource

Arguments

:: List

The original instance list

-> Maybe (GenericAllocElement a)

The result of the allocation attempt

-> List

The updated instance list

Calculate the new instance list after allocation solution.

extractNlSource

Arguments

:: List

The original node list

-> List

The original instance list

-> Maybe (GenericAllocElement a)

The result of the allocation attempt

-> List

The new node list

Extract the the new node list from the allocation solution.

concatAllocs :: Ord a => GenericAllocSolution a -> OpResult (GenericAllocElement a) -> GenericAllocSolution aSource

Update current Allocation solution and failure stats with new elements.

collapseFailures :: [FailMode] -> FailStatsSource

Build failure stats out of a list of failures.

genericDescribeSolution :: (a -> String) -> GenericAllocSolution a -> StringSource

genericAnnotateSolution :: (a -> String) -> GenericAllocSolution a -> GenericAllocSolution aSource

Annotates a solution with the appropriate string.

annotateSolution :: AllocSolution -> AllocSolutionSource

Annotate a solution based on the standard metrics

solutionDescription :: (Group, Result (GenericAllocSolution a)) -> [String]Source

Given a group/result, describe it as a nice (list of) messages.

Collection of Allocation Solutions for later filtering

data AllocSolutionCollection a Source

Collection of Allocation Solution

Constructors

AllocSolutionCollection 

Fields

ascFailures :: [FailMode]
 
ascAllocs :: Int
 
ascSolutions :: [GenericAllocElement a]
 
ascLog :: [String]
 

emptyAllocCollection :: AllocSolutionCollection aSource

Empty collection of allocation solutions.

concatAllocCollections :: Ord a => AllocSolutionCollection a -> OpResult (GenericAllocElement a) -> AllocSolutionCollection aSource

Update current collection of solution and failure stats with new elements.

collectionToSolutionSource

Arguments

:: Ord a 
=> FailMode

Failure mode to assign to solutions filtered out in this step

-> (GenericAllocElement a -> Bool)

predicate to restrict to

-> AllocSolutionCollection a 
-> GenericAllocSolution a 

From a collection of solutions collapse to a single one by chosing the best that fulfills a given predicate.