Safe HaskellNone




Generic data loader.

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



data RqType Source #

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 # 
Instance details

Defined in Ganeti.HTools.Loader


showsPrec :: Int -> RqType -> ShowS

show :: RqType -> String

showList :: [RqType] -> ShowS

data Request Source #

A complete request, as received from Ganeti.


Request RqType ClusterData 
Show Request # 
Instance details

Defined in Ganeti.HTools.Loader


showsPrec :: Int -> Request -> ShowS

show :: Request -> String

showList :: [Request] -> ShowS

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.

data ClusterData Source #

The cluster state.




Eq ClusterData # 
Instance details

Defined in Ganeti.HTools.Loader


(==) :: ClusterData -> ClusterData -> Bool

(/=) :: ClusterData -> ClusterData -> Bool

Show ClusterData # 
Instance details

Defined in Ganeti.HTools.Loader


showsPrec :: Int -> ClusterData -> ShowS

show :: ClusterData -> String

showList :: [ClusterData] -> ShowS

emptyCluster :: ClusterData Source #

An empty cluster.


lookupNode :: MonadFail m => NameAssoc -> String -> String -> m Ndx Source #

Lookups a node into an assoc list.

lookupInstance :: MonadFail m => NameAssoc -> String -> m Idx Source #

Lookups an instance into an assoc list.

lookupGroup :: MonadFail m => NameAssoc -> String -> String -> m Gdx Source #

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 :: MonadFail m => NameAssoc -> List -> String -> m List Source #

Given am indexed node list, and the name of the master, mark it as such.

updateExclTags :: [String] -> Instance -> Instance Source #

Update instance with exclusion tags list.

updateDesiredLocationTags :: [String] -> Instance -> Instance Source #

Update instance with desired location tags list.

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 -> String Source #

Extracts the common suffix from node/instance names.

mergeData Source #


:: [(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 Source #

In a cluster description, clear dynamic utilisation information.

updateMemStat :: Node -> List -> Node Source #

Update node memory stat based on instance list.

updateMissing Source #


:: 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.

eitherLive :: MonadFail m => Bool -> a -> m a -> m a Source #

Get live information or a default value