Commit ec629280 authored by René Nussbaumer's avatar René Nussbaumer

htools: Reflect the rename of spindle_usage to spindle_use

Signed-off-by: default avatarRené Nussbaumer <rn@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 34700f5b
......@@ -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.
......
......@@ -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.
......
......@@ -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)
......
......@@ -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
......
......@@ -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 =
......
......@@ -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)
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment