On Wed, Jun 17, 2015 at 02:23:41PM +0200, Klaus Aehlig wrote:
On Wed, Jun 17, 2015 at 01:50:02PM +0200, Petr Pudlak wrote:
On Wed, Jun 17, 2015 at 12:43:54PM +0200, 'Klaus Aehlig' via ganeti-devel wrote:
>N+1 redundancy was always a per-group property.
>Do the same with shared-storage N+1 redundancy, i.e.,
>restrict the escape candidates to nodes of the same
>group.
>
>Signed-off-by: Klaus Aehlig <[email protected]>
>---
>src/Ganeti/HTools/GlobalN1.hs | 8 ++++++--
>1 file changed, 6 insertions(+), 2 deletions(-)
>
>diff --git a/src/Ganeti/HTools/GlobalN1.hs b/src/Ganeti/HTools/GlobalN1.hs
>index ced324e..bc746e4 100644
>--- a/src/Ganeti/HTools/GlobalN1.hs
>+++ b/src/Ganeti/HTools/GlobalN1.hs
>@@ -77,6 +77,10 @@ canEvacuateNode (nl, il) n = isOk $ do
>  (nl', il') <- opToResult
>                . foldM move (nl, il) $ map (flip (,) Failover) drbdIdxs
>  -- evacuate other instances
>-  let escapenodes = filter (/= Node.idx n) $ Container.keys nl'
>-  _ <- foldM (evac (Node.group n) escapenodes) (nl',il') sharedIdxs
>+  let grp = Node.group n
>+      escapenodes = filter (/= Node.idx n)
>+                    . map Node.idx
>+                    . filter ((== grp) . Node.group)
>+                    $ Container.elems nl'
>+  _ <- foldM (evac grp escapenodes) (nl',il') sharedIdxs
>  return ()

Just nitpicking - while already changing this part - foldM + return
() could be replaced by foldM_.

ACK. FYI, interdiff.

commit 9552a1c84032cd2ee813bfe187f0254c439654d6
Author: Klaus Aehlig <[email protected]>
Date:   Wed Jun 17 14:21:48 2015 +0200

   Interdiff

diff --git a/src/Ganeti/HTools/GlobalN1.hs b/src/Ganeti/HTools/GlobalN1.hs
index bc746e4..581d22d 100644
--- a/src/Ganeti/HTools/GlobalN1.hs
+++ b/src/Ganeti/HTools/GlobalN1.hs
@@ -36,7 +36,7 @@ module Ganeti.HTools.GlobalN1
  ( canEvacuateNode
  ) where

-import Control.Monad (foldM)
+import Control.Monad (foldM, foldM_)
import Data.List (partition)

import Ganeti.BasicTypes (isOk, Result)
@@ -82,5 +82,4 @@ canEvacuateNode (nl, il) n = isOk $ do
                    . map Node.idx
                    . filter ((== grp) . Node.group)
                    $ Container.elems nl'
-  _ <- foldM (evac grp escapenodes) (nl',il') sharedIdxs
-  return ()
+  foldM_ (evac grp escapenodes) (nl',il') sharedIdxs



In either case LGTM, thanks

LGTM, thanks


--
Klaus Aehlig
Google Germany GmbH, Dienerstr. 12, 80331 Muenchen
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschaeftsfuehrer: Graham Law, Christine Elizabeth Flores

Reply via email to