Add luxiReqQueryNetworks to LuxiOp
authorKlaus Aehlig <aehlig@google.com>
Thu, 11 Jul 2013 08:33:50 +0000 (10:33 +0200)
committerKlaus Aehlig <aehlig@google.com>
Fri, 12 Jul 2013 13:42:42 +0000 (15:42 +0200)
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 <aehlig@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

lib/luxi.py
src/Ganeti/Luxi.hs
src/Ganeti/Query/Server.hs
test/hs/Test/Ganeti/Luxi.hs

index a84085d..0de9185 100644 (file)
@@ -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,
index 9e5b337..84030da 100644 (file)
@@ -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
index 66cf255..46e70cc 100644 (file)
@@ -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")
index a206dc0..c3097ed 100644 (file)
@@ -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