Extend the node description by isMaster
authorKlaus Aehlig <aehlig@google.com>
Mon, 15 Apr 2013 12:54:23 +0000 (14:54 +0200)
committerKlaus Aehlig <aehlig@google.com>
Fri, 19 Apr 2013 11:53:59 +0000 (13:53 +0200)
Extend the description of the node by the property
of being the master node; also provide and appropriate
setter function. This property will be used, e.g., by
hroller to schedule reboot of the master last.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

src/Ganeti/HTools/Backend/Rapi.hs
src/Ganeti/HTools/Node.hs

index 4654c88..4f8f52b 100644 (file)
@@ -166,7 +166,7 @@ parseNode ktg a = do
               dtotal  <- extract "dtotal"
               dfree   <- extract "dfree"
               ctotal  <- extract "ctotal"
-              return $ Node.create name mtotal mnode mfree
+              return $ Node.create name mtotal mnode mfree 
                      dtotal dfree ctotal False spindles guuid'
   return (name, node)
 
index 42180bf..83a3dee 100644 (file)
@@ -39,6 +39,7 @@ module Ganeti.HTools.Node
   , setFmem
   , setPri
   , setSec
+  , setMaster
   , setMdsk
   , setMcpu
   , setPolicy
@@ -130,6 +131,7 @@ data Node = Node
   , offline  :: Bool      -- ^ Whether the node should not be used for
                           -- allocations and skipped from score
                           -- computations
+  , isMaster :: Bool      -- ^ Whether the node is the master node
   , utilPool :: T.DynUtil -- ^ Total utilisation capacity
   , utilLoad :: T.DynUtil -- ^ Sum of instance utilisation
   , pTags    :: TagMap    -- ^ Primary instance exclusion tags and their count
@@ -235,6 +237,7 @@ create name_init mem_t_init mem_n_init mem_f_init
        , pRem = 0
        , pCpu = 0
        , offline = offline_init
+       , isMaster = False
        , xMem = 0
        , mDsk = T.defReservedDiskRatio
        , loDsk = mDskToloDsk T.defReservedDiskRatio dsk_t_init
@@ -277,6 +280,10 @@ setAlias t s = t { alias = s }
 setOffline :: Node -> Bool -> Node
 setOffline t val = t { offline = val }
 
+-- | Sets the master attribute
+setMaster :: Node -> Bool -> Node
+setMaster t val = t { isMaster = val }
+
 -- | Sets the unnaccounted memory.
 setXmem :: Node -> Int -> Node
 setXmem t val = t { xMem = val }