ganeti
Safe HaskellNone

Ganeti.Query.Server

Description

Implementation of the Ganeti Query2 server.

Synopsis

Documentation

makeLuxidClientId :: JQStatus -> IO ClientId Source #

Creates a ClientId that identifies the current luxi (process, thread).

This means that this ClientId will be different for each request handled by luxid.

withLockedWconfdConfig :: (MonadBase IO m, MonadError GanetiException m) => ClientId -> (ConfigData -> RpcClientMonad a) -> m a Source #

Creates a connection to WConfd and locks the config, allowing to run some WConfd RPC commands given the locked config.

This is needed when luxid wants to change the config.

Example:

cid <- makeLuxidClientId ...
withLockedWconfdConfig cid $ \lockedCfg -> do
  -- some (IO) action that needs to be run inside having the lock
  writeConfig cid (updateConfig lockedCfg)

handleQuery Source #

Arguments

:: [ItemType -> FilterField]

Fields to put into the query

-> ConfigData

Cluster config

-> ItemType

Query type

-> [Either String Integer]

Requested names (empty means all)

-> [String]

Requested fields

-> Bool

Whether to do sync queries or not

-> IO (GenericResult GanetiException JSValue) 

Helper for classic queries.

handleClassicQuery Source #

Arguments

:: ConfigData

Cluster config

-> ItemType

Query type

-> [Either String Integer]

Requested names (empty means all)

-> [String]

Requested fields

-> Bool

Whether to do sync queries or not

-> IO (GenericResult GanetiException JSValue) 

Helper for classic queries. Queries name and uuid fields.

handleUuidQuery Source #

Arguments

:: ConfigData

Cluster config

-> ItemType

Query type

-> [Either String Integer]

Requested names (empty means all)

-> [String]

Requested fields

-> Bool

Whether to do sync queries or not

-> IO (GenericResult GanetiException JSValue) 

Like handleClassicQuery, but filters only by UUID.

handleCallWrapper :: Lock -> JQStatus -> Result ConfigData -> LuxiOp -> IO (ErrorResult JSValue) Source #

Minimal wrapper to handle the missing config case.

handleCall :: Lock -> JQStatus -> ConfigData -> LuxiOp -> IO (ErrorResult JSValue) Source #

Actual luxi operation handler.

handleWaitForJobChangeStatus :: JobId -> JSValue -> JSValue -> Int -> IO (ErrorResult JSValue) Source #

Special-case handler for WaitForJobChange RPC call for fields == ["status"] that doesn't require the use of ConfigData

waitForJobChange :: JobId -> JSValue -> Int -> IO (JSValue, JSValue) -> IO (ErrorResult JSValue) Source #

Common WaitForJobChange functionality shared between handleCall and handleWaitForJobChangeStatus

computeJobUpdate :: ConfigData -> JobId -> [String] -> JSValue -> IO (JSValue, JSValue) Source #

Query the status of a job and return the requested fields and the logs newer than the given log number.

computeJobUpdateStatus :: JobId -> JSValue -> IO (JSValue, JSValue) Source #

A version of computeJobUpdate hardcoded to only return logs and the status field. By hardcoding this we avoid using the luxi Query infrastructure and the ConfigData value it requires.

type PrepResult = (Server, IORef (Result ConfigData), JQStatus) Source #

Type alias for prepMain results

activateMasterIP :: IO (Result ()) Source #

Activate the master IP address.

checkMain :: CheckFn () Source #

Check function for luxid.

prepMain :: PrepFn () PrepResult Source #

Prepare function for luxid.

main :: MainFn () PrepResult Source #

Main function.