Commit a90c41e2 authored by Petr Pudlak's avatar Petr Pudlak
Browse files

A function for listing the DRBD minors of an instance



This includes nested disk children.
Signed-off-by: default avatarPetr Pudlak <pudlak@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent aa5dc63a
......@@ -52,6 +52,7 @@ module Ganeti.Config
, getInstAllNodes
, getInstDisks
, getInstDisksFromObj
, getDrbdMinorsForInstance
, getFilledInstHvParams
, getFilledInstBeParams
, getFilledInstOsParams
......@@ -357,6 +358,14 @@ getInstDisksFromObj :: ConfigData -> Instance -> ErrorResult [Disk]
getInstDisksFromObj cfg =
getInstDisks cfg . instUuid
-- | Returns the DRBD minors of a given 'Disk'
getDrbdMinorsForDisk :: Disk -> [(Int, String)]
getDrbdMinorsForDisk Disk { diskLogicalId = (LIDDrbd8 nA nB _ mnA mnB _)
, diskChildren = ch
} = [(mnA, nA), (mnB, nB)] ++
concatMap getDrbdMinorsForDisk ch
getDrbdMinorsForDisk d = concatMap getDrbdMinorsForDisk (diskChildren d)
-- | Filters DRBD minors for a given node.
getDrbdMinorsForNode :: String -> Disk -> [(Int, String)]
getDrbdMinorsForNode node disk =
......@@ -369,6 +378,12 @@ getDrbdMinorsForNode node disk =
_ -> []
in this_minors ++ child_minors
-- | Returns the DRBD minors of a given instance
getDrbdMinorsForInstance :: ConfigData -> Instance
-> ErrorResult [(Int, String)]
getDrbdMinorsForInstance cfg =
liftM (concatMap getDrbdMinorsForDisk) . getInstDisksFromObj cfg
-- | String for primary role.
rolePrimary :: String
rolePrimary = "primary"
......
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