From 0ec6344ec9e71ac565421b2c5890869d6b733301 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Sat, 18 Jun 2011 17:32:39 +0200
Subject: [PATCH] htools: add a helper function
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

… that checks if a group is allocable.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 htools/Ganeti/HTools/Group.hs | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/htools/Ganeti/HTools/Group.hs b/htools/Ganeti/HTools/Group.hs
index b8afba82d..82816784a 100644
--- a/htools/Ganeti/HTools/Group.hs
+++ b/htools/Ganeti/HTools/Group.hs
@@ -4,7 +4,7 @@
 
 {-
 
-Copyright (C) 2010 Google Inc.
+Copyright (C) 2010, 2011 Google Inc.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -30,6 +30,7 @@ module Ganeti.HTools.Group
     -- * Constructor
     , create
     , setIdx
+    , isAllocable
     ) where
 
 import qualified Ganeti.HTools.Container as Container
@@ -81,3 +82,7 @@ setIdx t i = t {idx = i}
 -- This is used only during the building of the data structures.
 setName :: Group -> String -> Group
 setName t s = t { name = s }
+
+-- | Checks if a group is allocable.
+isAllocable :: Group -> Bool
+isAllocable = (/= T.AllocUnallocable) . allocPolicy
-- 
GitLab