ganeti-htoolsSource codeContentsIndex
Ganeti.HTools.Node
Contents
Type declarations
Helper functions
Initialization functions
Update functions
Stats functions
Display functions
Description

Module describing a node.

All updates are functional (copy-based) and return a new node with updated value.

Synopsis
type TagMap = Map String Int
data Node = Node {
name :: String
alias :: String
tMem :: Double
nMem :: Int
fMem :: Int
xMem :: Int
tDsk :: Double
fDsk :: Int
tCpu :: Double
uCpu :: Int
pList :: [Idx]
sList :: [Idx]
idx :: Ndx
peers :: PeerMap
failN1 :: Bool
rMem :: Int
pMem :: Double
pDsk :: Double
pRem :: Double
pCpu :: Double
mDsk :: Double
mCpu :: Double
loDsk :: Int
hiCpu :: Int
offline :: Bool
utilPool :: DynUtil
utilLoad :: DynUtil
pTags :: TagMap
group :: Gdx
}
type AssocList = [(Ndx, Node)]
type List = Container Node
type AllocElement = (List, Instance, [Node], Score)
noSecondary :: Ndx
addTag :: TagMap -> String -> TagMap
addTags :: TagMap -> [String] -> TagMap
delTag :: TagMap -> String -> TagMap
delTags :: TagMap -> [String] -> TagMap
rejectAddTags :: TagMap -> [String] -> Bool
conflictingPrimaries :: Node -> Int
create :: String -> Double -> Int -> Int -> Double -> Int -> Double -> Bool -> Gdx -> Node
mDskToloDsk :: Double -> Double -> Int
mCpuTohiCpu :: Double -> Double -> Int
setIdx :: Node -> Ndx -> Node
setAlias :: Node -> String -> Node
setOffline :: Node -> Bool -> Node
setXmem :: Node -> Int -> Node
setMdsk :: Node -> Double -> Node
setMcpu :: Node -> Double -> Node
computeMaxRes :: PeerMap -> Elem
buildPeers :: Node -> List -> Node
setPri :: Node -> Instance -> Node
setSec :: Node -> Instance -> Node
setFmem :: Node -> Int -> Node
removePri :: Node -> Instance -> Node
removeSec :: Node -> Instance -> Node
addPri :: Node -> Instance -> OpResult Node
addPriEx :: Bool -> Node -> Instance -> OpResult Node
addSec :: Node -> Instance -> Ndx -> OpResult Node
addSecEx :: Bool -> Node -> Instance -> Ndx -> OpResult Node
availDisk :: Node -> Int
iDsk :: Node -> Int
availMem :: Node -> Int
availCpu :: Node -> Int
iMem :: Node -> Int
showField :: Node -> String -> String
showHeader :: String -> (String, Bool)
list :: [String] -> Node -> [String]
defaultFields :: [String]
computeGroups :: [Node] -> [(Gdx, [Node])]
Type declarations
type TagMap = Map String IntSource
The tag map type.
data Node Source
The node type.
Constructors
Node
name :: StringThe node name
alias :: StringThe shortened name (for display purposes)
tMem :: DoubleTotal memory (MiB)
nMem :: IntNode memory (MiB)
fMem :: IntFree memory (MiB)
xMem :: IntUnaccounted memory (MiB)
tDsk :: DoubleTotal disk space (MiB)
fDsk :: IntFree disk space (MiB)
tCpu :: DoubleTotal CPU count
uCpu :: IntUsed VCPU count
pList :: [Idx]List of primary instance indices
sList :: [Idx]List of secondary instance indices
idx :: NdxInternal index for book-keeping
peers :: PeerMapPnode to instance mapping
failN1 :: BoolWhether the node has failed n1
rMem :: IntMaximum memory needed for failover by primaries of this node
pMem :: DoublePercent of free memory
pDsk :: DoublePercent of free disk
pRem :: DoublePercent of reserved memory
pCpu :: DoubleRatio of virtual to physical CPUs
mDsk :: DoubleMinimum free disk ratio
mCpu :: DoubleMax ratio of virt-to-phys CPUs
loDsk :: IntAutocomputed from mDsk low disk threshold
hiCpu :: IntAutocomputed from mCpu high cpu threshold
offline :: BoolWhether the node should not be used for allocations and skipped from score computations
utilPool :: DynUtilTotal utilisation capacity
utilLoad :: DynUtilSum of instance utilisation
pTags :: TagMapMap of primary instance tags and their count
group :: GdxThe node's group (index)
type AssocList = [(Ndx, Node)]Source
A simple name for the int, node association list.
type List = Container NodeSource
A simple name for a node map.
type AllocElement = (List, Instance, [Node], Score)Source
A simple name for an allocation element (here just for logistic reasons).
noSecondary :: NdxSource
Constant node index for a non-moveable instance.
Helper functions
addTag :: TagMap -> String -> TagMapSource
Add a tag to a tagmap.
addTags :: TagMap -> [String] -> TagMapSource
Add multiple tags.
delTag :: TagMap -> String -> TagMapSource
Adjust or delete a tag from a tagmap.
delTags :: TagMap -> [String] -> TagMapSource
Remove multiple tags.
rejectAddTags :: TagMap -> [String] -> BoolSource
Check if we can add a list of tags to a tagmap.
conflictingPrimaries :: Node -> IntSource
Check how many primary instances have conflicting tags. The algorithm to compute this is to sum the count of all tags, then subtract the size of the tag map (since each tag has at least one, non-conflicting instance); this is equivalent to summing the values in the tag map minus one.
Initialization functions
create :: String -> Double -> Int -> Int -> Double -> Int -> Double -> Bool -> Gdx -> NodeSource

