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
defaultGroupID :: GroupID
data DiskTemplate
= DTDiskless
| DTFile
| DTSharedFile
| DTPlain
| DTBlock
| DTDrbd8
| DTRbd
diskTemplateFromRaw :: forall m[aohd]. Monad m[aohd] => String -> m[aohd] DiskTemplate
diskTemplateToRaw :: DiskTemplate -> String
data MirrorType
= MirrorNone
| MirrorInternal
| MirrorExternal
templateMirrorType :: DiskTemplate -> MirrorType
data AllocPolicy
= AllocPreferred
| AllocLastResort
| AllocUnallocable
allocPolicyFromRaw :: forall m[aopC]. Monad m[aopC] => String -> m[aopC] AllocPolicy
allocPolicyToRaw :: AllocPolicy -> String
data InstanceStatus
= AdminDown
| AdminOffline
| ErrorDown
| ErrorUp
| NodeDown
| NodeOffline
| Running
| WrongNode
instanceStatusFromRaw :: forall m[aox0]. Monad m[aox0] => String -> m[aox0] InstanceStatus
instanceStatusToRaw :: InstanceStatus -> String
data RSpec = RSpec {
rspecCpu :: Int
rspecMem :: Int
rspecDsk :: Int
}
data AllocInfo = AllocInfo {
allocInfoVCpus :: Int
allocInfoNCpus :: Double
allocInfoMem :: Int
allocInfoDisk :: Int
}
type AllocStats = (AllocInfo, AllocInfo, AllocInfo)
data ISpec = ISpec {
iSpecMemorySize :: Int
iSpecCpuCount :: Int
iSpecDiskSize :: Int
iSpecDiskCount :: Int
iSpecNicCount :: Int
iSpecSpindleUse :: Int
}
loadISpec :: JSValue -> Result ISpec
saveISpec :: ISpec -> JSValue
toDictISpec :: ISpec -> [(String, JSValue)]
defMinISpec :: ISpec
defStdISpec :: ISpec
defMaxISpec :: ISpec
data IPolicy = IPolicy {
iPolicyStdSpec :: ISpec
iPolicyMinSpec :: ISpec
iPolicyMaxSpec :: ISpec
iPolicyDiskTemplates :: [DiskTemplate]
iPolicyVcpuRatio :: Double
iPolicySpindleRatio :: Double
}
loadIPolicy :: JSValue -> Result IPolicy
saveIPolicy :: IPolicy -> JSValue
toDictIPolicy :: IPolicy -> [(String, JSValue)]
rspecFromISpec :: ISpec -> RSpec
defIPolicy :: IPolicy
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
| FailoverToAny Ndx
| ReplacePrimary Ndx
| ReplaceSecondary Ndx
| ReplaceAndFailover Ndx
| FailoverAndReplace Ndx
type MoveJob = ([Ndx], Idx, IMove, [String])
unknownField :: String
type JobSet = [MoveJob]
connTimeout :: Int
queryTimeout :: Int
defReservedDiskRatio :: Double
unitMem :: Int
unitDsk :: Int
unitCpu :: Int
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
evacModeFromRaw :: forall m[apmR]. Monad m[apmR] => String -> m[apmR] EvacMode
evacModeToRaw :: EvacMode -> String
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.
defaultGroupID :: GroupIDSource
Default group UUID (just a string, not a real UUID).
data DiskTemplate Source
Instance disk template type.
Constructors
DTDiskless
DTFile
DTSharedFile
DTPlain
DTBlock
DTDrbd8
DTRbd
diskTemplateFromRaw :: forall m[aohd]. Monad m[aohd] => String -> m[aohd] DiskTemplateSource
diskTemplateToRaw :: DiskTemplate -> StringSource
data MirrorType Source
Mirroring type.
Constructors
MirrorNoneNo mirroring/movability
MirrorInternalDRBD-type mirroring
MirrorExternalShared-storage type mirroring
templateMirrorType :: DiskTemplate -> MirrorTypeSource
Correspondence between disk template and mirror 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
AllocPreferred
AllocLastResort
AllocUnallocable
allocPolicyFromRaw :: forall m[aopC]. Monad m[aopC] => String -> m[aopC] AllocPolicySource
allocPolicyToRaw :: AllocPolicy -> StringSource
data InstanceStatus Source
The Instance real state type.
Constructors
AdminDown
AdminOffline
ErrorDown
ErrorUp
NodeDown
NodeOffline
Running
WrongNode
instanceStatusFromRaw :: forall m[aox0]. Monad m[aox0] => String -> m[aox0] InstanceStatusSource
instanceStatusToRaw :: InstanceStatus -> StringSource
data RSpec Source
The resource spec type.
Constructors
RSpec
rspecCpu :: IntRequested VCPUs
rspecMem :: IntRequested memory
rspecDsk :: IntRequested disk
data AllocInfo Source
Allocation stats type. This is used instead of RSpec (which was used at first), because we need to track more stats. The actual data can refer either to allocated, or available, etc. values depending on the context. See also Cluster.computeAllocationDelta.
Constructors
AllocInfo
allocInfoVCpus :: IntVCPUs
allocInfoNCpus :: DoubleNormalised CPUs
allocInfoMem :: IntMemory
allocInfoDisk :: IntDisk
type AllocStats = (AllocInfo, AllocInfo, AllocInfo)Source
Currently used, possibly to allocate, unallocable.
data ISpec Source
Instance specification type.
Constructors
ISpec
iSpecMemorySize :: Int
iSpecCpuCount :: Int
iSpecDiskSize :: Int
iSpecDiskCount :: Int
iSpecNicCount :: Int
iSpecSpindleUse :: Int
loadISpec :: JSValue -> Result ISpecSource
saveISpec :: ISpec -> JSValueSource
toDictISpec :: ISpec -> [(String, JSValue)]Source
defMinISpec :: ISpecSource
The default minimum ispec.
defStdISpec :: ISpecSource
The default standard ispec.
defMaxISpec :: ISpecSource
The default max ispec.
data IPolicy Source
Instance policy type.
Constructors
IPolicy
iPolicyStdSpec :: ISpec
iPolicyMinSpec :: ISpec
iPolicyMaxSpec :: ISpec
iPolicyDiskTemplates :: [DiskTemplate]
iPolicyVcpuRatio :: Double
iPolicySpindleRatio :: Double
loadIPolicy :: JSValue -> Result IPolicySource
saveIPolicy :: IPolicy -> JSValueSource
toDictIPolicy :: IPolicy -> [(String, JSValue)]Source
rspecFromISpec :: ISpec -> RSpecSource
Converts an ISpec type to a RSpec one.
defIPolicy :: IPolicySource
The default instance policy.
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
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.
Constructors
FailoverFailover the instance (f)
FailoverToAny NdxFailover to a random node (fa:np), for shared storage
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).
defReservedDiskRatio :: DoubleSource
Default max disk usage ratio.
unitMem :: IntSource
Base memory unit.
unitDsk :: IntSource
Base disk unit.
unitCpu :: IntSource
Base vcpus unit.
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.

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.

Constructors
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.
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
data EvacMode Source
The iallocator node-evacuate evac_mode type.
Constructors
ChangePrimary
ChangeSecondary
ChangeAll
evacModeFromRaw :: forall m[apmR]. Monad m[apmR] => String -> m[apmR] EvacModeSource
evacModeToRaw :: EvacMode -> StringSource
Produced by Haddock version 2.6.0