Commit 46049766 authored by Ilias Tsitsimpis's avatar Ilias Tsitsimpis Committed by Klaus Aehlig
Browse files

Add DiskParams to Disk object



The 'DiskParams' slot was missing from Haskell's Disk objects.
Since Wconfd is now responsible for writting the config file this was
causing the 'params' slot to not be written in the config file.
Signed-off-by: default avatarIlias Tsitsimpis <iliastsi@grnet.gr>
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent d4c58d99
......@@ -406,6 +406,7 @@ data Disk = Disk
, diskMode :: DiskMode
, diskName :: Maybe String
, diskSpindles :: Maybe Int
, diskParams :: Maybe DiskParams
, diskUuid :: String
, diskSerial :: Int
, diskCtime :: ClockTime
......@@ -421,6 +422,7 @@ $(buildObjectSerialisation "Disk" $
, defaultField [| DiskRdWr |] $ simpleField "mode" [t| DiskMode |]
, optionalField $ simpleField "name" [t| String |]
, optionalField $ simpleField "spindles" [t| Int |]
, optionalField $ simpleField "params" [t| DiskParams |]
]
++ uuidFields
++ serialFields
......
......@@ -95,7 +95,7 @@ instance Arbitrary Disk where
arbitrary = Disk <$> arbitrary <*> pure [] <*> arbitrary
<*> arbitrary <*> arbitrary <*> arbitrary
<*> arbitrary <*> arbitrary <*> arbitrary
<*> arbitrary <*> arbitrary
<*> arbitrary <*> arbitrary <*> arbitrary
-- FIXME: we should generate proper values, >=0, etc., but this is
-- hard for partial ones, where all must be wrapped in a 'Maybe'
......@@ -186,11 +186,13 @@ genDiskWithChildren num_children = do
mode <- arbitrary
name <- genMaybe genName
spindles <- arbitrary
params <- arbitrary
uuid <- genName
serial <- arbitrary
time <- arbitrary
return $
Disk logicalid children ivname size mode name spindles uuid serial time time
Disk logicalid children ivname size mode name
spindles params uuid serial time time
genDisk :: Gen Disk
genDisk = genDiskWithChildren 3
......@@ -562,7 +564,8 @@ caseIncludeLogicalIdPlain =
time = TOD 0 0
d =
Disk (LIDPlain vg_name lv_name) [] "diskname" 1000 DiskRdWr
Nothing Nothing "asdfgr-1234-5123-daf3-sdfw-134f43" 0 time time
Nothing Nothing Nothing "asdfgr-1234-5123-daf3-sdfw-134f43"
0 time time
in
HUnit.assertBool "Unable to detect that plain Disk includes logical ID" $
includesLogicalId vg_name lv_name d
......@@ -577,10 +580,10 @@ caseIncludeLogicalIdDrbd =
Disk
(LIDDrbd8 "node1.example.com" "node2.example.com" 2000 1 5 "secret")
[ Disk (LIDPlain "onevg" "onelv") [] "disk1" 1000 DiskRdWr Nothing
Nothing "145145-asdf-sdf2-2134-asfd-534g2x" 0 time time
Nothing Nothing "145145-asdf-sdf2-2134-asfd-534g2x" 0 time time
, Disk (LIDPlain vg_name lv_name) [] "disk2" 1000 DiskRdWr Nothing
Nothing "6gd3sd-423f-ag2j-563b-dg34-gj3fse" 0 time time
] "diskname" 1000 DiskRdWr Nothing Nothing
Nothing Nothing "6gd3sd-423f-ag2j-563b-dg34-gj3fse" 0 time time
] "diskname" 1000 DiskRdWr Nothing Nothing Nothing
"asdfgr-1234-5123-daf3-sdfw-134f43" 0 time time
in
HUnit.assertBool "Unable to detect that plain Disk includes logical ID" $
......@@ -594,7 +597,8 @@ caseNotIncludeLogicalIdPlain =
time = TOD 0 0
d =
Disk (LIDPlain "othervg" "otherlv") [] "diskname" 1000 DiskRdWr
Nothing Nothing "asdfgr-1234-5123-daf3-sdfw-134f43" 0 time time
Nothing Nothing Nothing "asdfgr-1234-5123-daf3-sdfw-134f43"
0 time time
in
HUnit.assertBool "Unable to detect that plain Disk includes logical ID" $
not (includesLogicalId vg_name lv_name d)
......
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