Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Ganeti.Config
Description
Implementation of the Ganeti configuration database.
Synopsis
- type LinkIpMap = Map String (Map String String)
- class NdParamObject a where
- getNdParamsOf :: ConfigData -> a -> Maybe FilledNDParams
- loadConfig :: FilePath -> IO (Result ConfigData)
- saveConfig :: Handle -> ConfigData -> IO ()
- getNodeInstances :: ConfigData -> String -> ([Instance], [Instance])
- getNodeRole :: ConfigData -> Node -> NodeRole
- getNodeNdParams :: ConfigData -> Node -> Maybe FilledNDParams
- getDefaultNicLink :: ConfigData -> String
- getDefaultHypervisor :: ConfigData -> Hypervisor
- getInstancesIpByLink :: LinkIpMap -> String -> [String]
- getMasterNodes :: ConfigData -> [Node]
- getMasterCandidates :: ConfigData -> [Node]
- getMasterOrCandidates :: ConfigData -> [Node]
- getMasterNetworkParameters :: ConfigData -> MasterNetworkParameters
- getOnlineNodes :: ConfigData -> [Node]
- getNode :: ConfigData -> String -> ErrorResult Node
- getInstance :: ConfigData -> String -> ErrorResult Instance
- getDisk :: ConfigData -> String -> ErrorResult Disk
- getFilterRule :: ConfigData -> String -> ErrorResult FilterRule
- getGroup :: ConfigData -> String -> ErrorResult NodeGroup
- getGroupNdParams :: ConfigData -> NodeGroup -> FilledNDParams
- getGroupIpolicy :: ConfigData -> NodeGroup -> FilledIPolicy
- getGroupDiskParams :: ConfigData -> NodeGroup -> GroupDiskParams
- getGroupNodes :: ConfigData -> String -> [Node]
- getGroupInstances :: ConfigData -> String -> ([Instance], [Instance])
- getGroupOfNode :: ConfigData -> Node -> Maybe NodeGroup
- getInstPrimaryNode :: ConfigData -> String -> ErrorResult Node
- getInstMinorsForNode :: ConfigData -> String -> Instance -> [(String, Int, String, String, String, String)]
- getInstAllNodes :: ConfigData -> String -> ErrorResult [Node]
- getInstDisks :: ConfigData -> String -> ErrorResult [Disk]
- getInstDisksFromObj :: ConfigData -> Instance -> ErrorResult [Disk]
- getDrbdMinorsForDisk :: Disk -> [(Int, String)]
- getDrbdMinorsForInstance :: ConfigData -> Instance -> ErrorResult [(Int, String)]
- getFilledInstHvParams :: [String] -> ConfigData -> Instance -> HvParams
- getFilledInstBeParams :: ConfigData -> Instance -> ErrorResult FilledBeParams
- getFilledInstOsParams :: ConfigData -> Instance -> OsParams
- getNetwork :: ConfigData -> String -> ErrorResult Network
- type MAC = String
- getAllMACs :: ConfigData -> [MAC]
- getAllDrbdSecrets :: ConfigData -> [DRBDSecret]
- type NodeLVsMap = MultiMap String LogicalVolume
- getInstanceLVsByNode :: ConfigData -> Instance -> ErrorResult NodeLVsMap
- getAllLVs :: ConfigData -> ErrorResult (Set LogicalVolume)
- buildLinkIpInstnameMap :: ConfigData -> LinkIpMap
- instNodes :: ConfigData -> Instance -> Set String
Documentation
class NdParamObject a where #
Type class denoting objects which have node parameters.
Methods
getNdParamsOf :: ConfigData -> a -> Maybe FilledNDParams #
Instances
NdParamObject Cluster # | |
Defined in Ganeti.Config Methods getNdParamsOf :: ConfigData -> Cluster -> Maybe FilledNDParams # | |
NdParamObject Node # | |
Defined in Ganeti.Config Methods getNdParamsOf :: ConfigData -> Node -> Maybe FilledNDParams # | |
NdParamObject NodeGroup # | |
Defined in Ganeti.Config Methods getNdParamsOf :: ConfigData -> NodeGroup -> Maybe FilledNDParams # |
loadConfig :: FilePath -> IO (Result ConfigData) #
Wrapper over readConfig
and parseConfig
.
saveConfig :: Handle -> ConfigData -> IO () #
Wrapper over hPutStr
and encodeConfig
.
getNodeInstances :: ConfigData -> String -> ([Instance], [Instance]) #
Get instances of a given node. The node is specified through its UUID. The secondary calculation is expensive and frequently called, so optimise this to allocate fewer temporary values
getNodeRole :: ConfigData -> Node -> NodeRole #
Computes the role of a node.
getNodeNdParams :: ConfigData -> Node -> Maybe FilledNDParams #
Returns a node's ndparams, filled.
getDefaultNicLink :: ConfigData -> String #
Returns the default cluster link.
getDefaultHypervisor :: ConfigData -> Hypervisor #
Returns the default cluster hypervisor.
getInstancesIpByLink :: LinkIpMap -> String -> [String] #
Returns instances of a given link.
getMasterNodes :: ConfigData -> [Node] #
Get the list of the master nodes (usually one).
getMasterCandidates :: ConfigData -> [Node] #
Get the list of master candidates, not including the master itself.
getMasterOrCandidates :: ConfigData -> [Node] #
Get the list of master candidates, including the master.
getMasterNetworkParameters :: ConfigData -> MasterNetworkParameters #
Get the network parameters for the master IP address.
getOnlineNodes :: ConfigData -> [Node] #
Get the list of online nodes.
getNode :: ConfigData -> String -> ErrorResult Node #
Looks up a node by name or uuid.
getInstance :: ConfigData -> String -> ErrorResult Instance #
Looks up an instance by name or uuid.
getDisk :: ConfigData -> String -> ErrorResult Disk #
Looks up a disk by uuid.
getFilterRule :: ConfigData -> String -> ErrorResult FilterRule #
Looks up a filter by uuid.
getGroup :: ConfigData -> String -> ErrorResult NodeGroup #
Looks up a node group by name or uuid.
getGroupNdParams :: ConfigData -> NodeGroup -> FilledNDParams #
Computes a node group's node params.
getGroupIpolicy :: ConfigData -> NodeGroup -> FilledIPolicy #
Computes a node group's ipolicy.
getGroupDiskParams :: ConfigData -> NodeGroup -> GroupDiskParams #
Computes a group's (merged) disk params.
getGroupNodes :: ConfigData -> String -> [Node] #
Get nodes of a given node group.
getGroupInstances :: ConfigData -> String -> ([Instance], [Instance]) #
Get (primary, secondary) instances of a given node group.
getGroupOfNode :: ConfigData -> Node -> Maybe NodeGroup #
Returns a node's group, with optional failure if we can't find it (configuration corrupt).
getInstPrimaryNode :: ConfigData -> String -> ErrorResult Node #
Looks up an instance's primary node.
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.
getInstAllNodes :: ConfigData -> String -> ErrorResult [Node] #
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] #
Get disks for a given instance. The instance is specified by name or uuid.
getInstDisksFromObj :: ConfigData -> Instance -> ErrorResult [Disk] #
Get disks for a given instance object.
getDrbdMinorsForDisk :: Disk -> [(Int, String)] #
Returns the DRBD minors of a given Disk
getDrbdMinorsForInstance :: ConfigData -> Instance -> ErrorResult [(Int, String)] #
Returns the DRBD minors of a given instance
getFilledInstHvParams :: [String] -> ConfigData -> Instance -> HvParams #
Retrieves the instance hypervisor params, missing values filled with cluster defaults.
getFilledInstBeParams :: ConfigData -> Instance -> ErrorResult FilledBeParams #
Retrieves the instance backend params, missing values filled with cluster defaults.
getFilledInstOsParams :: ConfigData -> Instance -> OsParams #
Retrieves the instance os params, missing values filled with cluster defaults. This does NOT include private and secret parameters.
getNetwork :: ConfigData -> String -> ErrorResult Network #
Looks up a network. If looking up by uuid fails, we look up by name.
getAllMACs :: ConfigData -> [MAC] #
Returns all MAC addresses used in the cluster.
getAllDrbdSecrets :: ConfigData -> [DRBDSecret] #
type NodeLVsMap = MultiMap String LogicalVolume #
A map from node UUIDs to
FIXME: After adding designated types for UUIDs,
use them to replace String
here.
getAllLVs :: ConfigData -> ErrorResult (Set LogicalVolume) #
buildLinkIpInstnameMap :: ConfigData -> LinkIpMap #
Builds link -> ip -> instname map. For instances without a name, we insert the uuid instead.
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.
instNodes :: ConfigData -> Instance -> Set String #
Computes all nodes of an instance.