ganeti-htoolsSource codeContentsIndex
Ganeti.HTools.Instance
Contents
Type declarations
Initialization
Update functions
Description

Module describing an instance.

The instance data type holds very few fields, the algorithm intelligence is in the Node and Cluster modules.

Synopsis
data Instance = Instance {
name :: String
alias :: String
mem :: Int
dsk :: Int
vcpus :: Int
runSt :: InstanceStatus
pNode :: Ndx
sNode :: Ndx
idx :: Idx
util :: DynUtil
movable :: Bool
autoBalance :: Bool
tags :: [String]
diskTemplate :: DiskTemplate
spindleUse :: Int
}
isRunning :: Instance -> Bool
isOffline :: Instance -> Bool
notOffline :: Instance -> Bool
instanceDown :: Instance -> Bool
applyIfOnline :: Instance -> (a -> a) -> a -> a
usesSecMem :: Instance -> Bool
localStorageTemplates :: [DiskTemplate]
movableDiskTemplates :: [DiskTemplate]
type AssocList = [(Idx, Instance)]
type List = Container Instance
create :: String -> Int -> Int -> Int -> InstanceStatus -> [String] -> Bool -> Ndx -> Ndx -> DiskTemplate -> Int -> Instance
setIdx :: Instance -> Idx -> Instance
setName :: Instance -> String -> Instance
setAlias :: Instance -> String -> Instance
setPri :: Instance -> Ndx -> Instance
setSec :: Instance -> Ndx -> Instance
setBoth :: Instance -> Ndx -> Ndx -> Instance
setMovable :: Instance -> Bool -> Instance
shrinkByType :: Instance -> FailMode -> Result Instance
specOf :: Instance -> RSpec
instBelowISpec :: Instance -> ISpec -> OpResult ()
instAboveISpec :: Instance -> ISpec -> OpResult ()
instMatchesPolicy :: Instance -> IPolicy -> OpResult ()
hasSecondary :: Instance -> Bool
requiredNodes :: DiskTemplate -> Int
allNodes :: Instance -> [Ndx]
usesLocalStorage :: Instance -> Bool
supportsMoves :: DiskTemplate -> Bool
mirrorType :: Instance -> MirrorType
Type declarations
data Instance Source
The instance type.
Constructors
Instance
name :: StringThe instance name
alias :: StringThe shortened name
mem :: IntMemory of the instance
dsk :: IntDisk size of instance
vcpus :: IntNumber of VCPUs
runSt :: InstanceStatusOriginal run status
pNode :: NdxOriginal primary node
sNode :: NdxOriginal secondary node
idx :: IdxInternal index
util :: DynUtilDynamic resource usage
movable :: BoolCan and should the instance be moved?
autoBalance :: BoolIs the instance auto-balanced?
tags :: [String]List of instance tags
diskTemplate :: DiskTemplateThe disk template of the instance
spindleUse :: IntThe numbers of used spindles
isRunning :: Instance -> BoolSource
Check if instance is running.
isOffline :: Instance -> BoolSource
Check if instance is offline.
notOffline :: Instance -> BoolSource
Helper to check if the instance is not offline.
instanceDown :: Instance -> BoolSource
Check if instance is down.
applyIfOnline :: Instance -> (a -> a) -> a -> aSource
Apply the function if the instance is online. Otherwise use the initial value
usesSecMem :: Instance -> BoolSource
Helper for determining whether an instance's memory needs to be taken into account for secondary memory reservation.
localStorageTemplates :: [DiskTemplate]Source

Constant holding the local storage templates.

Note: Currently Ganeti only exports node total/free disk space for LVM-based storage; file-based storage is ignored in this model, so even though file-based storage uses in reality disk space on the node, in our model it won't affect it and we can't compute whether there is enough disk space for a file-based instance. Therefore we will treat this template as 'foreign' storage.

movableDiskTemplates :: [DiskTemplate]Source

Constant holding the movable disk templates.

This only determines the initial movable state of the instance. Further the movable state can be restricted more due to user choices, etc.

type AssocList = [(Idx, Instance)]Source
A simple name for the int, instance association list.
type List = Container InstanceSource
A simple name for an instance map.
Initialization
create :: String -> Int -> Int -> Int -> InstanceStatus -> [String] -> Bool -> Ndx -> Ndx -> DiskTemplate -> Int -> InstanceSource

Create an instance.

Some parameters are not initialized by function, and must be set later (via setIdx for example).

setIdxSource
:: InstanceThe original instance
-> IdxNew index
-> InstanceThe modified instance

Changes the index.

This is used only during the building of the data structures.

setNameSource
:: InstanceThe original instance
-> StringNew name
-> InstanceThe modified instance

Changes the name.

This is used only during the building of the data structures.

setAliasSource
:: InstanceThe original instance
-> StringNew alias
-> InstanceThe modified instance

Changes the alias.

This is used only during the building of the data structures.

Update functions
setPriSource
:: Instancethe original instance
-> Ndxthe new primary node
-> Instancethe modified instance
Changes the primary node of the instance.
setSecSource
:: Instancethe original instance
-> Ndxthe new secondary node
-> Instancethe modified instance
Changes the secondary node of the instance.
setBothSource
:: Instancethe original instance
-> Ndxnew primary node index
-> Ndxnew secondary node index
-> Instancethe modified instance
Changes both nodes of the instance.
setMovableSource
:: InstanceThe original instance
-> BoolNew movable flag
-> InstanceThe modified instance
Sets the movable flag on an instance.
shrinkByType :: Instance -> FailMode -> Result InstanceSource
Try to shrink the instance based on the reason why we can't allocate it.
specOf :: Instance -> RSpecSource
Return the spec of an instance.
instBelowISpec :: Instance -> ISpec -> OpResult ()Source
Checks if an instance is smaller than a given spec. Returns OpGood for a correct spec, otherwise OpFail one of the possible failure modes.
instAboveISpec :: Instance -> ISpec -> OpResult ()Source
Checks if an instance is bigger than a given spec.
instMatchesPolicy :: Instance -> IPolicy -> OpResult ()Source
Checks if an instance matches a policy.
hasSecondary :: Instance -> BoolSource

Checks whether the instance uses a secondary node.

Note: This should be reconciled with sNode == Node.noSecondary.

requiredNodes :: DiskTemplate -> IntSource
Computed the number of nodes for a given disk template.
allNodes :: Instance -> [Ndx]Source
Computes all nodes of an instance.
usesLocalStorage :: Instance -> BoolSource
Checks whether a given disk template uses local storage.
supportsMoves :: DiskTemplate -> BoolSource
Checks whether a given disk template supported moves.
mirrorType :: Instance -> MirrorTypeSource
A simple wrapper over templateMirrorType.
Produced by Haddock version 2.6.0