diff --git a/htools/Ganeti/HTools/Luxi.hs b/htools/Ganeti/HTools/Luxi.hs index 1374f33113ed50955dbb5099f5b3fd10fa15d1b8..fb1699dd0cd69f322f2459e4c2d4d18d7e468ad2 100644 --- a/htools/Ganeti/HTools/Luxi.hs +++ b/htools/Ganeti/HTools/Luxi.hs @@ -98,17 +98,17 @@ genericConvert otype oname oattr = -- | The input data for node query. queryNodesMsg :: L.LuxiOp queryNodesMsg = - L.Query L.QRNode ["name", "mtotal", "mnode", "mfree", "dtotal", "dfree", - "ctotal", "offline", "drained", "vm_capable", - "ndp/spindle_count", "group.uuid"] Qlang.EmptyFilter + L.Query Qlang.QRNode ["name", "mtotal", "mnode", "mfree", "dtotal", "dfree", + "ctotal", "offline", "drained", "vm_capable", + "ndp/spindle_count", "group.uuid"] Qlang.EmptyFilter -- | The input data for instance query. queryInstancesMsg :: L.LuxiOp queryInstancesMsg = - L.Query L.QRInstance ["name", "disk_usage", "be/memory", "be/vcpus", - "status", "pnode", "snodes", "tags", "oper_ram", - "be/auto_balance", "disk_template", - "be/spindle_use"] Qlang.EmptyFilter + L.Query Qlang.QRInstance ["name", "disk_usage", "be/memory", "be/vcpus", + "status", "pnode", "snodes", "tags", "oper_ram", + "be/auto_balance", "disk_template", + "be/spindle_use"] Qlang.EmptyFilter -- | The input data for cluster query. queryClusterInfoMsg :: L.LuxiOp @@ -117,7 +117,7 @@ queryClusterInfoMsg = L.QueryClusterInfo -- | The input data for node group query. queryGroupsMsg :: L.LuxiOp queryGroupsMsg = - L.Query L.QRGroup ["uuid", "name", "alloc_policy", "ipolicy"] + L.Query Qlang.QRGroup ["uuid", "name", "alloc_policy", "ipolicy"] Qlang.EmptyFilter -- | Wraper over 'callMethod' doing node query. diff --git a/htools/Ganeti/HTools/QC.hs b/htools/Ganeti/HTools/QC.hs index 825bea437fcf7836dda7b91c254593d9321ceb2a..8705ad1640984fcc129c869be7d7347bad2571be 100644 --- a/htools/Ganeti/HTools/QC.hs +++ b/htools/Ganeti/HTools/QC.hs @@ -590,6 +590,9 @@ genFilter' n = do n'' = max n' 2 -- but we don't want empty or 1-element lists, -- so use this for and/or filter list length +instance Arbitrary Qlang.ItemType where + arbitrary = elements [minBound..maxBound] + -- * Actual tests -- ** Utils tests @@ -1847,9 +1850,6 @@ testSuite "JSON" instance Arbitrary Luxi.LuxiReq where arbitrary = elements [minBound..maxBound] -instance Arbitrary Luxi.QrViaLuxi where - arbitrary = elements [minBound..maxBound] - instance Arbitrary Luxi.LuxiOp where arbitrary = do lreq <- arbitrary diff --git a/htools/Ganeti/Luxi.hs b/htools/Ganeti/Luxi.hs index 70c778543e9cbf43289be6c6e28c75706e166885..939302c235e99eb95cd593637a7779d8a96959f9 100644 --- a/htools/Ganeti/Luxi.hs +++ b/htools/Ganeti/Luxi.hs @@ -27,7 +27,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA module Ganeti.Luxi ( LuxiOp(..) - , QrViaLuxi(..) , ResultStatus(..) , LuxiReq(..) , Client @@ -100,20 +99,10 @@ data RecvResult = RecvConnClosed -- ^ Connection closed -- | The Ganeti job type. type JobId = Int -$(declareSADT "QrViaLuxi" - [ ("QRLock", 'qrLock) - , ("QRInstance", 'qrInstance) - , ("QRNode", 'qrNode) - , ("QRGroup", 'qrGroup) - , ("QROs", 'qrOs) - , ("QRJob", 'qrJob) - ]) -$(makeJSONInstance ''QrViaLuxi) - -- | Currently supported Luxi operations and JSON serialization. $(genLuxiOp "LuxiOp" [(luxiReqQuery, - [ ("what", [t| QrViaLuxi |]) + [ ("what", [t| Qlang.ItemType |]) , ("fields", [t| [String] |]) , ("qfilter", [t| Qlang.Filter |]) ]) diff --git a/htools/Ganeti/Qlang.hs b/htools/Ganeti/Qlang.hs index 3a7fde2b24d43f91274c1874e4a389393ec3877b..78bb9fa0c04dbd1052efb0e9754abe274045e05c 100644 --- a/htools/Ganeti/Qlang.hs +++ b/htools/Ganeti/Qlang.hs @@ -34,6 +34,7 @@ module Ganeti.Qlang , QueryFieldsResult(..) , FieldDefinition(..) , ResultEntry(..) + , ItemType(..) ) where import Control.Applicative