ganeti-3.1: Cluster-based virtualization management software
Safe HaskellSafe-Inferred
LanguageHaskell2010

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

Documentation

mergeData #

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.

updateMissing #

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.

data RqType #

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

Instances

Instances details
Show RqType # 
Instance details

Defined in Ganeti.HTools.Loader

Methods

showsPrec :: Int -> RqType -> ShowS

show :: RqType -> String

showList :: [RqType] -> ShowS

data Request #

A complete request, as received from Ganeti.

Constructors

Request RqType ClusterData 

Instances

Instances details
Show Request # 
Instance details

Defined in Ganeti.HTools.Loader

Methods

showsPrec :: Int -> Request -> ShowS

show :: Request -> String

showList :: [Request] -> ShowS

data ClusterData #

The cluster state.

Constructors

ClusterData 

Fields

Instances

Instances details
Show ClusterData # 
Instance details

Defined in Ganeti.HTools.Loader

Methods

showsPrec :: Int -> ClusterData -> ShowS

show :: ClusterData -> String

showList :: [ClusterData] -> ShowS

Eq ClusterData # 
Instance details

Defined in Ganeti.HTools.Loader

Methods

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

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

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.

emptyCluster :: ClusterData #

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.