ganeti

Safe HaskellSafe-Infered

Ganeti.HTools.Loader

Contents

Description

Generic data loader.

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

Synopsis

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

Instances

Show RqType 

data Request Source

A complete request, as received from Ganeti.

Constructors

Request RqType ClusterData 

Instances

Show Request 

data ClusterData Source

The cluster state.

Constructors

ClusterData 

Fields

cdGroups :: List

The node group list

cdNodes :: List

The node list

cdInstances :: List

The instance list

cdTags :: [String]

The cluster tags

cdIPolicy :: IPolicy

The cluster instance policy

Instances

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.

updateExclTags :: [String] -> Instance -> InstanceSource

Update instance with exclusion tags list.

updateMovable :: [String] -> [String] -> Instance -> InstanceSource

setArPolicy :: [String] -> List -> List -> List -> ClockTime -> ListSource

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

mergeDataSource

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 ClusterDataSource

In a cluster description, clear dynamic utilisation information.

checkData :: List -> List -> ([String], List)Source

Checks the cluster data for consistency.

nodeImem :: Node -> List -> IntSource

nodeIdsk :: Node -> List -> IntSource

eitherLive :: Monad m => Bool -> a -> m a -> m aSource

Get live information or a default value