This will be needed to properly generate and reserve new secrets.
Signed-off-by: Petr Pudlak <[email protected]>
---
src/Ganeti/Config.hs | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/Ganeti/Config.hs b/src/Ganeti/Config.hs
index 5245fe8..368e40d 100644
--- a/src/Ganeti/Config.hs
+++ b/src/Ganeti/Config.hs
@@ -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.
--
1.9.1.423.g4596e3a