ganeti-htoolsSource codeContentsIndex
Implementation of the iallocator interface.
type IAllocResult = (String, JSValue, List, List)
parseBaseInstance :: String -> JSRecord -> Result (String, Instance)
parseInstance :: NameAssoc -> String -> JSRecord -> Result (String, Instance)
parseNode :: NameAssoc -> String -> JSRecord -> Result (String, Node)
parseGroup :: String -> JSRecord -> Result (String, Group)
parseData :: String -> Result ([String], Request)
formatResponse :: Bool -> String -> JSValue -> String
describeSolution :: AllocSolution -> String
formatAllocate :: List -> AllocSolution -> Result IAllocResult
formatNodeEvac :: List -> List -> List -> (List, List, EvacSolution) -> Result IAllocResult
processRelocate :: List -> List -> List -> Idx -> Int -> [Ndx] -> Result (List, List, [Ndx])
formatRelocate :: (List, List, [Ndx]) -> Result IAllocResult
processRequest :: Request -> Result IAllocResult
readRequest :: Options -> [String] -> IO Request
runIAllocator :: Request -> (Maybe (List, List), String)
type IAllocResult = (String, JSValue, List, List)Source
Type alias for the result of an IAllocator call.
parseBaseInstance :: String -> JSRecord -> Result (String, Instance)Source

Parse the basic specifications of an instance.

Instances in the cluster instance list and the instance in an Allocate request share some common properties, which are read by this function.

:: NameAssocThe node name-to-index association list
-> StringThe name of the instance
-> JSRecordThe JSON object
-> Result (String, Instance)
Parses an instance as found in the cluster instance list.
:: NameAssocThe group association
-> StringThe node's name
-> JSRecordThe JSON object
-> Result (String, Node)
Parses a node as found in the cluster node list.
:: StringThe group UUID
-> JSRecordThe JSON object
-> Result (String, Group)
Parses a group as found in the cluster group list.
:: StringThe JSON message as received from Ganeti
-> Result ([String], Request)Result tuple

Top-level parser.

The result is a tuple of eventual warning messages and the parsed request; if parsing the input data fails, we'll return a Bad value.

:: BoolWhether the request was successful
-> StringInformation text
-> JSValueThe JSON encoded result
-> StringThe full JSON-formatted message
Formats the result into a valid IAllocator response message.
describeSolution :: AllocSolution -> StringSource
Flatten the log of a solution into a string.
formatAllocate :: List -> AllocSolution -> Result IAllocResultSource
Convert allocation/relocation results into the result format.
formatNodeEvac :: List -> List -> List -> (List, List, EvacSolution) -> Result IAllocResultSource
Convert a node-evacuation/change group result.
:: ListThe group list
-> ListThe node list
-> ListThe instance list
-> IdxThe index of the instance to move
-> IntThe number of nodes required
-> [Ndx]Nodes which should not be used
-> Result (List, List, [Ndx])Solution list

Runs relocate for a single instance.

This is wrapper over the tryNodeEvac function that is run with a single instance (ours), and further it checks that the result it got (in the nodes field) is actually consistent, as tryNodeEvac is designed to output primarily an opcode list, not a node list.

formatRelocate :: (List, List, [Ndx]) -> Result IAllocResultSource
processRequest :: Request -> Result IAllocResultSource
Process a request and return new node lists.
readRequest :: Options -> [String] -> IO RequestSource
Reads the request from the data file(s).
runIAllocator :: Request -> (Maybe (List, List), String)Source
Main iallocator pipeline.
Produced by Haddock version 2.6.0