Safe Haskell | None |
---|
Implementation of the Ganeti Ssconf interface.
Synopsis
- maxFileSize :: Int
- sSFilePrefix :: FilePath
- data SSKey
- = SSClusterName
- | SSClusterTags
- | SSEnabledUserShutdown
- | SSFileStorageDir
- | SSGlusterStorageDir
- | SSHvparamsChroot
- | SSHvparamsFake
- | SSHvparamsKvm
- | SSHvparamsLxc
- | SSHvparamsXenHvm
- | SSHvparamsXenPvm
- | SSHypervisorList
- | SSInstanceList
- | SSMaintainNodeHealth
- | SSMasterCandidates
- | SSMasterCandidatesCerts
- | SSMasterCandidatesIps
- | SSMasterIp
- | SSMasterNetdev
- | SSMasterNetmask
- | SSMasterNode
- | SSNetworks
- | SSNodeList
- | SSNodePrimaryIps
- | SSNodeSecondaryIps
- | SSNodeVmCapable
- | SSNodegroups
- | SSOfflineNodes
- | SSOnlineNodes
- | SSPrimaryIpFamily
- | SSReleaseVersion
- | SSSharedFileStorageDir
- | SSSshPorts
- | SSUidPool
- sSKeyFromRaw :: forall m. (Monad m, MonadFail m) => String -> m SSKey
- sSKeyToRaw :: SSKey -> String
- hvparamsSSKey :: Hypervisor -> SSKey
- keyToFilename :: FilePath -> SSKey -> FilePath
- catchIOErrors :: Maybe a -> IO a -> IO (Result a)
- readSSConfFile :: Maybe FilePath -> Maybe String -> SSKey -> IO (Result String)
- parseKeyValue :: MonadFail m => String -> String -> m (String, String)
- parseIPFamily :: Int -> Result Family
- getPrimaryIPFamily :: Maybe FilePath -> IO (Result Family)
- parseNodesVmCapable :: String -> Result [(String, Bool)]
- getNodesVmCapable :: Maybe FilePath -> IO (Result [(String, Bool)])
- getMasterCandidatesIps :: Maybe FilePath -> IO (Result [String])
- getMasterNode :: Maybe FilePath -> IO (Result String)
- parseHypervisorList :: String -> Result [Hypervisor]
- getHypervisorList :: Maybe FilePath -> IO (Result [Hypervisor])
- parseEnabledUserShutdown :: String -> Result Bool
- getEnabledUserShutdown :: Maybe FilePath -> IO (Result Bool)
- newtype SSConf = SSConf {}
- emptySSConf :: SSConf
Reading individual ssconf entries
maxFileSize :: Int Source #
Maximum ssconf file size we support.
sSFilePrefix :: FilePath Source #
ssconf file prefix, re-exported from Constants.
Instances
Bounded SSKey # | |
Defined in Ganeti.Ssconf | |
Enum SSKey # | |
Eq SSKey # | |
Ord SSKey # | |
Show SSKey # | |
HasStringRepr SSKey # | |
Defined in Ganeti.Ssconf fromStringRepr :: MonadFail m => String -> m SSKey Source # toStringRepr :: SSKey -> String Source # | |
Arbitrary SSKey | |
sSKeyFromRaw :: forall m. (Monad m, MonadFail m) => String -> m SSKey Source #
sSKeyToRaw :: SSKey -> String Source #
hvparamsSSKey :: Hypervisor -> SSKey Source #
For a given hypervisor get the corresponding SSConf key that contains its parameters.
The corresponding SSKeys are generated automatically by TH, but since we don't have convenient infrastructure for generating this function, it's just manual. All constructors must be given explicitly so that adding another hypervisor will trigger "incomplete pattern" warning and force the corresponding addition.
:: FilePath | Config path root |
-> SSKey | Ssconf key |
-> FilePath | Full file name |
Convert a ssconf key into a (full) file path.
:: Maybe a | Optional default |
-> IO a | Action to run |
-> IO (Result a) |
Runs an IO action while transforming any error into Bad
values. It also accepts an optional value to use in case the error
is just does not exist.
:: Maybe FilePath | Optional config path override |
-> Maybe String | Optional default value |
-> SSKey | Desired ssconf key |
-> IO (Result String) |
Read an ssconf file.
parseKeyValue :: MonadFail m => String -> String -> m (String, String) Source #
Parses a key-value pair of the form "key=value" from str
, fails
with desc
otherwise.
parseIPFamily :: Int -> Result Family Source #
Parses a string containing an IP family
getPrimaryIPFamily :: Maybe FilePath -> IO (Result Family) Source #
Read the primary IP family.
parseNodesVmCapable :: String -> Result [(String, Bool)] Source #
Parse the nodes vm capable value from a String
.
getNodesVmCapable :: Maybe FilePath -> IO (Result [(String, Bool)]) Source #
Read and parse the nodes vm capable.
getMasterCandidatesIps :: Maybe FilePath -> IO (Result [String]) Source #
Read the list of IP addresses of the master candidates of the cluster.
getMasterNode :: Maybe FilePath -> IO (Result String) Source #
Read the name of the master node.
parseHypervisorList :: String -> Result [Hypervisor] Source #
Parse the list of enabled hypervisors from a String
.
getHypervisorList :: Maybe FilePath -> IO (Result [Hypervisor]) Source #
Read and parse the list of enabled hypervisors.
parseEnabledUserShutdown :: String -> Result Bool Source #
Parse whether user shutdown is enabled from a String
.
getEnabledUserShutdown :: Maybe FilePath -> IO (Result Bool) Source #
Read and parse whether user shutdown is enabled.
Working with the whole ssconf map
The data type used for representing the ssconf.
emptySSConf :: SSConf Source #