ganeti
Safe HaskellNone

Ganeti.HTools.Types

Description

Some common types.

Synopsis

Documentation

type Idx = Int Source #

The instance index type.

type Ndx = Int Source #

The node index type.

type Gdx = Int Source #

The group index type.

type NameAssoc = Map String Int Source #

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

type Score = Double Source #

A separate name for the cluster score type.

type Weight = Double Source #

A separate name for a weight metric.

type GroupID = String Source #

The Group UUID type.

defaultGroupID :: GroupID Source #

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

Instances details
Eq MirrorType # 
Instance details

Defined in Ganeti.HTools.Types

Methods

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

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

Show MirrorType # 
Instance details

Defined in Ganeti.HTools.Types

Methods

showsPrec :: Int -> MirrorType -> ShowS

show :: MirrorType -> String

showList :: [MirrorType] -> ShowS

templateMirrorType :: DiskTemplate -> MirrorType Source #

Correspondence between disk template and mirror type.

data RSpec Source #

The resource spec type.

Constructors

RSpec 

Fields

Instances

Instances details
Eq RSpec # 
Instance details

Defined in Ganeti.HTools.Types

Methods

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

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

Show RSpec # 
Instance details

Defined in Ganeti.HTools.Types

Methods

showsPrec :: Int -> RSpec -> ShowS

show :: RSpec -> String

showList :: [RSpec] -> ShowS

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

Instances

Instances details
Eq AllocInfo # 
Instance details

Defined in Ganeti.HTools.Types

Methods

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

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

Show AllocInfo # 
Instance details

Defined in Ganeti.HTools.Types

Methods

showsPrec :: Int -> AllocInfo -> ShowS

show :: AllocInfo -> String

showList :: [AllocInfo] -> ShowS

type AllocStats = (AllocInfo, AllocInfo, AllocInfo) Source #

Currently used, possibly to allocate, unallocable.

type NetworkID = String Source #

The network UUID type.

data ISpec Source #

Instance specification type.

Constructors

ISpec 

Fields

Instances

Instances details
Eq ISpec # 
Instance details

Defined in Ganeti.HTools.Types

Methods

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

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

Show ISpec # 
Instance details

Defined in Ganeti.HTools.Types

Methods

showsPrec :: Int -> ISpec -> ShowS

show :: ISpec -> String

showList :: [ISpec] -> ShowS

JSON ISpec # 
Instance details

Defined in Ganeti.HTools.Types

Methods

readJSON :: JSValue -> Result ISpec

showJSON :: ISpec -> JSValue

readJSONs :: JSValue -> Result [ISpec]

showJSONs :: [ISpec] -> JSValue

ArrayObject ISpec # 
Instance details

Defined in Ganeti.HTools.Types

Methods

toJSArray :: ISpec -> [JSValue] Source #

fromJSArray :: [JSValue] -> Result ISpec Source #

DictObject ISpec # 
Instance details

Defined in Ganeti.HTools.Types

Methods

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

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

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

Arbitrary ISpec 
Instance details

Defined in Test.Ganeti.HTools.Types

Methods

arbitrary :: Gen ISpec

shrink :: ISpec -> [ISpec]

loadISpec :: JSValue -> Result ISpec Source #

saveISpec :: ISpec -> JSValue Source #

defMinISpec :: ISpec Source #

The default minimum ispec.

defStdISpec :: ISpec Source #

The default standard ispec.

defMaxISpec :: ISpec Source #

The default max ispec.

data MinMaxISpecs Source #

Minimum and maximum instance specs type.

Instances

Instances details
Eq MinMaxISpecs # 
Instance details

Defined in Ganeti.HTools.Types

Methods

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

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

Show MinMaxISpecs # 
Instance details

Defined in Ganeti.HTools.Types

Methods

showsPrec :: Int -> MinMaxISpecs -> ShowS

show :: MinMaxISpecs -> String

showList :: [MinMaxISpecs] -> ShowS

JSON MinMaxISpecs # 
Instance details

Defined in Ganeti.HTools.Types

Methods

