Commit c65621d7 authored by Iustin Pop's avatar Iustin Pop
Browse files

Move FileDriver from Objects to Types



Another base type that we need in opcodes as well.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarHelga Velroyen <helgav@google.com>
parent 86b9a385
......@@ -59,8 +59,6 @@ instance Arbitrary Node where
<*> arbitrary <*> arbitrary <*> getFQDN <*> arbitrary
<*> (Set.fromList <$> genTags)
$(genArbitrary ''FileDriver)
$(genArbitrary ''BlockDriver)
$(genArbitrary ''DiskMode)
......
......@@ -56,6 +56,11 @@ instance (Arbitrary a, Ord a, Num a, Show a) =>
(QuickCheck.Positive i) <- arbitrary
Types.mkPositive i
instance (Arbitrary a) => Arbitrary (Types.NonEmpty a) where
arbitrary = do
QuickCheck.NonEmpty lst <- arbitrary
Types.mkNonEmpty lst
$(genArbitrary ''AllocPolicy)
$(genArbitrary ''DiskTemplate)
......@@ -78,10 +83,7 @@ $(genArbitrary ''StorageType)
$(genArbitrary ''NodeEvacMode)
instance (Arbitrary a) => Arbitrary (Types.NonEmpty a) where
arbitrary = do
QuickCheck.NonEmpty lst <- arbitrary
Types.mkNonEmpty lst
$(genArbitrary ''FileDriver)
-- * Properties
......@@ -176,6 +178,10 @@ prop_StorageType_serialisation = testSerialisation
prop_NodeEvacMode_serialisation :: NodeEvacMode -> Property
prop_NodeEvacMode_serialisation = testSerialisation
-- | Test 'FileDriver' serialisation.
prop_FileDriver_serialisation :: FileDriver -> Property
prop_FileDriver_serialisation = testSerialisation
testSuite "Types"
[ 'prop_AllocPolicy_serialisation
, 'prop_DiskTemplate_serialisation
......@@ -195,4 +201,5 @@ testSuite "Types"
, 'prop_OobCommand_serialisation
, 'prop_StorageType_serialisation
, 'prop_NodeEvacMode_serialisation
, 'prop_FileDriver_serialisation
]
......@@ -202,13 +202,6 @@ $(declareSADT "DiskType"
])
$(makeJSONInstance ''DiskType)
-- | The file driver type.
$(declareSADT "FileDriver"
[ ("FileLoop", 'C.fdLoop)
, ("FileBlktap", 'C.fdBlktap)
])
$(makeJSONInstance ''FileDriver)
-- | The persistent block driver type. Currently only one type is allowed.
$(declareSADT "BlockDriver"
[ ("BlockDrvManual", 'C.blockdevDriverManual)
......
......@@ -59,6 +59,7 @@ module Ganeti.Types
, OobCommand(..)
, StorageType(..)
, NodeEvacMode(..)
, FileDriver(..)
) where
import qualified Text.JSON as JSON
......@@ -251,3 +252,10 @@ $(THH.declareSADT "NodeEvacMode"
, ("NEvacAll", 'C.iallocatorNevacAll)
])
$(THH.makeJSONInstance ''NodeEvacMode)
-- | The file driver type.
$(THH.declareSADT "FileDriver"
[ ("FileLoop", 'C.fdLoop)
, ("FileBlktap", 'C.fdBlktap)
])
$(THH.makeJSONInstance ''FileDriver)
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