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.

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

requestTimeout :: Int
 
requestUrl :: String
 
requestPostData :: String
 

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

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

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 VgInfo Source

Constructors

VgInfo 

Fields

vgInfoName :: String
 
vgInfoVgFree :: Maybe Int
 
vgInfoVgSize :: Maybe Int
 

Instances

Eq VgInfo 
Show VgInfo 
JSON VgInfo 

loadVgInfo :: JSValue -> Result VgInfoSource

saveVgInfo :: VgInfo -> JSValueSource

toDictVgInfo :: VgInfo -> [(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

data RpcCallVersion Source

Version Query node version. Note: We can't use THH as it does not know what to do with empty dict

Constructors

RpcCallVersion 

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