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

A function for listing all DRBD secrets in a cluster



This will be needed to properly generate and reserve new secrets.
Signed-off-by: default avatarPetr Pudlak <pudlak@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent cbbc551b
......@@ -61,6 +61,7 @@ module Ganeti.Config
, getNetwork
, MAC
, getAllMACs
, getAllDrbdSecrets
, buildLinkIpInstnameMap
, instNodes
) where
......@@ -379,6 +380,10 @@ collectFromDrbdDisks f = col
} = f nA nB port mA mB secret <> F.foldMap col ch
col d = F.foldMap col (diskChildren d)
-- | Returns the DRBD secrets of a given 'Disk'
getDrbdSecretsForDisk :: Disk -> [DRBDSecret]
getDrbdSecretsForDisk = collectFromDrbdDisks (\_ _ _ _ _ secret -> [secret])
-- | Returns the DRBD minors of a given 'Disk'
getDrbdMinorsForDisk :: Disk -> [(Int, String)]
getDrbdMinorsForDisk =
......@@ -496,6 +501,11 @@ type MAC = String
getAllMACs :: ConfigData -> [MAC]
getAllMACs = F.foldMap (map nicMac . instNics) . configInstances
-- ** DRBD secrets
getAllDrbdSecrets :: ConfigData -> [DRBDSecret]
getAllDrbdSecrets = F.foldMap getDrbdSecretsForDisk . configDisks
-- * ND params
-- | Type class denoting objects which have node parameters.
......
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