Move StorageType from RPC.hs to Types.hs
authorIustin Pop <iustin@google.com>
Mon, 19 Nov 2012 15:19:18 +0000 (16:19 +0100)
committerIustin Pop <iustin@google.com>
Wed, 21 Nov 2012 13:51:43 +0000 (14:51 +0100)
This fixes a FIXME actually recommending this move :)

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

htest/Test/Ganeti/Types.hs
htools/Ganeti/Rpc.hs
htools/Ganeti/Types.hs

index d3dbd69..23f84a5 100644 (file)
@@ -72,6 +72,8 @@ $(genArbitrary ''CVErrorCode)
 
 $(genArbitrary ''Hypervisor)
 
+$(genArbitrary ''StorageType)
+
 instance (Arbitrary a) => Arbitrary (Types.NonEmpty a) where
   arbitrary = do
     QuickCheck.NonEmpty lst <- arbitrary
@@ -158,6 +160,10 @@ case_CVErrorCode_pyequiv = do
 prop_Hypervisor_serialisation :: Hypervisor -> Property
 prop_Hypervisor_serialisation = testSerialisation
 
+-- | Test 'StorageType' serialisation.
+prop_StorageType_serialisation :: StorageType -> Property
+prop_StorageType_serialisation = testSerialisation
+
 testSuite "Types"
   [ 'prop_AllocPolicy_serialisation
   , 'prop_DiskTemplate_serialisation
@@ -174,4 +180,5 @@ testSuite "Types"
   , 'prop_CVErrorCode_serialisation
   , 'case_CVErrorCode_pyequiv
   , 'prop_Hypervisor_serialisation
+  , 'prop_StorageType_serialisation
   ]
index d20d4c0..9022e5a 100644 (file)
@@ -59,7 +59,6 @@ module Ganeti.Rpc
   , RpcCallVersion(..)
   , RpcResultVersion(..)
 
-  , StorageType(..)
   , StorageField(..)
   , RpcCallStorageList(..)
   , RpcResultStorageList(..)
@@ -410,14 +409,6 @@ instance Rpc RpcCallVersion RpcResultVersion where
 -- ** StorageList
 
 -- | StorageList
--- Get list of storage units.
--- FIXME: This may be moved to Objects
-$(declareSADT "StorageType"
-  [ ( "STLvmPv", 'C.stLvmPv )
-  , ( "STFile",  'C.stFile )
-  , ( "STLvmVg", 'C.stLvmVg )
-  ])
-$(makeJSONInstance ''StorageType)
 
 -- FIXME: This may be moved to Objects
 $(declareSADT "StorageField"
index 7869551..1b47085 100644 (file)
@@ -55,6 +55,7 @@ module Ganeti.Types
   , CVErrorCode(..)
   , cVErrorCodeToRaw
   , Hypervisor(..)
+  , StorageType(..)
   ) where
 
 import qualified Text.JSON as JSON
@@ -218,3 +219,11 @@ $(THH.declareSADT "Hypervisor"
   , ( "Fake",   'C.htFake )
   ])
 $(THH.makeJSONInstance ''Hypervisor)
+
+-- | Storage type.
+$(THH.declareSADT "StorageType"
+  [ ("StorageFile", 'C.stFile)
+  , ("StorageLvmPv", 'C.stLvmPv)
+  , ("StorageLvmVg", 'C.stLvmVg)
+  ])
+$(THH.makeJSONInstance ''StorageType)