ganeti-htoolsSource codeContentsIndex
Ganeti.HTools.Types
Description
Some common types.
Synopsis
type Idx = Int
type Ndx = Int
type Gdx = Int
type NameAssoc = Map String Int
type Score = Double
type Weight = Double
type GroupID = String
data AllocPolicy
= AllocPreferred
| AllocLastResort
| AllocUnallocable
apolFromString :: Monad m => String -> m AllocPolicy
apolToString :: AllocPolicy -> String
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
isOk :: Result a -> Bool
isBad :: Result a -> Bool
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 Gdx = IntSource
The group index type.
type NameAssoc = Map String IntSource
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.
type GroupID = StringSource
The Group UUID type.
data AllocPolicy Source

The Group allocation policy type.

Note that the order of constructors is important as the automatic Ord instance will order them in the order they are defined, so when changing this data type be careful about the interaction with the desired sorting order.

Constructors
AllocPreferredThis is the normal status, the group should be used normally during allocations
AllocLastResortThis group should be used only as last-resort, after the preferred groups
AllocUnallocableThis group must not be used for new allocations
apolFromString :: Monad m => String -> m AllocPolicySource
Convert a string to an alloc policy
apolToString :: AllocPolicy -> StringSource
Convert an alloc policy to the Ganeti string equivalent
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
isOk :: Result a -> BoolSource
Simple checker for whether Result is OK
isBad :: Result a -> BoolSource
Simple checker for whether Result is a failure
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