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.

Operations on the whole configuration

readConfig :: FilePath -> IO (Result String)Source

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

Wrapper over readConfig and parseConfig.

saveConfig :: Handle -> ConfigData -> IO ()Source

Wrapper over hPutStr and encodeConfig.

Query functions

computeDiskNodes :: Disk -> Set StringSource

instNodes :: ConfigData -> Instance -> Set StringSource

Computes all nodes of an instance.

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

Get instances of a given node. The node is specified through its UUID.

getNodeRole :: ConfigData -> Node -> NodeRoleSource

Computes the role of a node.

getMasterNodes :: ConfigData -> [Node]Source

Get the list of the master nodes (usually one).

getMasterCandidates :: ConfigData -> [Node]Source

Get the list of master candidates, not including the master itself.

getMasterOrCandidates :: ConfigData -> [Node]Source

Get the list of master candidates, including the master.

getMasterNetworkParameters :: ConfigData -> MasterNetworkParametersSource

Get the network parameters for the master IP address.

getOnlineNodes :: ConfigData -> [Node]Source

Get the list of online nodes.

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 by name or uuid.

getInstance :: ConfigData -> String -> ErrorResult InstanceSource

Looks up an instance by name or uuid.

getDisk :: ConfigData -> String -> ErrorResult DiskSource

Looks up a disk by uuid.

getGroup :: ConfigData -> String -> ErrorResult NodeGroupSource

Looks up a node group by name or uuid.

getGroupNdParams :: ConfigData -> NodeGroup -> FilledNDParamsSource

Computes a node group's node params.

getGroupIpolicy :: ConfigData -> NodeGroup -> FilledIPolicySource

Computes a node group's ipolicy.

getGroupDiskParams :: ConfigData -> NodeGroup -> GroupDiskParamsSource

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.

getFilledInstHvParams :: [String] -> ConfigData -> Instance -> HvParamsSource

Retrieves the instance hypervisor params, missing values filled with cluster defaults.

getFilledInstBeParams :: ConfigData -> Instance -> ErrorResult FilledBeParamsSource

Retrieves the instance backend params, missing values filled with cluster defaults.

getFilledInstOsParams :: ConfigData -> Instance -> OsParamsSource

Retrieves the instance os params, missing values filled with cluster defaults. This does NOT include private and secret parameters.

getInstPrimaryNode :: ConfigData -> String -> ErrorResult NodeSource

Looks up an instance's primary node.

getInstAllNodes :: ConfigData -> String -> ErrorResult [Node]Source

Retrieves all the nodes of the instance.

As instances not using DRBD can be sent as a parameter as well, the primary node has to be appended to the results.

getInstDisks :: ConfigData -> String -> ErrorResult [Disk]Source

Get disks for a given instance. The instance is specified by name or uuid.

getInstDisksFromObj :: ConfigData -> Instance -> ErrorResult [Disk]Source

Get disks for a given instance object.

collectFromDrbdDisks :: Monoid a => (String -> String -> Int -> Int -> Int -> Private DRBDSecret -> a) -> Disk -> aSource

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

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

getDrbdMinorsForInstance :: ConfigData -> Instance -> ErrorResult [(Int, String)]Source

Returns the DRBD minors of a given instance

getInstMinorsForNodeSource

Arguments

:: ConfigData 
-> String

The UUID of a node.

-> Instance 
-> [(String, Int, String, String, String, String)] 

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.

Network

getNetwork :: ConfigData -> String -> ErrorResult NetworkSource

Looks up a network. If looking up by uuid fails, we look up by name.

MACs

type MAC = StringSource

getAllMACs :: ConfigData -> [MAC]Source

Returns all MAC addresses used in the cluster.

DRBD secrets

LVs

type NodeLVsMap = MultiMap String LogicalVolumeSource

A map from node UUIDs to

FIXME: After adding designated types for UUIDs, use them to replace String here.

ND params

class NdParamObject a whereSource

Type class denoting objects which have node parameters.