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
running :: Bool
runSt :: String
pNode :: Ndx
sNode :: Ndx
idx :: Idx
util :: DynUtil
movable :: Bool
autoBalance :: Bool
tags :: [String]
diskTemplate :: DiskTemplate
}
runningStates :: [String]
localStorageTemplates :: [DiskTemplate]
movableDiskTemplates :: [DiskTemplate]
type AssocList = [(Idx, Instance)]
type List = Container Instance
create :: String -> Int -> Int -> Int -> String -> [String] -> Bool -> Ndx -> Ndx -> DiskTemplate -> 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
hasSecondary :: Instance -> Bool
requiredNodes :: DiskTemplate -> Int
allNodes :: Instance -> [Ndx]
usesLocalStorage :: Instance -> Bool
supportsMoves :: DiskTemplate -> Bool
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
running :: BoolIs the instance running?
runSt :: StringOriginal (text) 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
runningStates :: [String]Source
Constant holding the running instance states.
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 -> String -> [String] -> Bool -> Ndx -> Ndx -> DiskTemplate -> 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.
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.
Produced by Haddock version 2.6.0