From 6c332a37450dfdf231ddaa75f1b98e0ceb39a71f Mon Sep 17 00:00:00 2001 From: Klaus Aehlig <aehlig@google.com> Date: Mon, 15 Apr 2013 14:54:23 +0200 Subject: [PATCH] Extend the node description by isMaster 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 | 2 +- src/Ganeti/HTools/Node.hs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Ganeti/HTools/Backend/Rapi.hs b/src/Ganeti/HTools/Backend/Rapi.hs index 4654c8825..4f8f52bb1 100644 --- a/src/Ganeti/HTools/Backend/Rapi.hs +++ b/src/Ganeti/HTools/Backend/Rapi.hs @@ -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) diff --git a/src/Ganeti/HTools/Node.hs b/src/Ganeti/HTools/Node.hs index 42180bf84..83a3dee46 100644 --- a/src/Ganeti/HTools/Node.hs +++ b/src/Ganeti/HTools/Node.hs @@ -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 } -- GitLab