On Mon, Dec 23, 2013 at 6:25 PM, Klaus Aehlig <[email protected]> wrote:
> As luxid is also responsible for handling requests to drain the job queue,
> we need the corresponding RPC in Haskell as well.
>
> Signed-off-by: Klaus Aehlig <[email protected]>

LGTM

Thanks,

Guido

> ---
>  src/Ganeti/Rpc.hs | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
>
> diff --git a/src/Ganeti/Rpc.hs b/src/Ganeti/Rpc.hs
> index 17f77d3..19d1576 100644
> --- a/src/Ganeti/Rpc.hs
> +++ b/src/Ganeti/Rpc.hs
> @@ -78,6 +78,7 @@ module Ganeti.Rpc
>
>    , RpcCallJobqueueUpdate(..)
>    , RpcCallSetWatcherPause(..)
> +  , RpcCallSetDrainFlag(..)
>    ) where
>
>  import Control.Arrow (second)
> @@ -628,3 +629,26 @@ instance Rpc RpcCallSetWatcherPause 
> RpcResultSetWatcherPause where
>        _ -> Left $ JsonDecodeError
>             ("Expected JSNull, got " ++ show (pp_value res))
>
> +-- ** Queue drain status
> +
> +-- | Set the queu drain flag
> +
> +$(buildObject "RpcCallSetDrainFlag" "rpcCallSetDrainFlag"
> +  [ simpleField "value" [t| Bool |]
> +  ])
> +
> +instance RpcCall RpcCallSetDrainFlag where
> +  rpcCallName _          = "jobqueue_set_drain_flag"
> +  rpcCallTimeout _       = rpcTimeoutToRaw Fast
> +  rpcCallAcceptOffline _ = False
> +  rpcCallData _ call     = J.encode [ rpcCallSetDrainFlagValue call ]
> +
> +$(buildObject "RpcResultSetDrainFlag" "rpcResultSetDrainFalg" [])
> +
> +instance Rpc RpcCallSetDrainFlag RpcResultSetDrainFlag where
> +  rpcResultFill _ res =
> +    case res of
> +      J.JSNull ->  Right RpcResultSetDrainFlag
> +      _ -> Left $ JsonDecodeError
> +           ("Expected JSNull, got " ++ show (pp_value res))
> +
> --
> 1.8.5.1
>



-- 
Guido Trotter
Ganeti Engineering
Google Germany GmbH
Dienerstr. 12, 80331, München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores
Steuernummer: 48/725/00206
Umsatzsteueridentifikationsnummer: DE813741370

Reply via email to