Commit 7315a346 authored by Petr Pudlak's avatar Petr Pudlak
Browse files

Add a function to return all MCs including the master



The original 'getMasterCandidates' returns only the true candidates,
without the master itself.
Signed-off-by: default avatarPetr Pudlak <pudlak@google.com>
Reviewed-by: default avatarHelga Velroyen <helgav@google.com>
parent 3858d13a
......@@ -35,6 +35,7 @@ module Ganeti.Config
, getDefaultHypervisor
, getInstancesIpByLink
, getMasterCandidates
, getMasterOrCandidates
, getOnlineNodes
, getNode
, getInstance
......@@ -142,11 +143,17 @@ getNodeRole cfg node
| nodeOffline node = NROffline
| otherwise = NRRegular
-- | Get the list of master candidates.
-- | Get the list of master candidates, /not including/ the master itself.
getMasterCandidates :: ConfigData -> [Node]
getMasterCandidates cfg =
filter ((==) NRCandidate . getNodeRole cfg) . F.toList . configNodes $ cfg
-- | Get the list of master candidates, /including/ the master.
getMasterOrCandidates :: ConfigData -> [Node]
getMasterOrCandidates cfg =
let isMC r = (r == NRCandidate) || (r == NRMaster)
in filter (isMC . getNodeRole cfg) . F.toList . configNodes $ cfg
-- | Get the list of online nodes.
getOnlineNodes :: ConfigData -> [Node]
getOnlineNodes = filter (not . nodeOffline) . F.toList . configNodes
......
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