Create a new node.

The index and the peers maps are empty, and will be need to be update later via the setIdx and buildPeers functions.

mDskToloDsk :: Double -> Double -> IntSource
Conversion formula from mDsk/tDsk to loDsk.
mCpuTohiCpu :: Double -> Double -> IntSource
Conversion formula from mCpu/tCpu to hiCpu.
setIdx :: Node -> Ndx -> NodeSource

Changes the index.

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

setAlias :: Node -> String -> NodeSource

Changes the alias.

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

setOffline :: Node -> Bool -> NodeSource
Sets the offline attribute.
setXmem :: Node -> Int -> NodeSource
Sets the unnaccounted memory.
setMdsk :: Node -> Double -> NodeSource
Sets the max disk usage ratio.
setMcpu :: Node -> Double -> NodeSource
Sets the max cpu usage ratio.
computeMaxRes :: PeerMap -> ElemSource
Computes the maximum reserved memory for peers from a peer map.
buildPeers :: Node -> List -> NodeSource
Builds the peer map for a given node.
setPri :: Node -> Instance -> NodeSource
Assigns an instance to a node as primary and update the used VCPU count, utilisation data and tags map.
setSec :: Node -> Instance -> NodeSource
Assigns an instance to a node as secondary without other updates.
Update functions
setFmem :: Node -> Int -> NodeSource
Sets the free memory.
removePri :: Node -> Instance -> NodeSource
Removes a primary instance.
removeSec :: Node -> Instance -> NodeSource
Removes a secondary instance.
addPri :: Node -> Instance -> OpResult NodeSource
Adds a primary instance (basic version).
addPriExSource
:: BoolWhether to override the N+1 and other soft checks, useful if we come from a worse status (e.g. offline)
-> NodeThe target node
-> InstanceThe instance to add
-> OpResult NodeThe result of the operation, either the new version of the node or a failure mode
Adds a primary instance (extended version).
addSec :: Node -> Instance -> Ndx -> OpResult NodeSource
Adds a secondary instance (basic version).
addSecEx :: Bool -> Node -> Instance -> Ndx -> OpResult NodeSource
Adds a secondary instance (extended version).
Stats functions
availDisk :: Node -> IntSource
Computes the amount of available disk on a given node.
iDsk :: Node -> IntSource
Computes the amount of used disk on a given node.
availMem :: Node -> IntSource
Computes the amount of available memory on a given node.
availCpu :: Node -> IntSource
Computes the amount of available memory on a given node.
iMem :: Node -> IntSource
The memory used by instances on a given node.
Display functions
showFieldSource
:: NodeNode which we're querying
-> StringField name
-> StringField value as string
Return a field for a given node.
showHeader :: String -> (String, Bool)Source
Returns the header and numeric propery of a field.
list :: [String] -> Node -> [String]Source
String converter for the node list functionality.
defaultFields :: [String]Source
Constant holding the fields we're displaying by default.
computeGroups :: [Node] -> [(Gdx, [Node])]Source
Split a list of nodes into a list of (node group UUID, list of associated nodes).
Produced by Haddock version 2.6.0