ganeti

Safe HaskellNone

Ganeti.HTools.Types

Description

Some common types.

Synopsis

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 MirrorType Source

Mirroring type.

Constructors

MirrorNone

No mirroring/movability

MirrorInternal

DRBD-type mirroring

MirrorExternal

Shared-storage type mirroring

Instances

templateMirrorType :: DiskTemplate -> MirrorTypeSource

Correspondence between disk template and mirror type.

data RSpec Source

The resource spec type.

Constructors

RSpec 

Fields

rspecCpu :: Int

Requested VCPUs

rspecMem :: Int

Requested memory

rspecDsk :: Int

Requested disk

rspecSpn :: Int

Requested spindles

Instances

Eq RSpec 
Show RSpec 

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 computeAllocationDelta.

Constructors

AllocInfo 

Fields

allocInfoVCpus :: Int

VCPUs

allocInfoNCpus :: Double

Normalised CPUs

allocInfoMem :: Int

Memory

allocInfoDisk :: Int

Disk

allocInfoSpn :: Int

Spindles

Instances

Eq AllocInfo 
Show AllocInfo 

type AllocStats = (AllocInfo, AllocInfo, AllocInfo)Source

Currently used, possibly to allocate, unallocable.

type NetworkID = StringSource

The network UUID type.

data ISpec Source

Instance specification type.

Constructors

ISpec 

Fields

iSpecMemorySize :: Int
 
iSpecCpuCount :: Int
 
iSpecDiskSize :: Int
 
iSpecDiskCount :: Int
 
iSpecNicCount :: Int
 
iSpecSpindleUse :: Int
 

Instances

Eq ISpec 
Show ISpec 
Arbitrary ISpec 
JSON ISpec 
ArrayObject ISpec 
DictObject ISpec 

loadISpec :: JSValue -> Result ISpecSource

saveISpec :: ISpec -> JSValueSource

defMinISpec :: ISpecSource

The default minimum ispec.

defStdISpec :: ISpecSource

The default standard ispec.

defMaxISpec :: ISpecSource

The default max ispec.

data MinMaxISpecs Source

Minimum and maximum instance specs type.

data IPolicy Source

Instance policy type.

Instances

loadIPolicy :: JSValue -> Result IPolicySource

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 

Fields

cpuWeight :: Weight

Standardised CPU usage

memWeight :: Weight

Standardised memory load

dskWeight :: Weight

Standardised disk I/O usage

netWeight :: Weight

Standardised network usage

Instances

Eq DynUtil 
Show DynUtil 

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

Failover

Failover the instance (f)

FailoverToAny Ndx

Failover to a random node (fa:np), for shared storage

ReplacePrimary Ndx

Replace primary (f, r:np, f)

ReplaceSecondary Ndx

Replace secondary (r:ns)

ReplaceAndFailover Ndx

Replace secondary, failover (r:np, f)

FailoverAndReplace Ndx

Failover, replace secondary (f, r:ns)

Instances

Show IMove 

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.

defReservedDiskRatio :: DoubleSource

Default max disk usage ratio.

unitMem :: IntSource

Base memory unit.

unitDsk :: IntSource

Base disk unit.

unitCpu :: IntSource

Base vcpus unit.

unitSpindle :: IntSource

Base spindles unit.

data FailMode Source

Reason for an operation's falure.

Constructors

FailMem

Failed due to not enough RAM

FailDisk

Failed due to not enough disk

FailCPU

Failed due to not enough CPU capacity

FailN1

Failed due to not passing N1 checks

FailTags

Failed due to tag exclusion

FailMig

Failed due to migration restrictions

FailDiskCount

Failed due to wrong number of disks

FailSpindles

Failed due to wrong/missing spindles

FailInternal

Internal error

Instances

Bounded FailMode 
Enum FailMode 
Eq FailMode 
Show FailMode 
Arbitrary FailMode 
Error FailMode

Error instance for FailMode designed to catch unintended use as a general monad.

Arbitrary a => Arbitrary (OpResult a) 

type FailStats = [(FailMode, Int)]Source

List with failure statistics.

type OpResult = GenericResult FailModeSource

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 our way to build a FailMode from string will instead raise an exception.

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 AutoRepairType Source

The repair modes for the auto-repair tool.

autoRepairTypeFromRaw :: forall m. Monad m => String -> m AutoRepairTypeSource

data AutoRepairResult Source

The possible auto-repair results.

Constructors

ArEnoperm 
ArSuccess 
ArFailure 

autoRepairResultFromRaw :: forall m. Monad m => String -> m AutoRepairResultSource

data AutoRepairPolicy Source

The possible auto-repair policy for a given instance.

Constructors

ArEnabled AutoRepairType

Auto-repair explicitly enabled

ArSuspended AutoRepairSuspendTime

Suspended temporarily, or forever

ArNotEnabled

Auto-repair not explicitly enabled

data AutoRepairSuspendTime Source

The suspend timeout for ArSuspended.

Constructors

Forever

Permanently suspended

Until ClockTime

Suspended up to a certain time

data AutoRepairStatus Source

The possible auto-repair states for any given instance.

Constructors

ArHealthy (Maybe AutoRepairData)

No problems detected with the instance

ArNeedsRepair AutoRepairData

Instance has problems, no action taken

ArPendingRepair AutoRepairData

Repair jobs ongoing for the instance

ArFailedRepair AutoRepairData

Some repair jobs for the instance failed

data AutoRepairData Source

The data accompanying a repair operation (future, pending, or failed).

Constructors

AutoRepairData 

Fields

arType :: AutoRepairType
 
arUuid :: String
 
arTime :: ClockTime
 
arJobs :: [JobId]
 
arResult :: Maybe AutoRepairResult
 
arTag :: String
 

Instances