Commit fa320fef authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Add a function to obtain the master nodes



...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: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarPetr Pudlak <pudlak@google.com>
parent eccf096a
......@@ -34,6 +34,7 @@ module Ganeti.Config
, getDefaultNicLink
, getDefaultHypervisor
, getInstancesIpByLink
, getMasterNodes
, getMasterCandidates
, getMasterOrCandidates
, getMasterNetworkParameters
......@@ -151,6 +152,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 =
......
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