ganeti

Safe HaskellSafe-Infered

Ganeti.Config

Contents

Description

Implementation of the Ganeti configuration database.

Synopsis

Documentation

type LinkIpMap = Map String (Map String String)Source

Type alias for the link and ip map.

class NdParamObject a whereSource

Type class denoting objects which have node parameters.

readConfig :: FilePath -> IO StringSource

loadConfig :: FilePath -> IO (Result ConfigData)Source

Wrapper over readConfig and parseConfig.

Query functions

computeDiskNodes :: Disk -> Set StringSource

instDiskNodes :: Instance -> Set StringSource

instNodes :: Instance -> Set StringSource

Computes all nodes of an instance.

getNodeInstances :: ConfigData -> String -> ([Instance], [Instance])Source

Get instances of a given node.

getNodeRole :: ConfigData -> Node -> NodeRoleSource

Computes the role of a node.

getDefaultNicLink :: ConfigData -> StringSource

Returns the default cluster link.

getDefaultHypervisor :: ConfigData -> HypervisorSource

Returns the default cluster hypervisor.

getInstancesIpByLink :: LinkIpMap -> String -> [String]Source

Returns instances of a given link.

getItem :: String -> String -> Map String a -> ErrorResult aSource

getNode :: ConfigData -> String -> ErrorResult NodeSource

Looks up a node.

getInstance :: ConfigData -> String -> ErrorResult InstanceSource

Looks up an instance.

getGroup :: ConfigData -> String -> ErrorResult NodeGroupSource

Looks up a node group. This is more tricky than for node/instances since the groups map is indexed by uuid, not name.

getGroupNdParams :: ConfigData -> NodeGroup -> FilledNDParamsSource

Computes a node group's node params.

getGroupIpolicy :: ConfigData -> NodeGroup -> FilledIPolicySource

Computes a node group's ipolicy.

getGroupDiskParams :: ConfigData -> NodeGroup -> DiskParamsSource

Computes a group's (merged) disk params.

getGroupNodes :: ConfigData -> String -> [Node]Source

Get nodes of a given node group.

getGroupInstances :: ConfigData -> String -> ([Instance], [Instance])Source

Get (primary, secondary) instances of a given node group.

getInstPrimaryNode :: ConfigData -> String -> ErrorResult NodeSource

Looks up an instance's primary node.

getDrbdMinorsForNode :: String -> Disk -> [(Int, String)]Source

getInstMinorsForNode :: String -> Instance -> [(String, Int, String, String, String, String)]Source

Gets the list of DRBD minors for an instance that are related to a given node.

buildLinkIpInstnameMap :: ConfigData -> LinkIpMapSource

Builds link -> ip -> instname map.

TODO: improve this by splitting it into multiple independent functions:

  • abstract the "fetch instance with filled params" functionality
  • abstsract the [instance] -> [(nic, instance_name)] part
  • etc.

getGroupOfNode :: ConfigData -> Node -> Maybe NodeGroupSource

Returns a node's group, with optional failure if we can't find it (configuration corrupt).

getNodeNdParams :: ConfigData -> Node -> Maybe FilledNDParamsSource

Returns a node's ndparams, filled.