ganeti-3.1: Cluster-based virtualization management software
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ganeti.HTools.Types

Description

Some common types.

Synopsis

Documentation

type Idx = Int #

The instance index type.

type Ndx = Int #

The node index type.

type Gdx = Int #

The group index type.

type NameAssoc = Map String Int #

The type used to hold name-to-idx mappings.

type Score = Double #

A separate name for the cluster score type.

type Weight = Double #

A separate name for a weight metric.

type GroupID = String #

The Group UUID type.

defaultGroupID :: GroupID #

Default group UUID (just a string, not a real UUID).

data AllocPolicy #

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.

Instances

Instances details
Bounded AllocPolicy # 
Instance details

Defined in Ganeti.Types

Enum AllocPolicy # 
Instance details

Defined in Ganeti.Types

Show AllocPolicy # 
Instance details

Defined in Ganeti.Types

Methods

showsPrec :: Int -> AllocPolicy -> ShowS

show :: AllocPolicy -> String

showList :: [AllocPolicy] -> ShowS

Eq AllocPolicy # 
Instance details

Defined in Ganeti.Types

Methods

(==) :: AllocPolicy -> AllocPolicy -> Bool

(/=) :: AllocPolicy -> AllocPolicy -> Bool

Ord AllocPolicy # 
Instance details

Defined in Ganeti.Types

JSON AllocPolicy # 
Instance details

Defined in Ganeti.Types

Methods

readJSON :: JSValue -> Result AllocPolicy

showJSON :: AllocPolicy -> JSValue

readJSONs :: JSValue -> Result [AllocPolicy]

showJSONs :: [AllocPolicy] -> JSValue

allocPolicyFromRaw :: forall m. (Monad m, MonadFail m) => String -> m AllocPolicy #

type NetworkID = String #

The network UUID type.

data InstanceStatus #

The Instance real state type.

Instances

Instances details
Bounded InstanceStatus # 
Instance details

Defined in Ganeti.Types

Enum InstanceStatus # 
Instance details

Defined in Ganeti.Types

Show InstanceStatus # 
Instance details

Defined in Ganeti.Types

Methods

showsPrec :: Int -> InstanceStatus -> ShowS

show :: InstanceStatus -> String

showList :: [InstanceStatus] -> ShowS

Eq InstanceStatus # 
Instance details

Defined in Ganeti.Types

Ord InstanceStatus # 
Instance details

Defined in Ganeti.Types

JSON InstanceStatus # 
Instance details

Defined in Ganeti.Types

Methods

readJSON :: JSValue -> Result InstanceStatus

showJSON :: InstanceStatus -> JSValue

readJSONs :: JSValue -> Result [InstanceStatus]

showJSONs :: [InstanceStatus] -> JSValue

instanceStatusFromRaw :: forall m. (Monad m, MonadFail m) => String -> m InstanceStatus #

data RSpec #

The resource spec type.

Constructors

RSpec 

Fields

Instances

Instances details
Show RSpec # 
Instance details

Defined in Ganeti.HTools.Types

Methods

showsPrec :: Int -> RSpec -> ShowS

show :: RSpec -> String

showList :: [RSpec] -> ShowS

Eq RSpec # 
Instance details

Defined in Ganeti.HTools.Types

Methods

(==) :: RSpec -> RSpec -> Bool

(/=) :: RSpec -> RSpec -> Bool

data AllocInfo #

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

Instances

Instances details
Show AllocInfo # 
Instance details

Defined in Ganeti.HTools.Types

Methods

showsPrec :: Int -> AllocInfo -> ShowS

show :: AllocInfo -> String

showList :: [AllocInfo] -> ShowS

Eq AllocInfo # 
Instance details

Defined in Ganeti.HTools.Types

Methods

(==) :: AllocInfo -> AllocInfo -> Bool

(/=) :: AllocInfo -> AllocInfo -> Bool

type AllocStats = (AllocInfo, AllocInfo, AllocInfo) #

Currently used, possibly to allocate, unallocable.

data DynUtil #

The dynamic resource specs of a machine (i.e. load or load capacity, as opposed to size).

Constructors

DynUtil 

Fields

Instances

Instances details
Show DynUtil # 
Instance details

Defined in Ganeti.HTools.Types

Methods

showsPrec :: Int -> DynUtil -> ShowS

show :: DynUtil -> String

showList :: [DynUtil] -> ShowS

Eq DynUtil # 
Instance details

Defined in Ganeti.HTools.Types

Methods

(==) :: DynUtil -> DynUtil -> Bool

