LGTM, thanks

On Thu, Mar 27, 2014 at 2:36 PM, Petr Pudlak <[email protected]> wrote:

> The original 'getMasterCandidates' returns only the true candidates,
> without the master itself.
>
> Signed-off-by: Petr Pudlak <[email protected]>
> ---
>  src/Ganeti/Config.hs | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/src/Ganeti/Config.hs b/src/Ganeti/Config.hs
> index 550fbde..7b433d3 100644
> --- a/src/Ganeti/Config.hs
> +++ b/src/Ganeti/Config.hs
> @@ -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
> --
> 1.9.1.423.g4596e3a
>
>


-- 
-- 
Helga Velroyen | Software Engineer | [email protected] |

Google Germany GmbH
Dienerstr. 12
80331 München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores

Reply via email to