readJSON :: JSValue -> Result MinMaxISpecs

showJSON :: MinMaxISpecs -> JSValue

readJSONs :: JSValue -> Result [MinMaxISpecs]

showJSONs :: [MinMaxISpecs] -> JSValue

ArrayObject MinMaxISpecs # 
Instance details

Defined in Ganeti.HTools.Types

Methods

toJSArray :: MinMaxISpecs -> [JSValue] Source #

fromJSArray :: [JSValue] -> Result MinMaxISpecs Source #

DictObject MinMaxISpecs # 
Instance details

Defined in Ganeti.HTools.Types

Methods

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

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

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

Arbitrary MinMaxISpecs 
Instance details

Defined in Test.Ganeti.HTools.Types

loadMinMaxISpecs :: JSValue -> Result MinMaxISpecs Source #

defMinMaxISpecs :: [MinMaxISpecs] Source #

Defult minimum and maximum instance specs.

data IPolicy Source #

Instance policy type.

Instances

Instances details
Eq IPolicy # 
Instance details

Defined in Ganeti.HTools.Types

Methods

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

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

Show IPolicy # 
Instance details

Defined in Ganeti.HTools.Types

Methods

showsPrec :: Int -> IPolicy -> ShowS

show :: IPolicy -> String

showList :: [IPolicy] -> ShowS

JSON IPolicy # 
Instance details

Defined in Ganeti.HTools.Types

Methods

readJSON :: JSValue -> Result IPolicy

showJSON :: IPolicy -> JSValue

readJSONs :: JSValue -> Result [IPolicy]

showJSONs :: [IPolicy] -> JSValue

ArrayObject IPolicy # 
Instance details

Defined in Ganeti.HTools.Types

Methods

toJSArray :: IPolicy -> [JSValue] Source #

fromJSArray :: [JSValue] -> Result IPolicy Source #

DictObject IPolicy # 
Instance details

Defined in Ganeti.HTools.Types

Methods

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

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

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

Arbitrary IPolicy 
Instance details

Defined in Test.Ganeti.HTools.Types

Methods

arbitrary :: Gen IPolicy

shrink :: IPolicy -> [IPolicy]

loadIPolicy :: JSValue -> Result IPolicy Source #

saveIPolicy :: IPolicy -> JSValue Source #

rspecFromISpec :: ISpec -> RSpec Source #

Converts an ISpec type to a RSpec one.

defIPolicy :: IPolicy Source #

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

Instances

Instances details
Eq DynUtil # 
Instance details

Defined in Ganeti.HTools.Types

Methods

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

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

Show DynUtil # 
Instance details

Defined in Ganeti.HTools.Types

Methods

showsPrec :: Int -> DynUtil -> ShowS

show :: DynUtil -> String

showList :: [DynUtil] -> ShowS

zeroUtil :: DynUtil Source #

Initial empty utilisation.

baseUtil :: DynUtil Source #

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

addUtil :: DynUtil -> DynUtil -> DynUtil Source #

Sum two utilisation records.

subUtil :: DynUtil -> DynUtil -> DynUtil Source #

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

Instances details
Show IMove # 
Instance details

Defined in Ganeti.HTools.Types

Methods

showsPrec :: Int -> IMove -> ShowS

show :: IMove -> String

showList :: [IMove] -> ShowS

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

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

unknownField :: String Source #

Unknown field in table output.

type JobSet = [MoveJob] Source #

A list of command elements.

defReservedDiskRatio :: Double Source #

Default max disk usage ratio.

unitMem :: Int Source #

Base memory unit.

unitDsk :: Int Source #

Base disk unit.

unitCpu :: Int Source #

Base vcpus unit.

unitSpindle :: Int Source #

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

Instances details
Bounded FailMode # 
Instance details

Defined in Ganeti.HTools.Types

Enum FailMode # 
Instance details

Defined in Ganeti.HTools.Types

Eq FailMode # 
Instance details

Defined in Ganeti.HTools.Types

Methods

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

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

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

noMsg :: FailMode

strMsg :: String -> FailMode

Arbitrary FailMode 
Instance details

