ganeti

Safe HaskellNone

Ganeti.Rpc

Contents

Description

Implementation of the RPC client.

Synopsis

Base RPC functionality and types

curlOpts :: [CurlOption]Source

data RpcError Source

Data type for RPC error reporting.

Constructors

CurlLayerError String 
JsonDecodeError String 
RpcResultError String 
OfflineNodeError 

Instances

Eq RpcError 
Show RpcError 

explainRpcError :: RpcError -> StringSource

Provide explanation to RPC errors.

data RpcTimeout Source

Constructors

Urgent 
Fast 
Normal 
Slow 
FourHours 
OneDay 

Instances

Bounded RpcTimeout 
Enum RpcTimeout 
Eq RpcTimeout 
Ord RpcTimeout 
Show RpcTimeout 

rpcTimeoutFromRaw :: forall m. Monad m => Int -> m RpcTimeoutSource

class JSON a => RpcCall a whereSource

A generic class for RPC calls.

Methods

rpcCallName :: a -> StringSource

Give the (Python) name of the procedure.

rpcCallTimeout :: a -> IntSource

Calculate the timeout value for the call execution.

rpcCallData :: Node -> a -> StringSource

Prepare arguments of the call to be send as POST.

rpcCallAcceptOffline :: a -> BoolSource

Whether we accept offline nodes when making a call.

class (RpcCall a, JSON b) => Rpc a b | a -> b, b -> a whereSource

Generic class that ensures matching RPC call with its respective result.

Methods

rpcResultFill :: a -> JSValue -> ERpcError bSource

Create a result based on the received HTTP response.

data HttpClientRequest Source

Constructors

HttpClientRequest 

Fields

requestUrl :: String
 
requestData :: String
 
requestOpts :: [CurlOption]
 

isIpV6 :: String -> BoolSource

prepareUrl :: RpcCall a => Node -> a -> StringSource

parseHttpReply :: Rpc a b => a -> ERpcError (CurlCode, String) -> ERpcError bSource

parseHttpResponse :: Rpc a b => a -> String -> ERpcError bSource

logRpcErrors :: [(a, ERpcError b)] -> IO ()Source

Scan the list of results produced by executeRpcCall and log all the RPC errors.

executeRpcCall :: Rpc a b => [Node] -> a -> IO [(Node, ERpcError b)]Source

Execute RPC call for many nodes in parallel.

sanitizeDictResults :: [(String, Result a)] -> ERpcError [(String, a)]Source

fromJResultToRes :: Result a -> (a -> b) -> ERpcError bSource

fromJSValueToRes :: JSON a => JSValue -> (a -> b) -> ERpcError bSource

RPC calls and results

Instance info

data InstanceInfo Source

Constructors

InstanceInfo 

Fields

instInfoMemory :: Int
 
instInfoState :: String
 
instInfoVcpus :: Int
 
instInfoTime :: Int
 

Instances

toDictInstanceInfo :: InstanceInfo -> [(String, JSValue)]Source

AllInstancesInfo

InstanceList

data RpcCallInstanceList Source

InstanceList Returns the list of running instances on the given nodes.

NodeInfo

data StorageInfo Source

Constructors

StorageInfo 

Fields

storageInfoName :: String
 
storageInfoType :: String
 
storageInfoStorageFree :: Maybe Int
 
storageInfoStorageSize :: Maybe Int
 

Instances

loadStorageInfo :: JSValue -> Result StorageInfoSource

toDictStorageInfo :: StorageInfo -> [(String, JSValue)]Source

data HvInfo Source

We only provide common fields as described in hv_base.py.

Constructors

HvInfo 

Instances

Eq HvInfo 
Show HvInfo 
JSON HvInfo 

loadHvInfo :: JSValue -> Result HvInfoSource

saveHvInfo :: HvInfo -> JSValueSource

toDictHvInfo :: HvInfo -> [(String, JSValue)]Source

Version

toDictRpcCallVersion :: RpcCallVersion -> [(String, JSValue)]Source

StorageList

data StorageField Source

StorageList

Instances

storageFieldFromRaw :: forall m. Monad m => String -> m StorageFieldSource

TestDelay

data RpcResultTestDelay Source

Result definition for test delay.

Constructors

RpcResultTestDelay 

Instances

Show RpcResultTestDelay 
JSON RpcResultTestDelay

Custom JSON instance for null result.

Rpc RpcCallTestDelay RpcResultTestDelay 

ExportList