Safe Haskell | Safe-Infered |
---|
Generic data loader.
This module holds the common code for parsing the input data after it has been loaded from external sources.
- data RqType
- = Allocate Instance AllocDetails
- | Relocate Idx Int [Ndx]
- | NodeEvacuate [Idx] EvacMode
- | ChangeGroup [Gdx] [Idx]
- | MultiAllocate [(Instance, AllocDetails)]
- data Request = Request RqType ClusterData
- data ClusterData = ClusterData {}
- 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)
- setMaster :: Monad m => NameAssoc -> List -> String -> m List
- setLocationScore :: List -> Instance -> Instance
- fixNodes :: List -> Instance -> List
- setNodePolicy :: List -> Node -> Node
- updateExclTags :: [String] -> Instance -> Instance
- updateMovable :: [String] -> [String] -> Instance -> Instance
- disableSplitMoves :: List -> Instance -> Instance
- setArPolicy :: [String] -> List -> List -> List -> ClockTime -> List
- getArPolicy :: [String] -> ClockTime -> Maybe AutoRepairPolicy
- longestDomain :: [String] -> String
- extractExTags :: [String] -> [String]
- commonSuffix :: List -> List -> String
- addMigrationTags :: [String] -> Node -> Node
- addLocationTags :: [String] -> Node -> Node
- mergeData :: [(String, DynUtil)] -> [String] -> [String] -> [String] -> ClockTime -> ClusterData -> Result ClusterData
- clearDynU :: ClusterData -> Result ClusterData
- checkData :: List -> List -> ([String], List)
- nodeImem :: Node -> List -> Int
- nodeIdsk :: Node -> List -> Int
- eitherLive :: Monad m => Bool -> a -> m a -> m a
Types
The iallocator request type.
This type denotes what request we got from Ganeti and also holds request-specific fields.
Allocate Instance AllocDetails | A new instance allocation |
Relocate Idx Int [Ndx] | Choose a new secondary node |
NodeEvacuate [Idx] EvacMode | node-evacuate mode |
ChangeGroup [Gdx] [Idx] | Multi-relocate mode |
MultiAllocate [(Instance, AllocDetails)] | Multi-allocate mode |
Show RqType |
A complete request, as received from Ganeti.
Show Request |
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.
setMaster :: Monad m => NameAssoc -> List -> String -> m ListSource
Given am indexed node list, and the name of the master, mark it as such.
setLocationScore :: List -> Instance -> InstanceSource
setNodePolicy :: List -> Node -> NodeSource
updateExclTags :: [String] -> Instance -> InstanceSource
Update instance with exclusion tags list.
updateMovable :: [String] -> [String] -> Instance -> InstanceSource
disableSplitMoves :: List -> Instance -> InstanceSource
getArPolicy :: [String] -> ClockTime -> Maybe AutoRepairPolicySource
longestDomain :: [String] -> StringSource
extractExTags :: [String] -> [String]Source
Extracts the exclusion tags from the cluster configuration.
commonSuffix :: List -> List -> StringSource
Extracts the common suffix from node/instance names.
addMigrationTags :: [String] -> Node -> NodeSource
addLocationTags :: [String] -> Node -> NodeSource
:: [(String, DynUtil)] | Instance utilisation data |
-> [String] | Exclusion tags |
-> [String] | Selected instances (if not empty) |
-> [String] | Excluded instances |
-> ClockTime | The current timestamp |
-> ClusterData | Data from backends |
-> Result ClusterData | Fixed cluster data |
Initializer function that loads the data from a node and instance list and massages it into the correct format.
clearDynU :: ClusterData -> Result ClusterDataSource
In a cluster description, clear dynamic utilisation information.
eitherLive :: Monad m => Bool -> a -> m a -> m aSource
Get live information or a default value