Commit 48755fac authored by Iustin Pop's avatar Iustin Pop
Browse files

Move StorageType from RPC.hs to Types.hs



This fixes a FIXME actually recommending this move :)
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 1283cc38
......@@ -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
]
......@@ -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"
......
......@@ -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)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment