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.

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.

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.

getOptionsForCall :: Rpc a b => FilePath -> FilePath -> a -> [CurlOption]Source

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

Execute multiple RPC calls in parallel

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

Execute an 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

instanceStateFromRaw :: forall m. Monad m => Int -> m InstanceStateSource

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

AllInstancesInfo

InstanceConsoleInfo

data InstanceConsoleInfo Source

Constructors

InstanceConsoleInfo 

Fields

instConsInfoInstance :: String
 
instConsInfoKind :: String
 
instConsInfoMessage :: Maybe String
 
instConsInfoHost :: Maybe String
 
instConsInfoPort :: Maybe Int
 
instConsInfoUser :: Maybe String
 
instConsInfoCommand :: Maybe [String]
 
instConsInfoDisplay :: Maybe String
 

InstanceList

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

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

Job Queue Replication

Watcher Status Update

Queue drain status