A group is redundant if the evacuation property holds for
all its nodes.

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

diff --git a/src/Ganeti/HTools/GlobalN1.hs b/src/Ganeti/HTools/GlobalN1.hs
index b88769d..b4d078b 100644
--- a/src/Ganeti/HTools/GlobalN1.hs
+++ b/src/Ganeti/HTools/GlobalN1.hs
@@ -35,6 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 module Ganeti.HTools.GlobalN1
   ( canEvacuateNode
   , redundant
+  , redundantGrp
   , allocGlobalN1
   ) where
 
@@ -123,6 +124,11 @@ redundant opts nl il =
                                . Node.group)
        $ filterFun nl
 
+-- | Predicate on wheter a given group is globally N+1 redundant.
+redundantGrp :: AlgorithmOptions -> Node.List -> Instance.List -> Gdx -> Bool
+redundantGrp opts nl il gdx =
+  redundant opts (Container.filter ((==) gdx . Node.group) nl) il
+
 -- | Predicate on wheter an allocation element leads to a globally N+1 
redundant
 -- state.
 allocGlobalN1 :: AlgorithmOptions
-- 
2.6.0.rc0.131.gf624c3d

Reply via email to