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]
}
data MatchPriority
= ExactMatch
| MultipleMatch
| PartialMatch
| FailMatch
data LookupResult = LookupResult {
lrMatchPriority :: MatchPriority
lrContent :: String
}
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
prefixMatch :: String -> String -> Bool
goodMatchPriority :: MatchPriority -> Bool
goodLookupResult :: LookupResult -> Bool
compareNameComponent :: String -> String -> LookupResult
chooseLookupResult :: String -> String -> LookupResult -> LookupResult
lookupName :: [String] -> String -> LookupResult
assignIndices :: Element a => [(String, a)] -> (NameAssoc, Container a)
fixNodes :: List -> Instance -> List
filterExTags :: [String] -> Instance -> Instance
updateMovable :: [String] -> [String] -> 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
data MatchPriority Source
The priority of a match in a lookup result.
Constructors
ExactMatch
MultipleMatch
PartialMatch
FailMatch
data LookupResult Source
The result of a name lookup in a list.
Constructors
LookupResult
lrMatchPriority :: MatchPriorityThe result type | Matching value (for ExactMatch, PartialMatch), Lookup string otherwise
lrContent :: String
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.
prefixMatchSource
:: StringLookup
-> StringFull name
-> BoolWhether there is a prefix match
Check for prefix matches in names. Implemented in Ganeti core utils.text.MatchNameComponent as the regexp r^%s(..*)?$ % re.escape(key)
goodMatchPriority :: MatchPriority -> BoolSource
Is the lookup priority a good one?
goodLookupResult :: LookupResult -> BoolSource
Is the lookup result an actual match?
compareNameComponentSource
:: StringCanonical (target) name
-> StringPartial (lookup) name
-> LookupResultResult of the lookup
Compares a canonical name and a lookup string.
chooseLookupResultSource
:: StringLookup key
-> StringString to compare to the lookup key
-> LookupResultPrevious result
-> LookupResultNew result
Lookup a string and choose the best result.
lookupNameSource
:: [String]List of keys
-> StringLookup string
-> LookupResultResult of the lookup
Find the canonical name for a lookup string in a list of names.
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.
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.
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