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])
unknownField :: String
type JobSet = [MoveJob]
connTimeout :: Int
queryTimeout :: Int
defVcpuRatio :: Double
defReservedDiskRatio :: Double
unitMem :: Int
unitDsk :: Int
unitCpu :: 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
allNames :: a -> [String]
idxOf :: a -> Int
setAlias :: a -> String -> a
computeAlias :: String -> a -> 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
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
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)
type MoveJob = ([Ndx], Idx, IMove, [String])Source
Formatted solution output for one move (involved nodes and commands
unknownField :: StringSource
Unknown field in table output
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).
defVcpuRatio :: DoubleSource
Default vcpu-to-pcpu ratio (randomly chosen value).
defReservedDiskRatio :: DoubleSource
Default max disk usage ratio.
unitMem :: IntSource
Base memory unit.
unitDsk :: IntSource
Base disk unit.
unitCpu :: IntSource
Base vcpus unit.
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
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
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
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
allNames :: a -> [String]Source
Returns all the known names of the element
idxOf :: a -> IntSource
Returns the index of the element
setAlias :: a -> String -> aSource
Updates the alias of the element
computeAlias :: String -> a -> aSource
Compute the alias by stripping a given suffix (domain) from | the name
setIdx :: a -> Int -> aSource
Updates the index of the element
Produced by Haddock version 2.6.0