(/=) :: DynUtil -> DynUtil -> Bool

zeroUtil :: DynUtil #

Initial empty utilisation.

baseUtil :: DynUtil #

Base utilisation (used when no actual utilisation data is supplied).

addUtil :: DynUtil -> DynUtil -> DynUtil #

Sum two utilisation records.

subUtil :: DynUtil -> DynUtil -> DynUtil #

Substracts one utilisation record from another.

defReservedDiskRatio :: Double #

Default max disk usage ratio.

unitMem :: Int #

Base memory unit.

unitCpu :: Int #

Base vcpus unit.

unitDsk :: Int #

Base disk unit.

unitSpindle :: Int #

Base spindles unit.

unknownField :: String #

Unknown field in table output.

type Placement = (Idx, Ndx, Ndx, IMove, Score) #

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 #

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

Instances details
Show IMove # 
Instance details

Defined in Ganeti.HTools.Types

Methods

showsPrec :: Int -> IMove -> ShowS

show :: IMove -> String

showList :: [IMove] -> ShowS

data DiskTemplate #

Instance disk template type. The disk template is a name for the constructor of the disk configuration DiskLogicalId used for serialization, configuration values, etc.

Instances

Instances details
Bounded DiskTemplate # 
Instance details

Defined in Ganeti.Types

Enum DiskTemplate # 
Instance details

Defined in Ganeti.Types

Show DiskTemplate # 
Instance details

Defined in Ganeti.Types

Methods

showsPrec :: Int -> DiskTemplate -> ShowS

show :: DiskTemplate -> String

showList :: [DiskTemplate] -> ShowS

HasStringRepr DiskTemplate # 
Instance details

Defined in Ganeti.Types

Methods

fromStringRepr :: MonadFail m => String -> m DiskTemplate #

toStringRepr :: DiskTemplate -> String #

PyValue DiskTemplate # 
Instance details

Defined in Ganeti.Types

Methods

showValue :: DiskTemplate -> String #

showValueList :: [DiskTemplate] -> String #

Eq DiskTemplate # 
Instance details

Defined in Ganeti.Types

Methods

(==) :: DiskTemplate -> DiskTemplate -> Bool

(/=) :: DiskTemplate -> DiskTemplate -> Bool

Ord DiskTemplate # 
Instance details

Defined in Ganeti.Types

JSON DiskTemplate # 
Instance details

Defined in Ganeti.Types

Methods

readJSON :: JSValue -> Result DiskTemplate

showJSON :: DiskTemplate -> JSValue

readJSONs :: JSValue -> Result [DiskTemplate]

showJSONs :: [DiskTemplate] -> JSValue

diskTemplateFromRaw :: forall m. (Monad m, MonadFail m) => String -> m DiskTemplate #

data MirrorType #

Mirroring type.

Constructors

MirrorNone

No mirroring/movability

MirrorInternal

DRBD-type mirroring

MirrorExternal

Shared-storage type mirroring

Instances

Instances details
Show MirrorType # 
Instance details

Defined in Ganeti.HTools.Types

Methods

showsPrec :: Int -> MirrorType -> ShowS

show :: MirrorType -> String

showList :: [MirrorType] -> ShowS

Eq MirrorType # 
Instance details

Defined in Ganeti.HTools.Types

Methods

(==) :: MirrorType -> MirrorType -> Bool

(/=) :: MirrorType -> MirrorType -> Bool

templateMirrorType :: DiskTemplate -> MirrorType #

Correspondence between disk template and mirror type.

type MoveJob = ([Ndx], Idx, IMove, [String]) #

