diff --git a/htools/Ganeti/HTools/QC.hs b/htools/Ganeti/HTools/QC.hs index fbc2d2f4a496b57f2ac9fc5c67dd6d6137ae6851..47473d3b2dbf286303e0d7b3cc354b8057a9c43c 100644 --- a/htools/Ganeti/HTools/QC.hs +++ b/htools/Ganeti/HTools/QC.hs @@ -1954,6 +1954,7 @@ instance Arbitrary Luxi.LuxiOp where lreq <- arbitrary case lreq of Luxi.ReqQuery -> Luxi.Query <$> arbitrary <*> getFields <*> genFilter + Luxi.ReqQueryFields -> Luxi.QueryFields <$> arbitrary <*> getFields Luxi.ReqQueryNodes -> Luxi.QueryNodes <$> (listOf getFQDN) <*> getFields <*> arbitrary Luxi.ReqQueryGroups -> Luxi.QueryGroups <$> arbitrary <*> diff --git a/htools/Ganeti/Luxi.hs b/htools/Ganeti/Luxi.hs index 77a29b998e05472aa560f34acbf33ba7f6f68a90..c7b771bb61457aba96fb70c52093b3bdf7d34ea5 100644 --- a/htools/Ganeti/Luxi.hs +++ b/htools/Ganeti/Luxi.hs @@ -109,11 +109,15 @@ $(makeJSONInstance ''TagObject) -- | Currently supported Luxi operations and JSON serialization. $(genLuxiOp "LuxiOp" - [(luxiReqQuery, + [ (luxiReqQuery, [ ("what", [t| Qlang.ItemType |]) , ("fields", [t| [String] |]) , ("qfilter", [t| Qlang.Filter |]) ]) + , (luxiReqQueryFields, + [ ("what", [t| Qlang.ItemType |]) + , ("fields", [t| [String] |]) + ]) , (luxiReqQueryNodes, [ ("names", [t| [String] |]) , ("fields", [t| [String] |]) @@ -343,6 +347,12 @@ decodeCall (LuxiCall call args) = ReqQuery -> do (what, fields, qfilter) <- fromJVal args return $ Query what fields qfilter + ReqQueryFields -> do + (what, fields) <- fromJVal args + fields' <- case fields of + JSNull -> return [] + _ -> fromJVal fields + return $ QueryFields what fields' ReqSubmitJob -> do [ops1] <- fromJVal args ops2 <- mapM (fromJResult (luxiReqToRaw call) . J.readJSON) ops1