Revision 22381768

b/htest/Test/Ganeti/Objects.hs
28 28

  
29 29
module Test.Ganeti.Objects
30 30
  ( testObjects
31
  , Hypervisor(..)
32 31
  , Node(..)
33 32
  , genEmptyCluster
34 33
  ) where
......
51 50

  
52 51
-- * Arbitrary instances
53 52

  
54
$(genArbitrary ''Hypervisor)
55

  
56 53
$(genArbitrary ''PartialNDParams)
57 54

  
58 55
instance Arbitrary Node where
b/htest/Test/Ganeti/Types.hs
32 32
  , DiskTemplate(..)
33 33
  , InstanceStatus(..)
34 34
  , NonEmpty(..)
35
  , Hypervisor(..)
35 36
  ) where
36 37

  
37 38
import Data.List (sort)
......
69 70

  
70 71
$(genArbitrary ''CVErrorCode)
71 72

  
73
$(genArbitrary ''Hypervisor)
74

  
72 75
instance (Arbitrary a) => Arbitrary (Types.NonEmpty a) where
73 76
  arbitrary = do
74 77
    QuickCheck.NonEmpty lst <- arbitrary
......
151 154
      all_hs_codes = sort $ map Types.cVErrorCodeToRaw [minBound..maxBound]
152 155
  assertEqual "for CVErrorCode equivalence" all_py_codes all_hs_codes
153 156

  
157
-- | Test 'Hypervisor' serialisation.
158
prop_Hypervisor_serialisation :: Hypervisor -> Property
159
prop_Hypervisor_serialisation = testSerialisation
160

  
154 161
testSuite "Types"
155 162
  [ 'prop_AllocPolicy_serialisation
156 163
  , 'prop_DiskTemplate_serialisation
......
166 173
  , 'prop_DdmSimple_serialisation
167 174
  , 'prop_CVErrorCode_serialisation
168 175
  , 'case_CVErrorCode_pyequiv
176
  , 'prop_Hypervisor_serialisation
169 177
  ]
b/htools/Ganeti/Config.hs
59 59
import Ganeti.Errors
60 60
import Ganeti.JSON
61 61
import Ganeti.Objects
62
import Ganeti.Types
62 63

  
63 64
-- | Type alias for the link and ip map.
64 65
type LinkIpMap = M.Map String (M.Map String String)
b/htools/Ganeti/Objects.hs
50 50
  , FilledBeParams(..)
51 51
  , fillBeParams
52 52
  , allBeParamFields
53
  , Hypervisor(..)
54 53
  , AdminState(..)
55 54
  , adminStateFromRaw
56 55
  , Instance(..)
......
329 328
  , defaultField [| DiskRdWr |] $ simpleField "mode" [t| DiskMode |]
330 329
  ])
331 330

  
332
-- * Hypervisor definitions
333

  
334
-- | This may be due to change when we add hypervisor parameters.
335
$(declareSADT "Hypervisor"
336
  [ ( "Kvm",    'C.htKvm )
337
  , ( "XenPvm", 'C.htXenPvm )
338
  , ( "Chroot", 'C.htChroot )
339
  , ( "XenHvm", 'C.htXenHvm )
340
  , ( "Lxc",    'C.htLxc )
341
  , ( "Fake",   'C.htFake )
342
  ])
343
$(makeJSONInstance ''Hypervisor)
344

  
345 331
-- * Instance definitions
346 332

  
347 333
$(declareSADT "AdminState"
b/htools/Ganeti/Rpc.hs
82 82
import qualified Ganeti.Constants as C
83 83
import Ganeti.Objects
84 84
import Ganeti.THH
85
import Ganeti.Types
85 86
import Ganeti.Compat
86 87

  
87 88
-- * Base RPC functionality and types
b/htools/Ganeti/Types.hs
54 54
  , DdmSimple(..)
55 55
  , CVErrorCode(..)
56 56
  , cVErrorCodeToRaw
57
  , Hypervisor(..)
57 58
  ) where
58 59

  
59 60
import qualified Text.JSON as JSON
......
206 207
     , ("DdmSimpleRemove", 'C.ddmRemove)
207 208
     ])
208 209
$(THH.makeJSONInstance ''DdmSimple)
210

  
211
-- | Hypervisor type definitions.
212
$(THH.declareSADT "Hypervisor"
213
  [ ( "Kvm",    'C.htKvm )
214
  , ( "XenPvm", 'C.htXenPvm )
215
  , ( "Chroot", 'C.htChroot )
216
  , ( "XenHvm", 'C.htXenHvm )
217
  , ( "Lxc",    'C.htLxc )
218
  , ( "Fake",   'C.htFake )
219
  ])
220
$(THH.makeJSONInstance ''Hypervisor)

Also available in: Unified diff