Safe Haskell | Safe-Infered |
---|
Implementation of the Ganeti configuration database.
- type LinkIpMap = Map String (Map String String)
- class NdParamObject a where
- getNdParamsOf :: ConfigData -> a -> Maybe FilledNDParams
- readConfig :: FilePath -> IO String
- parseConfig :: String -> Result ConfigData
- loadConfig :: FilePath -> IO (Result ConfigData)
- computeDiskNodes :: Disk -> Set String
- instDiskNodes :: Instance -> Set String
- instNodes :: Instance -> Set String
- instSecondaryNodes :: Instance -> Set String
- getNodeInstances :: ConfigData -> String -> ([Instance], [Instance])
- getNodeRole :: ConfigData -> Node -> NodeRole
- getMasterCandidates :: ConfigData -> [Node]
- getDefaultNicLink :: ConfigData -> String
- getDefaultHypervisor :: ConfigData -> Hypervisor
- getInstancesIpByLink :: LinkIpMap -> String -> [String]
- getItem :: String -> String -> Map String a -> ErrorResult a
- getNode :: ConfigData -> String -> ErrorResult Node
- getInstance :: ConfigData -> String -> ErrorResult Instance
- getGroup :: ConfigData -> String -> ErrorResult NodeGroup
- getGroupNdParams :: ConfigData -> NodeGroup -> FilledNDParams
- getGroupIpolicy :: ConfigData -> NodeGroup -> FilledIPolicy
- getGroupDiskParams :: ConfigData -> NodeGroup -> DiskParams
- getGroupNodes :: ConfigData -> String -> [Node]
- getGroupInstances :: ConfigData -> String -> ([Instance], [Instance])
- getNetwork :: ConfigData -> String -> ErrorResult Network
- getFilledInstHvParams :: [String] -> ConfigData -> Instance -> HvParams
- getFilledInstBeParams :: ConfigData -> Instance -> ErrorResult FilledBeParams
- getFilledInstOsParams :: ConfigData -> Instance -> OsParams
- getInstPrimaryNode :: ConfigData -> String -> ErrorResult Node
- getDrbdDiskNodes :: ConfigData -> Disk -> [Node]
- getInstAllNodes :: ConfigData -> String -> ErrorResult [Node]
- getDrbdMinorsForNode :: String -> Disk -> [(Int, String)]
- rolePrimary :: String
- roleSecondary :: String
- getInstMinorsForNode :: String -> Instance -> [(String, Int, String, String, String, String)]
- buildLinkIpInstnameMap :: ConfigData -> LinkIpMap
- getGroupOfNode :: ConfigData -> Node -> Maybe NodeGroup
- getNodeNdParams :: ConfigData -> Node -> Maybe FilledNDParams
Documentation
class NdParamObject a whereSource
Type class denoting objects which have node parameters.
getNdParamsOf :: ConfigData -> a -> Maybe FilledNDParamsSource
readConfig :: FilePath -> IO StringSource
parseConfig :: String -> Result ConfigDataSource
loadConfig :: FilePath -> IO (Result ConfigData)Source
Wrapper over readConfig
and parseConfig
.
Query functions
computeDiskNodes :: Disk -> Set StringSource
instDiskNodes :: Instance -> Set StringSource
instSecondaryNodes :: Instance -> Set StringSource
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.
getMasterCandidates :: ConfigData -> [Node]Source
Get the list of master candidates.
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.
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 -> 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.
getNetwork :: ConfigData -> String -> ErrorResult NetworkSource
Looks up a network. If looking up by uuid fails, we look up by name.
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.
getInstPrimaryNode :: ConfigData -> String -> ErrorResult NodeSource
Looks up an instance's primary node.
getDrbdDiskNodes :: ConfigData -> Disk -> [Node]Source
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.
getDrbdMinorsForNode :: String -> Disk -> [(Int, String)]Source
rolePrimary :: StringSource
roleSecondary :: StringSource
:: 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.