From ec629280ad3bb2b26d632754a12af8aeaf0bec2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Nussbaumer?= <rn@google.com> Date: Thu, 15 Mar 2012 14:58:30 +0100 Subject: [PATCH] htools: Reflect the rename of spindle_usage to spindle_use MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RenΓ© Nussbaumer <rn@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- htools/Ganeti/HTools/IAlloc.hs | 2 +- htools/Ganeti/HTools/Instance.hs | 4 ++-- htools/Ganeti/HTools/Luxi.hs | 4 ++-- htools/Ganeti/HTools/Node.hs | 10 +++++----- htools/Ganeti/HTools/QC.hs | 2 +- htools/Ganeti/HTools/Rapi.hs | 2 +- htools/Ganeti/HTools/Text.hs | 6 +++--- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/htools/Ganeti/HTools/IAlloc.hs b/htools/Ganeti/HTools/IAlloc.hs index ae349054e..7a9e01180 100644 --- a/htools/Ganeti/HTools/IAlloc.hs +++ b/htools/Ganeti/HTools/IAlloc.hs @@ -70,7 +70,7 @@ parseBaseInstance n a = do vcpus <- extract "vcpus" tags <- extract "tags" dt <- extract "disk_template" - su <- extract "spindle_usage" + su <- extract "spindle_use" return (n, Instance.create n mem disk vcpus Running tags True 0 0 dt su) -- | Parses an instance as found in the cluster instance list. diff --git a/htools/Ganeti/HTools/Instance.hs b/htools/Ganeti/HTools/Instance.hs index 42871b393..76465cee4 100644 --- a/htools/Ganeti/HTools/Instance.hs +++ b/htools/Ganeti/HTools/Instance.hs @@ -80,7 +80,7 @@ data Instance = Instance , autoBalance :: Bool -- ^ Is the instance auto-balanced? , tags :: [String] -- ^ List of instance tags , diskTemplate :: T.DiskTemplate -- ^ The disk template of the instance - , spindleUsage :: Int -- ^ The numbers of used spindles + , spindleUse :: Int -- ^ The numbers of used spindles } deriving (Show, Read, Eq) instance T.Element Instance where @@ -177,7 +177,7 @@ create name_init mem_init dsk_init vcpus_init run_init tags_init , movable = supportsMoves dt , autoBalance = auto_balance_init , diskTemplate = dt - , spindleUsage = su + , spindleUse = su } -- | Changes the index. diff --git a/htools/Ganeti/HTools/Luxi.hs b/htools/Ganeti/HTools/Luxi.hs index cbe8fdb2f..44d90b894 100644 --- a/htools/Ganeti/HTools/Luxi.hs +++ b/htools/Ganeti/HTools/Luxi.hs @@ -107,7 +107,7 @@ queryInstancesMsg = L.Query L.QRInstance ["name", "disk_usage", "be/memory", "be/vcpus", "status", "pnode", "snodes", "tags", "oper_ram", "be/auto_balance", "disk_template", - "be/spindle_usage"] () + "be/spindle_use"] () -- | The input data for cluster query. queryClusterInfoMsg :: L.LuxiOp @@ -163,7 +163,7 @@ parseInstance ktn [ name, disk, mem, vcpus xtags <- convert "tags" tags xauto_balance <- convert "auto_balance" auto_balance xdt <- convert "disk_template" disk_template - xsu <- convert "be/spindle_usage" su + xsu <- convert "be/spindle_use" su let inst = Instance.create xname xmem xdisk xvcpus xrunning xtags xauto_balance xpnode snode xdt xsu return (xname, inst) diff --git a/htools/Ganeti/HTools/Node.hs b/htools/Ganeti/HTools/Node.hs index cb61ee056..f744e58e5 100644 --- a/htools/Ganeti/HTools/Node.hs +++ b/htools/Ganeti/HTools/Node.hs @@ -316,9 +316,9 @@ buildPeers t il = in t {peers=pmap, failN1 = new_failN1, rMem = new_rmem, pRem = new_prem} -- | Calculate the new spindle usage -calcSpindleUsage :: Node -> Instance.Instance -> Double -calcSpindleUsage n i = incIf (Instance.usesLocalStorage i) (instSpindles n) - (fromIntegral $ Instance.spindleUsage i) +calcSpindleUse :: Node -> Instance.Instance -> Double +calcSpindleUse n i = incIf (Instance.usesLocalStorage i) (instSpindles n) + (fromIntegral $ Instance.spindleUse i) -- | Assigns an instance to a node as primary and update the used VCPU -- count, utilisation data and tags map. @@ -328,7 +328,7 @@ setPri t inst = t { pList = Instance.idx inst:pList t , pCpu = fromIntegral new_count / tCpu t , utilLoad = utilLoad t `T.addUtil` Instance.util inst , pTags = addTags (pTags t) (Instance.tags inst) - , instSpindles = calcSpindleUsage t inst + , instSpindles = calcSpindleUse t inst } where new_count = Instance.applyIfOnline inst (+ Instance.vcpus inst) (uCpu t ) @@ -338,7 +338,7 @@ setSec :: Node -> Instance.Instance -> Node setSec t inst = t { sList = Instance.idx inst:sList t , utilLoad = old_load { T.dskWeight = T.dskWeight old_load + T.dskWeight (Instance.util inst) } - , instSpindles = calcSpindleUsage t inst + , instSpindles = calcSpindleUse t inst } where old_load = utilLoad t diff --git a/htools/Ganeti/HTools/QC.hs b/htools/Ganeti/HTools/QC.hs index 35225def5..cc0c072a6 100644 --- a/htools/Ganeti/HTools/QC.hs +++ b/htools/Ganeti/HTools/QC.hs @@ -796,7 +796,7 @@ prop_Text_Load_Instance name mem dsk vcpus status then Node.noSecondary else sdx) && Instance.autoBalance i == autobal && - Instance.spindleUsage i == su && + Instance.spindleUse i == su && Types.isBad fail1 prop_Text_Load_InstanceFail ktn fields = diff --git a/htools/Ganeti/HTools/Rapi.hs b/htools/Ganeti/HTools/Rapi.hs index e4952bb91..a754d0894 100644 --- a/htools/Ganeti/HTools/Rapi.hs +++ b/htools/Ganeti/HTools/Rapi.hs @@ -123,7 +123,7 @@ parseInstance ktn a = do tags <- extract "tags" a auto_balance <- extract "auto_balance" beparams dt <- extract "disk_template" a - su <- extract "spindle_usage" beparams + su <- extract "spindle_use" beparams let inst = Instance.create name mem disk vcpus running tags auto_balance pnode snode dt su return (name, inst) diff --git a/htools/Ganeti/HTools/Text.hs b/htools/Ganeti/HTools/Text.hs index b4971ebdc..3b4bece07 100644 --- a/htools/Ganeti/HTools/Text.hs +++ b/htools/Ganeti/HTools/Text.hs @@ -107,7 +107,7 @@ serializeInstance nl inst = (Instance.vcpus inst) (instanceStatusToRaw (Instance.runSt inst)) (if Instance.autoBalance inst then "Y" else "N") pnode snode (diskTemplateToRaw (Instance.diskTemplate inst)) - (intercalate "," (Instance.tags inst)) (Instance.spindleUsage inst) + (intercalate "," (Instance.tags inst)) (Instance.spindleUse inst) -- | Generate instance file data from instance objects. serializeInstances :: Node.List -> Instance.List -> String @@ -223,12 +223,12 @@ loadInst ktn [ name, mem, dsk, vcpus, status, auto_bal, pnode, snode "' for instance " ++ name disk_template <- annotateResult ("Instance " ++ name) (diskTemplateFromRaw dt) - spindle_usage <- tryRead name su + spindle_use <- tryRead name su when (sidx == pidx) $ fail $ "Instance " ++ name ++ " has same primary and secondary node - " ++ pnode let vtags = commaSplit tags newinst = Instance.create name vmem vdsk vvcpus vstatus vtags - auto_balance pidx sidx disk_template spindle_usage + auto_balance pidx sidx disk_template spindle_use return (name, newinst) loadInst ktn [ name, mem, dsk, vcpus, status, auto_bal, pnode, snode -- GitLab