Revision 8a9ee1e9

b/htools/Ganeti/HTools/Luxi.hs
98 98
-- | The input data for node query.
99 99
queryNodesMsg :: L.LuxiOp
100 100
queryNodesMsg =
101
  L.Query L.QRNode ["name", "mtotal", "mnode", "mfree", "dtotal", "dfree",
102
                    "ctotal", "offline", "drained", "vm_capable",
103
                    "ndp/spindle_count", "group.uuid"] Qlang.EmptyFilter
101
  L.Query Qlang.QRNode ["name", "mtotal", "mnode", "mfree", "dtotal", "dfree",
102
                        "ctotal", "offline", "drained", "vm_capable",
103
                        "ndp/spindle_count", "group.uuid"] Qlang.EmptyFilter
104 104

  
105 105
-- | The input data for instance query.
106 106
queryInstancesMsg :: L.LuxiOp
107 107
queryInstancesMsg =
108
  L.Query L.QRInstance ["name", "disk_usage", "be/memory", "be/vcpus",
109
                        "status", "pnode", "snodes", "tags", "oper_ram",
110
                        "be/auto_balance", "disk_template",
111
                        "be/spindle_use"] Qlang.EmptyFilter
108
  L.Query Qlang.QRInstance ["name", "disk_usage", "be/memory", "be/vcpus",
109
                            "status", "pnode", "snodes", "tags", "oper_ram",
110
                            "be/auto_balance", "disk_template",
111
                            "be/spindle_use"] Qlang.EmptyFilter
112 112

  
113 113
-- | The input data for cluster query.
114 114
queryClusterInfoMsg :: L.LuxiOp
......
117 117
-- | The input data for node group query.
118 118
queryGroupsMsg :: L.LuxiOp
119 119
queryGroupsMsg =
120
  L.Query L.QRGroup ["uuid", "name", "alloc_policy", "ipolicy"]
120
  L.Query Qlang.QRGroup ["uuid", "name", "alloc_policy", "ipolicy"]
121 121
   Qlang.EmptyFilter
122 122

  
123 123
-- | Wraper over 'callMethod' doing node query.
b/htools/Ganeti/HTools/QC.hs
590 590
        n'' = max n' 2 -- but we don't want empty or 1-element lists,
591 591
                       -- so use this for and/or filter list length
592 592

  
593
instance Arbitrary Qlang.ItemType where
594
  arbitrary = elements [minBound..maxBound]
595

  
593 596
-- * Actual tests
594 597

  
595 598
-- ** Utils tests
......
1847 1850
instance Arbitrary Luxi.LuxiReq where
1848 1851
  arbitrary = elements [minBound..maxBound]
1849 1852

  
1850
instance Arbitrary Luxi.QrViaLuxi where
1851
  arbitrary = elements [minBound..maxBound]
1852

  
1853 1853
instance Arbitrary Luxi.LuxiOp where
1854 1854
  arbitrary = do
1855 1855
    lreq <- arbitrary
b/htools/Ganeti/Luxi.hs
27 27

  
28 28
module Ganeti.Luxi
29 29
  ( LuxiOp(..)
30
  , QrViaLuxi(..)
31 30
  , ResultStatus(..)
32 31
  , LuxiReq(..)
33 32
  , Client
......
100 99
-- | The Ganeti job type.
101 100
type JobId = Int
102 101

  
103
$(declareSADT "QrViaLuxi"
104
  [ ("QRLock",     'qrLock)
105
  , ("QRInstance", 'qrInstance)
106
  , ("QRNode",     'qrNode)
107
  , ("QRGroup",    'qrGroup)
108
  , ("QROs",       'qrOs)
109
  , ("QRJob",      'qrJob)
110
  ])
111
$(makeJSONInstance ''QrViaLuxi)
112

  
113 102
-- | Currently supported Luxi operations and JSON serialization.
114 103
$(genLuxiOp "LuxiOp"
115 104
  [(luxiReqQuery,
116
    [ ("what",    [t| QrViaLuxi |])
105
    [ ("what",    [t| Qlang.ItemType |])
117 106
    , ("fields",  [t| [String]  |])
118 107
    , ("qfilter", [t| Qlang.Filter |])
119 108
    ])
b/htools/Ganeti/Qlang.hs
34 34
    , QueryFieldsResult(..)
35 35
    , FieldDefinition(..)
36 36
    , ResultEntry(..)
37
    , ItemType(..)
37 38
    ) where
38 39

  
39 40
import Control.Applicative

Also available in: Unified diff