diff --git a/htest/Test/Ganeti/Types.hs b/htest/Test/Ganeti/Types.hs index d3dbd699686c3dbcd1624e312bd85d6698743ac3..23f84a55771c3a3c62689ad88609c9dfb4fbf631 100644 --- a/htest/Test/Ganeti/Types.hs +++ b/htest/Test/Ganeti/Types.hs @@ -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 ] diff --git a/htools/Ganeti/Rpc.hs b/htools/Ganeti/Rpc.hs index d20d4c0ca94f1bc19eedb3936efe2a864967002b..9022e5ac4950412eb0649eba20fb8155c6c74818 100644 --- a/htools/Ganeti/Rpc.hs +++ b/htools/Ganeti/Rpc.hs @@ -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" diff --git a/htools/Ganeti/Types.hs b/htools/Ganeti/Types.hs index 7869551088d7cfb6f3cf7f3d7f3db6a51abde2de..1b47085069f02d14cc0a519a6297246f82b42c03 100644 --- a/htools/Ganeti/Types.hs +++ b/htools/Ganeti/Types.hs @@ -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)