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 ...@@ -406,6 +406,7 @@ data Disk = Disk
, diskMode :: DiskMode , diskMode :: DiskMode
, diskName :: Maybe String , diskName :: Maybe String
, diskSpindles :: Maybe Int , diskSpindles :: Maybe Int
, diskParams :: Maybe DiskParams
, diskUuid :: String , diskUuid :: String
, diskSerial :: Int , diskSerial :: Int
, diskCtime :: ClockTime , diskCtime :: ClockTime
...@@ -421,6 +422,7 @@ $(buildObjectSerialisation "Disk" $ ...@@ -421,6 +422,7 @@ $(buildObjectSerialisation "Disk" $
, defaultField [| DiskRdWr |] $ simpleField "mode" [t| DiskMode |] , defaultField [| DiskRdWr |] $ simpleField "mode" [t| DiskMode |]
, optionalField $ simpleField "name" [t| String |] , optionalField $ simpleField "name" [t| String |]
, optionalField $ simpleField "spindles" [t| Int |] , optionalField $ simpleField "spindles" [t| Int |]
, optionalField $ simpleField "params" [t| DiskParams |]
] ]
++ uuidFields ++ uuidFields
++ serialFields ++ serialFields
......
...@@ -95,7 +95,7 @@ instance Arbitrary Disk where ...@@ -95,7 +95,7 @@ instance Arbitrary Disk where
arbitrary = Disk <$> arbitrary <*> pure [] <*> arbitrary arbitrary = Disk <$> arbitrary <*> pure [] <*> arbitrary
<*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
<*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
<*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
-- FIXME: we should generate proper values, >=0, etc., but this is -- FIXME: we should generate proper values, >=0, etc., but this is
-- hard for partial ones, where all must be wrapped in a 'Maybe' -- hard for partial ones, where all must be wrapped in a 'Maybe'
...@@ -186,11 +186,13 @@ genDiskWithChildren num_children = do ...@@ -186,11 +186,13 @@ genDiskWithChildren num_children = do
mode <- arbitrary mode <- arbitrary
name <- genMaybe genName name <- genMaybe genName
spindles <- arbitrary spindles <- arbitrary
params <- arbitrary
uuid <- genName uuid <- genName
serial <- arbitrary serial <- arbitrary
time <- arbitrary time <- arbitrary
return $ 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 :: Gen Disk
genDisk = genDiskWithChildren 3 genDisk = genDiskWithChildren 3
...@@ -562,7 +564,8 @@ caseIncludeLogicalIdPlain = ...@@ -562,7 +564,8 @@ caseIncludeLogicalIdPlain =
time = TOD 0 0 time = TOD 0 0
d = d =
Disk (LIDPlain vg_name lv_name) [] "diskname" 1000 DiskRdWr 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 in
HUnit.assertBool "Unable to detect that plain Disk includes logical ID" $ HUnit.assertBool "Unable to detect that plain Disk includes logical ID" $
includesLogicalId vg_name lv_name d includesLogicalId vg_name lv_name d
...@@ -577,10 +580,10 @@ caseIncludeLogicalIdDrbd = ...@@ -577,10 +580,10 @@ caseIncludeLogicalIdDrbd =
Disk Disk
(LIDDrbd8 "node1.example.com" "node2.example.com" 2000 1 5 "secret") (LIDDrbd8 "node1.example.com" "node2.example.com" 2000 1 5 "secret")
[ Disk (LIDPlain "onevg" "onelv") [] "disk1" 1000 DiskRdWr Nothing [ 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 , Disk (LIDPlain vg_name lv_name) [] "disk2" 1000 DiskRdWr Nothing
Nothing "6gd3sd-423f-ag2j-563b-dg34-gj3fse" 0 time time Nothing Nothing "6gd3sd-423f-ag2j-563b-dg34-gj3fse" 0 time time
] "diskname" 1000 DiskRdWr Nothing Nothing ] "diskname" 1000 DiskRdWr Nothing Nothing Nothing
"asdfgr-1234-5123-daf3-sdfw-134f43" 0 time time "asdfgr-1234-5123-daf3-sdfw-134f43" 0 time time
in in
HUnit.assertBool "Unable to detect that plain Disk includes logical ID" $ HUnit.assertBool "Unable to detect that plain Disk includes logical ID" $
...@@ -594,7 +597,8 @@ caseNotIncludeLogicalIdPlain = ...@@ -594,7 +597,8 @@ caseNotIncludeLogicalIdPlain =
time = TOD 0 0 time = TOD 0 0
d = d =
Disk (LIDPlain "othervg" "otherlv") [] "diskname" 1000 DiskRdWr 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 in
HUnit.assertBool "Unable to detect that plain Disk includes logical ID" $ HUnit.assertBool "Unable to detect that plain Disk includes logical ID" $
not (includesLogicalId vg_name lv_name d) 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