From 07ea9bf5372d3cac6050f9f4bfbf1e173d9c934b Mon Sep 17 00:00:00 2001
From: Klaus Aehlig <aehlig@google.com>
Date: Thu, 2 May 2013 12:36:29 +0200
Subject: [PATCH] Extend the Node in the htools to allow adding node tags

Since hroller (and probably other tools in the future) will support
node selection based on node tags, extend the node data structure to
allow adding this information.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 src/Ganeti/HTools/Node.hs | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/Ganeti/HTools/Node.hs b/src/Ganeti/HTools/Node.hs
index a55c3f808..a8c1fdb7f 100644
--- a/src/Ganeti/HTools/Node.hs
+++ b/src/Ganeti/HTools/Node.hs
@@ -40,6 +40,7 @@ module Ganeti.HTools.Node
   , setPri
   , setSec
   , setMaster
+  , setNodeTags
   , setMdsk
   , setMcpu
   , setPolicy
@@ -132,6 +133,7 @@ data Node = Node
                           -- allocations and skipped from score
                           -- computations
   , isMaster :: Bool      -- ^ Whether the node is the master node
+  , nTags    :: [String]  -- ^ The node tags for this node
   , utilPool :: T.DynUtil -- ^ Total utilisation capacity
   , utilLoad :: T.DynUtil -- ^ Sum of instance utilisation
   , pTags    :: TagMap    -- ^ Primary instance exclusion tags and their count
@@ -238,6 +240,7 @@ create name_init mem_t_init mem_n_init mem_f_init
        , pCpu = 0
        , offline = offline_init
        , isMaster = False
+       , nTags = []
        , xMem = 0
        , mDsk = T.defReservedDiskRatio
        , loDsk = mDskToloDsk T.defReservedDiskRatio dsk_t_init
@@ -284,6 +287,10 @@ setOffline t val = t { offline = val }
 setMaster :: Node -> Bool -> Node
 setMaster t val = t { isMaster = val }
 
+-- | Sets the node tags attribute
+setNodeTags :: Node -> [String] -> Node
+setNodeTags t val = t { nTags = val }
+
 -- | Sets the unnaccounted memory.
 setXmem :: Node -> Int -> Node
 setXmem t val = t { xMem = val }
-- 
GitLab