ganeti-htoolsSource codeContentsIndex
Ganeti.HTools.Loader
Contents
Constants
Types
Functions
Description

Generic data loader.

This module holds the common code for parsing the input data after it has been loaded from external sources.

Synopsis
exTagsPrefix :: String
data RqType
= Allocate Instance Int
| Relocate Idx Int [Ndx]
| NodeEvacuate [Idx] EvacMode
| ChangeGroup [Gdx] [Idx]
data Request = Request RqType ClusterData
data ClusterData = ClusterData {
cdGroups :: List
cdNodes :: List
cdInstances :: List
cdTags :: [String]
cdIPolicy :: IPolicy
}
emptyCluster :: ClusterData
lookupNode :: Monad m => NameAssoc -> String -> String -> m Ndx
lookupInstance :: Monad m => NameAssoc -> String -> m Idx
lookupGroup :: Monad m => NameAssoc -> String -> String -> m Gdx
assignIndices :: Element a => [(String, a)] -> (NameAssoc, Container a)
fixNodes :: List -> Instance -> List
setNodePolicy :: List -> Node -> Node
filterExTags :: [String] -> Instance -> Instance
updateMovable :: [String] -> [String] -> Instance -> Instance
disableSplitMoves :: List -> Instance -> Instance
longestDomain :: [String] -> String
extractExTags :: [String] -> [String]
commonSuffix :: List -> List -> String
mergeData :: [(String, DynUtil)] -> [String] -> [String] -> [String] -> ClusterData -> Result ClusterData
checkData :: List -> List -> ([String], List)
nodeImem :: Node -> List -> Int
nodeIdsk :: Node -> List -> Int
Constants
exTagsPrefix :: StringSource
The exclusion tag prefix.
Types
data RqType Source

The iallocator request type.

This type denotes what request we got from Ganeti and also holds request-specific fields.

Constructors
Allocate Instance IntA new instance allocation
Relocate Idx Int [Ndx]Choose a new secondary node
NodeEvacuate [Idx] EvacModenode-evacuate mode
ChangeGroup [Gdx] [Idx]Multi-relocate mode
data Request Source
A complete request, as received from Ganeti.
Constructors
Request RqType ClusterData
data ClusterData Source
The cluster state.
Constructors
ClusterData
cdGroups :: ListThe node group list
cdNodes :: ListThe node list
cdInstances :: ListThe instance list
cdTags :: [String]The cluster tags
cdIPolicy :: IPolicyThe cluster instance policy
emptyCluster :: ClusterDataSource
An empty cluster.
Functions
lookupNode :: Monad m => NameAssoc -> String -> String -> m NdxSource
Lookups a node into an assoc list.
lookupInstance :: Monad m => NameAssoc -> String -> m IdxSource
Lookups an instance into an assoc list.
lookupGroup :: Monad m => NameAssoc -> String -> String -> m GdxSource
Lookups a group into an assoc list.
assignIndices :: Element a => [(String, a)] -> (NameAssoc, Container a)Source
Given a list of elements (and their names), assign indices to them.
fixNodes :: List -> Instance -> ListSource
For each instance, add its index to its primary and secondary nodes.
setNodePolicy :: List -> Node -> NodeSource
Set the node's policy to its group one. Note that this requires the group to exist (should have been checked before), otherwise it will abort with a runtime error.
filterExTags :: [String] -> Instance -> InstanceSource
Remove non-selected tags from the exclusion list.
updateMovableSource
:: [String]Selected instances (if not empty)
-> [String]Excluded instances
-> InstanceTarget Instance
-> InstanceTarget Instance with updated attribute
Update the movable attribute.
disableSplitMoves :: List -> Instance -> InstanceSource
Disables moves for instances with a split group.
longestDomain :: [String] -> StringSource
Compute the longest common suffix of a list of strings that starts with a dot.
extractExTags :: [String] -> [String]Source
Extracts the exclusion tags from the cluster configuration.
commonSuffix :: List -> List -> StringSource
Extracts the common suffix from node/instance names.
mergeDataSource
:: [(String, DynUtil)]Instance utilisation data
-> [String]Exclusion tags
-> [String]Selected instances (if not empty)
-> [String]Excluded instances
-> ClusterDataData from backends
-> Result ClusterDataFixed cluster data
Initializer function that loads the data from a node and instance list and massages it into the correct format.
checkData :: List -> List -> ([String], List)Source
Checks the cluster data for consistency.
nodeImem :: Node -> List -> IntSource
Compute the amount of memory used by primary instances on a node.
nodeIdsk :: Node -> List -> IntSource
Compute the amount of disk used by instances on a node (either primary or secondary).
Produced by Haddock version 2.6.0