Commit 4393e075 authored by Agata Murawska's avatar Agata Murawska
Browse files

Conversion from RPC error to query status



Simple conversion for queries that use live fields gathered from
RPC calls.
Signed-off-by: default avatarAgata Murawska <agatamurawska@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 77cab679
......@@ -29,6 +29,7 @@ module Ganeti.Query.Common
, rsMaybe
, rsUnknown
, missingRuntime
, rpcErrorToStatus
, timeStampFields
, uuidFields
, serialFields
......@@ -45,6 +46,7 @@ import Text.JSON (JSON, showJSON)
import qualified Ganeti.Constants as C
import Ganeti.Config
import Ganeti.Objects
import Ganeti.Rpc
import Ganeti.Query.Language
import Ganeti.Query.Types
......@@ -84,6 +86,13 @@ rsUnknown = ResultEntry RSUnknown Nothing
missingRuntime :: FieldGetter a b
missingRuntime = FieldRuntime (\_ _ -> ResultEntry RSNoData Nothing)
-- * Error conversion
-- | Convert RpcError to ResultStatus
rpcErrorToStatus :: RpcError -> ResultStatus
rpcErrorToStatus (OfflineNodeError _) = RSOffline
rpcErrorToStatus _ = RSNoData
-- * Common fields
-- | The list of timestamp fields.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment