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 (Maybe [String])
- | AllocateSecondary Idx
- | Relocate Idx Int [Ndx]
- | NodeEvacuate [Idx] EvacMode
- | ChangeGroup [Gdx] [Idx]
- | MultiAllocate [(Instance, AllocDetails)]
- data Request = Request RqType ClusterData
- isAllocationRequest :: RqType -> Maybe (Maybe String)
- 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
- updateDesiredLocationTags :: [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]
- extractDesiredLocations :: [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
- obtainNodeMemory :: FilledHvState -> Int -> Int
Types
The iallocator request type.
This type denotes what request we got from Ganeti and also holds request-specific fields.
Allocate Instance AllocDetails (Maybe [String]) | A new instance allocation, maybe with allocation restrictions |
AllocateSecondary Idx | Find a suitable secondary node for disk conversion |
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 |
isAllocationRequest :: RqType -> Maybe (Maybe String)Source
Decide whether a request asks to allocate new instances; if so, also
return the desired node group, if a unique node group is specified.
That is, return Nothing
if the request is not an allocation request,
`Just Nothing`, if it is an Allocation request, but there is no unique
group specified, and return `Just (Just g)` if it is an allocation request
uniquely requesting Group g
.
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.
updateDesiredLocationTags :: [String] -> Instance -> InstanceSource
Update instance with desired location 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.
extractDesiredLocations :: [String] -> [String]Source
Extracts the desired locations from the instance tags.
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
obtainNodeMemory :: FilledHvState -> Int -> IntSource
Obtains memory used by node. It's memory_dom0 for Xen and memNode otherwise because live data collector exists only for Xen