Defined in Test.Ganeti.HTools.Types

Arbitrary a => Arbitrary (OpResult a) 
Instance details

Defined in Test.Ganeti.HTools.Types

Methods

arbitrary :: Gen (OpResult a)

shrink :: OpResult a -> [OpResult a]

type FailStats = [(FailMode, Int)] Source #

List with failure statistics.

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

opToResult :: OpResult a -> Result a Source #

Conversion from OpResult to Result.

class Element a where Source #

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

Minimal complete definition

nameOf, allNames, idxOf, setAlias, setIdx

Methods

nameOf :: a -> String Source #

Returns the name of the element

allNames :: a -> [String] Source #

Returns all the known names of the element

idxOf :: a -> Int Source #

Returns the index of the element

setAlias :: a -> String -> a Source #

Updates the alias of the element

computeAlias :: String -> a -> a Source #

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

setIdx :: a -> Int -> a Source #

Updates the index of the element

Instances

Instances details
Element Group # 
Instance details

Defined in Ganeti.HTools.Group

Methods

nameOf :: Group -> String Source #

allNames :: Group -> [String] Source #

idxOf :: Group -> Int Source #

setAlias :: Group -> String -> Group Source #

computeAlias :: String -> Group -> Group Source #

setIdx :: Group -> Int -> Group Source #

Element Instance # 
Instance details

Defined in Ganeti.HTools.Instance

Methods

nameOf :: Instance -> String Source #

allNames :: Instance -> [String] Source #

idxOf :: Instance -> Int Source #

setAlias :: Instance -> String -> Instance Source #

computeAlias :: String -> Instance -> Instance Source #

setIdx :: Instance -> Int -> Instance Source #

Element Node # 
Instance details

Defined in Ganeti.HTools.Node

Methods

nameOf :: Node -> String Source #

allNames :: Node -> [String] Source #

idxOf :: Node -> Int Source #

setAlias :: Node -> String -> Node Source #

computeAlias :: String -> Node -> Node Source #

setIdx :: Node -> Int -> Node Source #

data AutoRepairType Source #

The repair modes for the auto-repair tool.

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

data AutoRepairResult Source #

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

Eq AutoRepairResult # 
Instance details

Defined in Ganeti.HTools.Types

Ord 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

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

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

Instances

Instances details
Eq AutoRepairPolicy # 
Instance details

Defined in Ganeti.HTools.Types

Show AutoRepairPolicy # 
Instance details

Defined in Ganeti.HTools.Types

Methods

showsPrec :: Int -> AutoRepairPolicy -> ShowS

show :: AutoRepairPolicy -> String

showList :: [AutoRepairPolicy] -> ShowS

data AutoRepairSuspendTime Source #

The suspend timeout for ArSuspended.

Constructors

Forever

Permanently suspended

Until ClockTime

Suspended up to a certain time

Instances

Instances details
Eq AutoRepairSuspendTime # 
Instance details

Defined in Ganeti.HTools.Types

Show AutoRepairSuspendTime # 
Instance details

Defined in Ganeti.HTools.Types

Methods

showsPrec :: Int -> AutoRepairSuspendTime -> ShowS

show :: AutoRepairSuspendTime -> String

showList :: [AutoRepairSuspendTime] -> ShowS

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

Instances

Instances details
Eq AutoRepairStatus # 
Instance details

Defined in Ganeti.HTools.Types

Show AutoRepairStatus # 
Instance details

Defined in Ganeti.HTools.Types

Methods

showsPrec :: Int -> AutoRepairStatus -> ShowS

show :: AutoRepairStatus -> String

showList :: [AutoRepairStatus] -> ShowS

data AutoRepairData Source #

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

Constructors

AutoRepairData 

Fields

Instances

Instances details
Eq AutoRepairData # 
Instance details

Defined in Ganeti.HTools.Types

Show AutoRepairData # 
Instance details

Defined in Ganeti.HTools.Types

Methods

showsPrec :: Int -> AutoRepairData -> ShowS

show :: AutoRepairData -> String

showList :: [AutoRepairData] -> ShowS