On Thu, Jul 11, 2013 at 2:11 PM, Klaus Aehlig <[email protected]> wrote:

> When the QueryNetwork was introduced as a method, apparently
> it was forgotten in the Haskell world. Add it here as well.
>
> Signed-off-by: Klaus Aehlig <[email protected]>
> ---
>  lib/luxi.py                 | 1 +
>  src/Ganeti/Luxi.hs          | 8 ++++++++
>  src/Ganeti/Query/Server.hs  | 4 ++++
>  test/hs/Test/Ganeti/Luxi.hs | 2 ++
>  4 files changed, 15 insertions(+)
>
> diff --git a/lib/luxi.py b/lib/luxi.py
> index a84085d..0de9185 100644
> --- a/lib/luxi.py
> +++ b/lib/luxi.py
> @@ -86,6 +86,7 @@ REQ_ALL = compat.UniqueFrozenset([
>    REQ_QUERY_INSTANCES,
>    REQ_QUERY_JOBS,
>    REQ_QUERY_NODES,
> +  REQ_QUERY_NETWORKS,
>    REQ_QUERY_TAGS,
>    REQ_SET_DRAIN_FLAG,
>    REQ_SET_WATCHER_PAUSE,
> diff --git a/src/Ganeti/Luxi.hs b/src/Ganeti/Luxi.hs
> index 9e5b337..84030da 100644
> --- a/src/Ganeti/Luxi.hs
> +++ b/src/Ganeti/Luxi.hs
> @@ -119,6 +119,11 @@ $(genLuxiOp "LuxiOp"
>       , simpleField "fields" [t| [String] |]
>       , simpleField "lock"   [t| Bool     |]
>       ])
> +  , (luxiReqQueryNetworks,
> +     [ simpleField "names"  [t| [String] |]
> +     , simpleField "fields" [t| [String] |]
> +     , simpleField "lock"   [t| Bool     |]
> +     ])
>    , (luxiReqQueryInstances,
>       [ simpleField "names"  [t| [String] |]
>       , simpleField "fields" [t| [String] |]
> @@ -341,6 +346,9 @@ decodeCall (LuxiCall call args) =
>                return $ QueryGroups names fields locking
>      ReqQueryClusterInfo ->
>                return QueryClusterInfo
> +    ReqQueryNetworks -> do
> +              (names, fields, locking) <- fromJVal args
> +              return $ QueryNetworks names fields locking
>      ReqQuery -> do
>                (what, fields, qfilter) <- fromJVal args
>                return $ Query what fields qfilter
> diff --git a/src/Ganeti/Query/Server.hs b/src/Ganeti/Query/Server.hs
> index 49e79cd..6f6cdee 100644
> --- a/src/Ganeti/Query/Server.hs
> +++ b/src/Ganeti/Query/Server.hs
> @@ -173,6 +173,10 @@ handleCall cfg (QueryJobs names fields) =
>    handleClassicQuery cfg (Qlang.ItemTypeLuxi Qlang.QRJob)
>      (map (Right . fromIntegral . fromJobId) names)  fields False
>
> +handleCall cfg (QueryNetworks names fields lock) =
> +  handleClassicQuery cfg (Qlang.ItemTypeOpCode Qlang.QRNetwork)
> +    (map Left names) fields lock
> +
>  handleCall _ op =
>    return . Bad $
>      GenericError ("Luxi call '" ++ strOfOp op ++ "' not implemented")
> diff --git a/test/hs/Test/Ganeti/Luxi.hs b/test/hs/Test/Ganeti/Luxi.hs
> index a206dc0..c3097ed 100644
> --- a/test/hs/Test/Ganeti/Luxi.hs
> +++ b/test/hs/Test/Ganeti/Luxi.hs
> @@ -64,6 +64,8 @@ instance Arbitrary Luxi.LuxiOp where
>                              genFields <*> arbitrary
>        Luxi.ReqQueryGroups -> Luxi.QueryGroups <$> arbitrary <*>
>                               arbitrary <*> arbitrary
> +      Luxi.ReqQueryNetworks -> Luxi.QueryNetworks <$> arbitrary <*>
> +                             arbitrary <*> arbitrary
>        Luxi.ReqQueryInstances -> Luxi.QueryInstances <$> listOf genFQDN <*>
>                                  genFields <*> arbitrary
>        Luxi.ReqQueryJobs -> Luxi.QueryJobs <$> arbitrary <*> genFields
> --
> 1.8.3
>
>

LGTM, thanks

Reply via email to