ganeti-htoolsSource codeContentsIndex
Some common types.
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
data DiskTemplate
= DTDiskless
| DTFile
| DTSharedFile
| DTPlain
| DTBlock
| DTDrbd8
dtToString :: DiskTemplate -> String
dtFromString :: Monad m => String -> m DiskTemplate
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
eitherToResult :: Either String a -> Result a
data FailMode
= FailMem
| FailDisk
| FailCPU
| FailN1
| FailTags
type FailStats = [(FailMode, Int)]
data OpResult a
= OpFail FailMode
| OpGood a
opToResult :: OpResult a -> Result 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
data EvacMode
= ChangePrimary
| ChangeSecondary
| ChangeAll
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.

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.
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).
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
Base utilisation (used when no actual utilisation data is supplied).
addUtil :: DynUtil -> DynUtil -> DynUtilSource
Sum two utilisation records.
subUtil :: DynUtil -> DynUtil -> DynUtilSource
Substracts one utilisation record from another.
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.
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)
data DiskTemplate Source
Instance disk template type.
dtToString :: DiskTemplate -> StringSource
Converts a DiskTemplate to String.
dtFromString :: Monad m => String -> m DiskTemplateSource
Converts a DiskTemplate from String.
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.

The failure value for this monad is simply a string.

Bad String
Ok a
isOk :: Result a -> BoolSource
Simple checker for whether a Result is OK.
isBad :: Result a -> BoolSource
Simple checker for whether a Result is a failure.
eitherToResult :: Either String a -> Result aSource
Converter from Either String to Result.
data FailMode Source
Reason for an operation's falure.
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.

The failure values for this monad track the specific allocation failures, so this is not a general error-monad (compare with the Result data type). One downside is that this type cannot encode a generic failure mode, hence fail for this monad is not defined and will cause an exception.

OpFail FailModeFailed operation
OpGood aSuccess operation
opToResult :: OpResult a -> Result aSource
Conversion from OpResult to Result.
class Element a whereSource
A generic class for items that have updateable names and indices.
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
data EvacMode Source
The iallocator node-evacuate evac_mode type.
Produced by Haddock version 2.6.0