ganeti-htoolsSource codeContentsIndex
Ganeti.HTools.Types
Description
Some common types.
Synopsis
type Idx = Int
type Ndx = Int
type NameAssoc = [(String, Int)]
type Score = Double
type Weight = Double
data RSpec = RSpec {
rspecCpu :: Int
rspecMem :: Int
rspecDsk :: Int
}
data DynUtil = DynUtil {
cpuWeight :: Weight
memWeight :: Weight
dskWeight :: Weight
netWeight :: Weight
}
zeroUtil :: DynUtil
baseUtil :: DynUtil
addUtil :: DynUtil -> DynUtil -> DynUtil
subUtil :: DynUtil -> DynUtil -> DynUtil
type Placement = (Idx, Ndx, Ndx, IMove, Score)
data IMove
= Failover
| ReplacePrimary Ndx
| ReplaceSecondary Ndx
| ReplaceAndFailover Ndx
| FailoverAndReplace Ndx
type MoveJob = ([Ndx], Idx, IMove, [String])
type JobSet = [MoveJob]
connTimeout :: Int
queryTimeout :: Int
data Result a
= Bad String
| Ok a
data FailMode
= FailMem
| FailDisk
| FailCPU
| FailN1
| FailTags
type FailStats = [(FailMode, Int)]
data OpResult a
= OpFail FailMode
| OpGood a
class Element a where
nameOf :: a -> String
idxOf :: a -> Int
setName :: a -> String -> a
setIdx :: a -> Int -> a
Documentation
type Idx = IntSource
The instance index type.
type Ndx = IntSource
The node index type.
type NameAssoc = [(String, Int)]Source
The type used to hold name-to-idx mappings.
type Score = DoubleSource
A separate name for the cluster score type.
type Weight = DoubleSource
A separate name for a weight metric.
data RSpec Source
The resource spec type.
Constructors
RSpec
rspecCpu :: IntRequested VCPUs
rspecMem :: IntRequested memory
rspecDsk :: IntRequested disk
show/hide Instances
Eq RSpec
Show RSpec
data DynUtil Source
The dynamic resource specs of a machine (i.e. load or load capacity, as opposed to size).
Constructors
DynUtil
cpuWeight :: WeightStandardised CPU usage
memWeight :: WeightStandardised memory load
dskWeight :: WeightStandardised disk I/O usage
netWeight :: WeightStandardised network usage
show/hide Instances
Show DynUtil
zeroUtil :: DynUtilSource
Initial empty utilisation
baseUtil :: DynUtilSource
addUtil :: DynUtil -> DynUtil -> DynUtilSource
subUtil :: DynUtil -> DynUtil -> DynUtilSource
type Placement = (Idx, Ndx, Ndx, IMove, Score)Source
The description of an instance placement. It contains the instance index, the new primary and secondary node, the move being performed and the score of the cluster after the move.
data IMove Source
An instance move definition
Constructors
FailoverFailover the instance (f)
ReplacePrimary NdxReplace primary (f, r:np, f)
ReplaceSecondary NdxReplace secondary (r:ns)
ReplaceAndFailover NdxReplace secondary, failover (r:np, f)
FailoverAndReplace NdxFailover, replace secondary (f, r:ns)
show/hide Instances
Show IMove
type MoveJob = ([Ndx], Idx, IMove, [String])Source
Formatted solution output for one move (involved nodes and commands
type JobSet = [MoveJob]Source
A list of command elements
connTimeout :: IntSource
Connection timeout (when using non-file methods).
queryTimeout :: IntSource
The default timeout for queries (when using non-file methods).
data Result a Source
This is similar to the JSON library Result type - *very* similar, but we want to use it in multiple places, so we abstract it into a mini-library here
Constructors
Bad String
Ok a
show/hide Instances
Monad Result
Show a => Show (Result a)
data FailMode Source
Reason for an operation's falure
Constructors
FailMemFailed due to not enough RAM
FailDiskFailed due to not enough disk
FailCPUFailed due to not enough CPU capacity
FailN1Failed due to not passing N1 checks
FailTagsFailed due to tag exclusion
show/hide Instances
type FailStats = [(FailMode, Int)]Source
List with failure statistics
data OpResult a Source
Either-like data-type customized for our failure modes
Constructors
OpFail FailModeFailed operation
OpGood aSuccess operation
show/hide Instances
Monad OpResult
class Element a whereSource
A generic class for items that have updateable names and indices.
Methods
nameOf :: a -> StringSource
Returns the name of the element
idxOf :: a -> IntSource
Returns the index of the element
setName :: a -> String -> aSource
Updates the name of the element
setIdx :: a -> Int -> aSource
Updates the index of the element
show/hide Instances
Produced by Haddock version 2.4.2