commit 2238176806afd69a0d24db069f0bce0a838e0a20
Author: Iustin Pop <iustin@google.com>
Date:   Mon Nov 19 10:46:50 2012 +0100

    Move the 'Hypervisor' type from Objects to Types
    
    This is a very basic type and 'Objects' is a heavy-weight module. By
    moving it to 'types' we simplify (in the future) the import chains.
    
    Signed-off-by: Iustin Pop <iustin@google.com>
    Reviewed-by: Adeodato Simo <dato@google.com>

diff --git a/htest/Test/Ganeti/Objects.hs b/htest/Test/Ganeti/Objects.hs
index de21d0c..aa4e16a 100644
--- a/htest/Test/Ganeti/Objects.hs
+++ b/htest/Test/Ganeti/Objects.hs
@@ -28,7 +28,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 
 module Test.Ganeti.Objects
   ( testObjects
-  , Hypervisor(..)
   , Node(..)
   , genEmptyCluster
   ) where
@@ -51,8 +50,6 @@ import Ganeti.JSON
 
 -- * Arbitrary instances
 
-$(genArbitrary ''Hypervisor)
-
 $(genArbitrary ''PartialNDParams)
 
 instance Arbitrary Node where
diff --git a/htest/Test/Ganeti/Types.hs b/htest/Test/Ganeti/Types.hs
index f0ba40a..d3dbd69 100644
--- a/htest/Test/Ganeti/Types.hs
+++ b/htest/Test/Ganeti/Types.hs
@@ -32,6 +32,7 @@ module Test.Ganeti.Types
   , DiskTemplate(..)
   , InstanceStatus(..)
   , NonEmpty(..)
+  , Hypervisor(..)
   ) where
 
 import Data.List (sort)
@@ -69,6 +70,8 @@ $(genArbitrary ''DdmSimple)
 
 $(genArbitrary ''CVErrorCode)
 
+$(genArbitrary ''Hypervisor)
+
 instance (Arbitrary a) => Arbitrary (Types.NonEmpty a) where
   arbitrary = do
     QuickCheck.NonEmpty lst <- arbitrary
@@ -151,6 +154,10 @@ case_CVErrorCode_pyequiv = do
       all_hs_codes = sort $ map Types.cVErrorCodeToRaw [minBound..maxBound]
   assertEqual "for CVErrorCode equivalence" all_py_codes all_hs_codes
 
+-- | Test 'Hypervisor' serialisation.
+prop_Hypervisor_serialisation :: Hypervisor -> Property
+prop_Hypervisor_serialisation = testSerialisation
+
 testSuite "Types"
   [ 'prop_AllocPolicy_serialisation
   , 'prop_DiskTemplate_serialisation
@@ -166,4 +173,5 @@ testSuite "Types"
   , 'prop_DdmSimple_serialisation
   , 'prop_CVErrorCode_serialisation
   , 'case_CVErrorCode_pyequiv
+  , 'prop_Hypervisor_serialisation
   ]
diff --git a/htools/Ganeti/Config.hs b/htools/Ganeti/Config.hs
index c2c6929..2561cb0 100644
--- a/htools/Ganeti/Config.hs
+++ b/htools/Ganeti/Config.hs
@@ -59,6 +59,7 @@ import qualified Ganeti.Constants as C
 import Ganeti.Errors
 import Ganeti.JSON
 import Ganeti.Objects
+import Ganeti.Types
 
 -- | Type alias for the link and ip map.
 type LinkIpMap = M.Map String (M.Map String String)
diff --git a/htools/Ganeti/Objects.hs b/htools/Ganeti/Objects.hs
index 021f9ed..1b98db3 100644
--- a/htools/Ganeti/Objects.hs
+++ b/htools/Ganeti/Objects.hs
@@ -50,7 +50,6 @@ module Ganeti.Objects
   , FilledBeParams(..)
   , fillBeParams
   , allBeParamFields
-  , Hypervisor(..)
   , AdminState(..)
   , adminStateFromRaw
   , Instance(..)
@@ -329,19 +328,6 @@ $(buildObjectSerialisation "Disk"
   , defaultField [| DiskRdWr |] $ simpleField "mode" [t| DiskMode |]
   ])
 
--- * Hypervisor definitions
-
--- | This may be due to change when we add hypervisor parameters.
-$(declareSADT "Hypervisor"
-  [ ( "Kvm",    'C.htKvm )
-  , ( "XenPvm", 'C.htXenPvm )
-  , ( "Chroot", 'C.htChroot )
-  , ( "XenHvm", 'C.htXenHvm )
-  , ( "Lxc",    'C.htLxc )
-  , ( "Fake",   'C.htFake )
-  ])
-$(makeJSONInstance ''Hypervisor)
-
 -- * Instance definitions
 
 $(declareSADT "AdminState"
diff --git a/htools/Ganeti/Rpc.hs b/htools/Ganeti/Rpc.hs
index f328b0e..d20d4c0 100644
--- a/htools/Ganeti/Rpc.hs
+++ b/htools/Ganeti/Rpc.hs
@@ -82,6 +82,7 @@ import qualified Ganeti.Path as P
 import qualified Ganeti.Constants as C
 import Ganeti.Objects
 import Ganeti.THH
+import Ganeti.Types
 import Ganeti.Compat
 
 -- * Base RPC functionality and types
diff --git a/htools/Ganeti/Types.hs b/htools/Ganeti/Types.hs
index 99eceae..7869551 100644
--- a/htools/Ganeti/Types.hs
+++ b/htools/Ganeti/Types.hs
@@ -54,6 +54,7 @@ module Ganeti.Types
   , DdmSimple(..)
   , CVErrorCode(..)
   , cVErrorCodeToRaw
+  , Hypervisor(..)
   ) where
 
 import qualified Text.JSON as JSON
@@ -206,3 +207,14 @@ $(THH.declareSADT "DdmSimple"
      , ("DdmSimpleRemove", 'C.ddmRemove)
      ])
 $(THH.makeJSONInstance ''DdmSimple)
+
+-- | Hypervisor type definitions.
+$(THH.declareSADT "Hypervisor"
+  [ ( "Kvm",    'C.htKvm )
+  , ( "XenPvm", 'C.htXenPvm )
+  , ( "Chroot", 'C.htChroot )
+  , ( "XenHvm", 'C.htXenHvm )
+  , ( "Lxc",    'C.htLxc )
+  , ( "Fake",   'C.htFake )
+  ])
+$(THH.makeJSONInstance ''Hypervisor)