Formatted solution output for one move (involved nodes and commands.

type JobSet = [MoveJob] #

A list of command elements.

class Element a where #

A generic class for items that have updateable names and indices.

Minimal complete definition

nameOf, allNames, idxOf, setAlias, setIdx

Methods

nameOf :: a -> String #

Returns the name of the element

allNames :: a -> [String] #

Returns all the known names of the element

idxOf :: a -> Int #

Returns the index of the element

setAlias :: a -> String -> a #

Updates the alias of the element

computeAlias :: String -> a -> a #

Compute the alias by stripping a given suffix (domain) from the name

setIdx :: a -> Int -> a #

Updates the index of the element

Instances

Instances details
Element Group # 
Instance details

Defined in Ganeti.HTools.Group

Methods

nameOf :: Group -> String #

allNames :: Group -> [String] #

idxOf :: Group -> Int #

setAlias :: Group -> String -> Group #

computeAlias :: String -> Group -> Group #

setIdx :: Group -> Int -> Group #

Element Instance # 
Instance details

Defined in Ganeti.HTools.Instance

Methods

nameOf :: Instance -> String #

allNames :: Instance -> [String] #

idxOf :: Instance -> Int #

setAlias :: Instance -> String -> Instance #

computeAlias :: String -> Instance -> Instance #

setIdx :: Instance -> Int -> Instance #

Element Node # 
Instance details

Defined in Ganeti.HTools.Node

Methods

nameOf :: Node -> String #

allNames :: Node -> [String] #

idxOf :: Node -> Int #

setAlias :: Node -> String -> Node #

computeAlias :: String -> Node -> Node #

setIdx :: Node -> Int -> Node #

data FailMode #

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

Instances details
Bounded FailMode # 
Instance details

Defined in Ganeti.HTools.Types

Enum FailMode # 
Instance details

Defined in Ganeti.HTools.Types

Show FailMode # 
Instance details

Defined in Ganeti.HTools.Types

Methods

showsPrec :: Int -> FailMode -> ShowS

show :: FailMode -> String

showList :: [FailMode] -> ShowS

Error FailMode #

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

Instance details

Defined in Ganeti.HTools.Types

Methods

strMsg :: String -> FailMode #

Eq FailMode # 
Instance details

Defined in Ganeti.HTools.Types

Methods

(==) :: FailMode -> FailMode -> Bool

(/=) :: FailMode -> FailMode -> Bool

type FailStats = [(FailMode, Int)] #

List with failure statistics.

type OpResult = GenericResult FailMode #

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 a #

Conversion from OpResult to Result.

data ISpec #

Instance specification type.

Constructors

ISpec 

Fields

Instances

Instances details
Show ISpec # 
Instance details

Defined in Ganeti.HTools.Types

Methods

showsPrec :: Int -> ISpec -> ShowS

show :: ISpec -> String

showList :: [ISpec] -> ShowS

ArrayObject ISpec # 
Instance details

Defined in Ganeti.HTools.Types

Methods

toJSArray :: ISpec -> [JSValue] #

fromJSArray :: [JSValue] -> Result ISpec #

DictObject ISpec # 
Instance details

Defined in Ganeti.HTools.Types

Methods

toDict :: ISpec -> [(String, JSValue)] #

fromDictWKeys :: [(String, JSValue)] -> WriterT UsedKeys Result ISpec #

fromDict :: [(String, JSValue)] -> Result ISpec #

Eq ISpec # 
Instance details

Defined in Ganeti.HTools.Types

Methods

(==) :: ISpec -> ISpec -> Bool

(/=) :: ISpec -> ISpec -> Bool

JSON ISpec # 
Instance details

Defined in Ganeti.HTools.Types

Methods

readJSON :: JSValue -> Result ISpec

showJSON :: ISpec -> JSValue

readJSONs :: JSValue -> Result [ISpec]

showJSONs :: [ISpec] -> JSValue

defMinISpec :: ISpec #

The default minimum ispec.

defStdISpec :: ISpec #

The default standard ispec.

maxDisks :: Int #

maxNics :: Int #

defMaxISpec :: ISpec #

The default max ispec.

data MinMaxISpecs #

Minimum and maximum instance specs type.

Instances

Instances details
Show MinMaxISpecs # 
Instance details

Defined in Ganeti.HTools.Types

Methods

showsPrec :: Int -> MinMaxISpecs -> ShowS

show :: MinMaxISpecs -> String

showList :: [MinMaxISpecs] -> ShowS

ArrayObject MinMaxISpecs # 
Instance details

Defined in Ganeti.HTools.Types

Methods

toJSArray :: MinMaxISpecs -> [JSValue] #

fromJSArray :: [JSValue] -> Result MinMaxISpecs #

DictObject MinMaxISpecs # 
Instance details

Defined in Ganeti.HTools.Types

Methods

toDict :: MinMaxISpecs -> [(String, JSValue)] #

fromDictWKeys :: [(String, JSValue)] -> WriterT UsedKeys Result MinMaxISpecs #

fromDict :: [(String, JSValue)] -> Result MinMaxISpecs #

Eq MinMaxISpecs # 
Instance details

Defined in Ganeti.HTools.Types

Methods

(==) :: MinMaxISpecs -> MinMaxISpecs -> Bool

(/=) :: MinMaxISpecs -> MinMaxISpecs -> Bool

JSON MinMaxISpecs # 
Instance details

Defined in Ganeti.HTools.Types

Methods

readJSON :: JSValue -> Result MinMaxISpecs

showJSON :: MinMaxISpecs -> JSValue

readJSONs :: JSValue -> Result [MinMaxISpecs]

showJSONs :: [MinMaxISpecs] -> JSValue

data IPolicy #

Instance policy type.

Instances

Instances details
Show IPolicy # 
Instance details

Defined in Ganeti.HTools.Types

Methods

showsPrec :: Int -> IPolicy -> ShowS

show :: IPolicy -> String

showList :: [IPolicy] -> ShowS

ArrayObject IPolicy # 
Instance details

Defined in Ganeti.HTools.Types

Methods

toJSArray :: IPolicy -> [JSValue] #

fromJSArray :: [JSValue] -> Result IPolicy #

DictObject IPolicy # 
Instance details

Defined in Ganeti.HTools.Types

Methods

toDict :: IPolicy -> [(String, JSValue)] #

fromDictWKeys :: [(String, JSValue)] -> WriterT UsedKeys Result IPolicy #

fromDict :: [(String, JSValue)] -> Result IPolicy #

Eq IPolicy # 
Instance details

Defined in Ganeti.HTools.Types

Methods

(==) :: IPolicy -> IPolicy -> Bool

(/=) :: IPolicy -> IPolicy -> Bool

JSON IPolicy # 
Instance details

Defined in Ganeti.HTools.Types

Methods

readJSON :: JSValue -> Result IPolicy

showJSON :: IPolicy -> JSValue

readJSONs :: JSValue -> Result [IPolicy]

showJSONs :: [IPolicy] -> JSValue

defIPolicy :: IPolicy #

The default instance policy.

rspecFromISpec :: ISpec -> RSpec #

Converts an ISpec type to a RSpec one.

data AutoRepairType #

The repair modes for the auto-repair tool.

autoRepairTypeFromRaw :: forall m. (Monad m, MonadFail m) => String -> m AutoRepairType #

data AutoRepairResult #

The possible auto-repair results.

Constructors

ArEnoperm 
ArSuccess 
ArFailure 

Instances

Instances details
Bounded AutoRepairResult # 
Instance details

Defined in Ganeti.HTools.Types

Enum AutoRepairResult # 
Instance details

Defined in Ganeti.HTools.Types

Show AutoRepairResult # 
Instance details

Defined in Ganeti.HTools.Types

Methods

showsPrec :: Int -> AutoRepairResult -> ShowS

show :: AutoRepairResult -> String

showList :: [AutoRepairResult] -> ShowS

Eq AutoRepairResult # 
Instance details

Defined in Ganeti.HTools.Types

Ord AutoRepairResult # 
Instance details

Defined in Ganeti.HTools.Types

autoRepairResultFromRaw :: forall m. (Monad m, MonadFail m) => String -> m AutoRepairResult #

data AutoRepairPolicy #

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

Instances

Instances details
Show AutoRepairPolicy # 
Instance details

Defined in Ganeti.HTools.Types

Methods

showsPrec :: Int -> AutoRepairPolicy -> ShowS

show :: AutoRepairPolicy -> String

showList :: [AutoRepairPolicy] -> ShowS

Eq AutoRepairPolicy # 
Instance details

Defined in Ganeti.HTools.Types

data AutoRepairSuspendTime #

The suspend timeout for ArSuspended.

Constructors

Forever

Permanently suspended

Until ClockTime

Suspended up to a certain time

Instances

Instances details
Show AutoRepairSuspendTime # 
Instance details

Defined in Ganeti.HTools.Types

Methods

showsPrec :: Int -> AutoRepairSuspendTime -> ShowS

show :: AutoRepairSuspendTime -> String

showList :: [AutoRepairSuspendTime] -> ShowS

Eq AutoRepairSuspendTime # 
Instance details

Defined in Ganeti.HTools.Types

data AutoRepairData #

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

Constructors

AutoRepairData 

Fields

Instances

Instances details
Show AutoRepairData # 
Instance details

Defined in Ganeti.HTools.Types

Methods

showsPrec :: Int -> AutoRepairData -> ShowS

show :: AutoRepairData -> String

showList :: [AutoRepairData] -> ShowS

Eq AutoRepairData # 
Instance details

Defined in Ganeti.HTools.Types

data AutoRepairStatus #

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

Instances

Instances details
Show AutoRepairStatus # 
Instance details

Defined in Ganeti.HTools.Types

Methods

showsPrec :: Int -> AutoRepairStatus -> ShowS

show :: AutoRepairStatus -> String

showList :: [AutoRepairStatus] -> ShowS

Eq AutoRepairStatus # 
Instance details

Defined in Ganeti.HTools.Types