Commit de81e4e7 authored by Petr Pudlak's avatar Petr Pudlak

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 ...@@ -61,6 +61,7 @@ module Ganeti.Config
, getNetwork , getNetwork
, MAC , MAC
, getAllMACs , getAllMACs
, getAllDrbdSecrets
, buildLinkIpInstnameMap , buildLinkIpInstnameMap
, instNodes , instNodes
) where ) where
...@@ -379,6 +380,10 @@ collectFromDrbdDisks f = col ...@@ -379,6 +380,10 @@ collectFromDrbdDisks f = col
} = f nA nB port mA mB secret <> F.foldMap col ch } = f nA nB port mA mB secret <> F.foldMap col ch
col d = F.foldMap col (diskChildren d) 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' -- | Returns the DRBD minors of a given 'Disk'
getDrbdMinorsForDisk :: Disk -> [(Int, String)] getDrbdMinorsForDisk :: Disk -> [(Int, String)]
getDrbdMinorsForDisk = getDrbdMinorsForDisk =
...@@ -496,6 +501,11 @@ type MAC = String ...@@ -496,6 +501,11 @@ type MAC = String
getAllMACs :: ConfigData -> [MAC] getAllMACs :: ConfigData -> [MAC]
getAllMACs = F.foldMap (map nicMac . instNics) . configInstances getAllMACs = F.foldMap (map nicMac . instNics) . configInstances
-- ** DRBD secrets
getAllDrbdSecrets :: ConfigData -> [DRBDSecret]
getAllDrbdSecrets = F.foldMap getDrbdSecretsForDisk . configDisks
-- * ND params -- * ND params
-- | Type class denoting objects which have node parameters. -- | 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