Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Ganeti.HTools.Loader
Description
Generic data loader.
This module holds the common code for parsing the input data after it has been loaded from external sources.
Synopsis
- mergeData :: [(String, DynUtil)] -> [String] -> [String] -> [String] -> ClockTime -> ClusterData -> Result ClusterData
- clearDynU :: ClusterData -> Result ClusterData
- updateMissing :: List -> List -> Int -> ([String], List)
- updateMemStat :: Node -> List -> Node
- assignIndices :: Element a => [(String, a)] -> (NameAssoc, Container a)
- setMaster :: MonadFail m => NameAssoc -> List -> String -> m List
- lookupNode :: MonadFail m => NameAssoc -> String -> String -> m Ndx
- lookupInstance :: MonadFail m => NameAssoc -> String -> m Idx
- lookupGroup :: MonadFail m => NameAssoc -> String -> String -> m Gdx
- eitherLive :: MonadFail m => Bool -> a -> m a -> m a
- commonSuffix :: List -> List -> String
- extractExTags :: [String] -> [String]
- updateExclTags :: [String] -> Instance -> Instance
- 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
- data ClusterData = ClusterData {}
- isAllocationRequest :: RqType -> Maybe (Maybe String)
- emptyCluster :: ClusterData
- extractDesiredLocations :: [String] -> [String]
- updateDesiredLocationTags :: [String] -> Instance -> Instance
Documentation
Arguments
:: [(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 ClusterData #
In a cluster description, clear dynamic utilisation information.
Arguments
:: List | All nodes in the cluster |
-> List | All instances in the cluster |
-> Int | Static node memory for KVM |
-> ([String], List) | Pair of errors, update node list |
Check the cluster for memory/disk allocation consistency and update stats.
updateMemStat :: Node -> List -> Node #
Update node memory stat and Fail-N+1 state based on instance list.
assignIndices :: Element a => [(String, a)] -> (NameAssoc, Container a) #
Given a list of elements (and their names), assign indices to them.
setMaster :: MonadFail m => NameAssoc -> List -> String -> m List #
Given am indexed node list, and the name of the master, mark it as such.
lookupNode :: MonadFail m => NameAssoc -> String -> String -> m Ndx #
Lookups a node into an assoc list.
lookupInstance :: MonadFail m => NameAssoc -> String -> m Idx #
Lookups an instance into an assoc list.
lookupGroup :: MonadFail m => NameAssoc -> String -> String -> m Gdx #
Lookups a group into an assoc list.
eitherLive :: MonadFail m => Bool -> a -> m a -> m a #
Get live information or a default value
commonSuffix :: List -> List -> String #
Extracts the common suffix from node/instance names.
extractExTags :: [String] -> [String] #
Extracts the exclusion tags from the cluster configuration.
updateExclTags :: [String] -> Instance -> Instance #
Update instance with exclusion tags list.
The iallocator request type.
This type denotes what request we got from Ganeti and also holds request-specific fields.
Constructors
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 |
A complete request, as received from Ganeti.
Constructors
Request RqType ClusterData |
data ClusterData #
The cluster state.
Constructors
ClusterData | |
Instances
Show ClusterData # | |
Defined in Ganeti.HTools.Loader Methods showsPrec :: Int -> ClusterData -> ShowS show :: ClusterData -> String showList :: [ClusterData] -> ShowS | |
Eq ClusterData # | |
Defined in Ganeti.HTools.Loader |
isAllocationRequest :: RqType -> Maybe (Maybe String) #
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
.
An empty cluster.
extractDesiredLocations :: [String] -> [String] #
Extracts the desired locations from the instance tags.
updateDesiredLocationTags :: [String] -> Instance -> Instance #
Update instance with desired location tags list.