ganeti-htoolsSource codeContentsIndex
Helper functions
Serialisation functions
Parsing functions

Parsing data from text-files.

This module holds the code for loading the cluster state from text files, as produced by gnt-node and gnt-instance list command.

commaSplit :: String -> [String]
serializeGroup :: Group -> String
serializeGroups :: List -> String
serializeNode :: List -> Node -> String
serializeNodes :: List -> List -> String
serializeInstance :: List -> Instance -> String
serializeInstances :: List -> List -> String
serializeISpec :: ISpec -> String
serializeDiskTemplates :: [DiskTemplate] -> String
serializeIPolicy :: String -> IPolicy -> String
serializeAllIPolicies :: IPolicy -> List -> String
serializeCluster :: ClusterData -> String
loadGroup :: Monad m => [String] -> m (String, Group)
loadNode :: Monad m => NameAssoc -> [String] -> m (String, Node)
loadInst :: NameAssoc -> [String] -> Result (String, Instance)
loadISpec :: String -> [String] -> Result ISpec
loadIPolicy :: [String] -> Result (String, IPolicy)
loadOnePolicy :: (IPolicy, List) -> String -> Result (IPolicy, List)
loadAllIPolicies :: List -> [String] -> Result (IPolicy, List)
loadTabular :: (Monad m, Element a) => [String] -> ([String] -> m (String, a)) -> m (NameAssoc, Container a)
readData :: String -> IO String
parseData :: String -> Result ClusterData
loadData :: String -> IO (Result ClusterData)
Helper functions
commaSplit :: String -> [String]Source
Simple wrapper over sepSplit
Serialisation functions
serializeGroup :: Group -> StringSource
Serialize a single group.
serializeGroups :: List -> StringSource
Generate group file data from a group list.
:: ListThe list of groups (needed for group uuid)
-> NodeThe node to be serialised
-> String
Serialize a single node.
serializeNodes :: List -> List -> StringSource
Generate node file data from node objects.
:: ListThe node list (needed for node names)
-> InstanceThe instance to be serialised
-> String
Serialize a single instance.
serializeInstances :: List -> List -> StringSource
Generate instance file data from instance objects.
serializeISpec :: ISpec -> StringSource
Generate a spec data from a given ISpec object.
serializeDiskTemplates :: [DiskTemplate] -> StringSource
Generate disk template data.
serializeIPolicy :: String -> IPolicy -> StringSource
Generate policy data from a given policy object.
serializeAllIPolicies :: IPolicy -> List -> StringSource
Generates the entire ipolicy section from the cluster and group objects.
serializeCluster :: ClusterData -> StringSource
Generate complete cluster data from node and instance lists.
Parsing functions
:: Monad m
=> [String]The result, a tuple of group UUID and group object
-> m (String, Group)
Load a group from a field list.
:: Monad m
=> NameAssocInput data as a list of fields
-> [String]The result, a tuple o node name and node object
-> m (String, Node)
Load a node from a field list.
:: NameAssocAssociation list with the current nodes
-> [String]Input data as a list of fields
-> Result (String, Instance)A tuple of instance name and the instance object
Load an instance from a field list.
loadISpec :: String -> [String] -> Result ISpecSource
Loads a spec from a field list.
loadIPolicy :: [String] -> Result (String, IPolicy)Source
Loads an ipolicy from a field list.
loadOnePolicy :: (IPolicy, List) -> String -> Result (IPolicy, List)Source
loadAllIPolicies :: List -> [String] -> Result (IPolicy, List)Source
Loads all policies from the policy section
:: (Monad m, Element a)
=> [String]Conversion function
-> [String] -> m (String, a)A tuple of an association list (name to object) and a set as used in Ganeti.HTools.Container
-> m (NameAssoc, Container a)

Convert newline and delimiter-separated text.

This function converts a text in tabular format as generated by gnt-instance list and gnt-node list to a list of objects using a supplied conversion function.

:: StringPath to the text file
-> IO StringContents of the file

Load the cluser data from disk.

This is an alias to readFile just for consistency with the other modules.

:: StringText data
-> Result ClusterData
Builds the cluster data from text input.
:: StringPath to the text file
-> IO (Result ClusterData)
Top level function for data loading.
Produced by Haddock version 2.6.0