...and not only the name of the master node. The result is
reported as a list of nodes, which is not only convenient
to deal with inconsistent cluster data, it also can be
used for RPCs directly in this form.

Signed-off-by: Klaus Aehlig <[email protected]>
---
 src/Ganeti/Config.hs | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/Ganeti/Config.hs b/src/Ganeti/Config.hs
index 71283c4..ab0711c 100644
--- a/src/Ganeti/Config.hs
+++ b/src/Ganeti/Config.hs
@@ -34,6 +34,7 @@ module Ganeti.Config
     , getDefaultNicLink
     , getDefaultHypervisor
     , getInstancesIpByLink
+    , getMasterNodes
     , getMasterCandidates
     , getMasterOrCandidates
     , getMasterNetworkParameters
@@ -150,6 +151,11 @@ getNodeRole cfg node
   | nodeOffline node = NROffline
   | otherwise = NRRegular
 
+-- | Get the list of the master nodes (usually one).
+getMasterNodes :: ConfigData -> [Node]
+getMasterNodes cfg =
+  filter ((==) NRMaster . getNodeRole cfg) . F.toList . configNodes $ cfg
+
 -- | Get the list of master candidates, /not including/ the master itself.
 getMasterCandidates :: ConfigData -> [Node]
 getMasterCandidates cfg = 
-- 
1.9.1.423.g4596e3a

Reply via email to