Commit 0e09422b authored by Iustin Pop's avatar Iustin Pop
Browse files

htools: rename Instance.auto_balance



… to autoBalance, per the recommended style.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 34c5a24a
......@@ -1028,7 +1028,7 @@ printInsts nl il =
in if sdx == Node.noSecondary
then ""
else Container.nameOf nl sdx
, if Instance.auto_balance inst then "Y" else "N"
, if Instance.autoBalance inst then "Y" else "N"
, printf "%3d" $ Instance.vcpus inst
, printf "%5d" $ Instance.mem inst
, printf "%5d" $ Instance.dsk inst `div` 1024
......
......@@ -63,7 +63,7 @@ data Instance = Instance
, idx :: T.Idx -- ^ Internal index
, util :: T.DynUtil -- ^ Dynamic resource usage
, movable :: Bool -- ^ Can the instance be moved?
, auto_balance :: Bool -- ^ Is the instance auto-balanced?
, autoBalance :: Bool -- ^ Is the instance auto-balanced?
, tags :: [String] -- ^ List of instance tags
} deriving (Show, Read)
......@@ -107,7 +107,7 @@ create name_init mem_init dsk_init vcpus_init run_init tags_init
, util = T.baseUtil
, tags = tags_init
, movable = True
, auto_balance = auto_balance_init
, autoBalance = auto_balance_init
}
-- | Changes the index.
......
......@@ -266,7 +266,7 @@ buildPeers :: Node -> Instance.List -> Node
buildPeers t il =
let mdata = map
(\i_idx -> let inst = Container.find i_idx il
mem = if Instance.auto_balance inst
mem = if Instance.autoBalance inst
then Instance.mem inst
else 0
in (Instance.pNode inst, mem))
......@@ -332,7 +332,7 @@ removeSec t inst =
new_dsk = fDsk t + Instance.dsk inst
old_peers = peers t
old_peem = P.find pnode old_peers
new_peem = if Instance.auto_balance inst
new_peem = if Instance.autoBalance inst
then old_peem - Instance.mem inst
else old_peem
new_peers = if new_peem > 0
......@@ -407,7 +407,7 @@ addSecEx force t inst pdx =
old_peers = peers t
old_mem = fMem t
new_dsk = fDsk t - Instance.dsk inst
secondary_needed_mem = if Instance.auto_balance inst
secondary_needed_mem = if Instance.autoBalance inst
then Instance.mem inst
else 0
new_peem = P.find pdx old_peers + secondary_needed_mem
......
......@@ -529,7 +529,7 @@ prop_Text_Load_Instance name mem dsk vcpus status
Instance.sNode i == (if null snode
then Node.noSecondary
else sdx) &&
Instance.auto_balance i == autobal &&
Instance.autoBalance i == autobal &&
isNothing fail1
prop_Text_Load_InstanceFail ktn fields =
......@@ -652,11 +652,11 @@ prop_Node_rMem inst =
forAll (arbitrary `suchThat` ((> 0) . Node.fMem)) $ \node ->
-- ab = auto_balance, nb = non-auto_balance
-- we use -1 as the primary node of the instance
let inst' = inst { Instance.pNode = -1, Instance.auto_balance = True }
let inst' = inst { Instance.pNode = -1, Instance.autoBalance = True }
inst_ab = setInstanceSmallerThanNode node inst'
inst_nb = inst_ab { Instance.auto_balance = False }
inst_nb = inst_ab { Instance.autoBalance = False }
-- now we have the two instances, identical except the
-- auto_balance attribute
-- autoBalance attribute
orig_rmem = Node.rMem node
inst_idx = Instance.idx inst_ab
node_add_ab = Node.addSec node inst_ab (-1)
......
......@@ -96,7 +96,7 @@ serializeInstance nl inst =
printf "%s|%d|%d|%d|%s|%s|%s|%s|%s"
iname (Instance.mem inst) (Instance.dsk inst)
(Instance.vcpus inst) (Instance.runSt inst)
(if Instance.auto_balance inst then "Y" else "N")
(if Instance.autoBalance inst then "Y" else "N")
pnode snode (intercalate "," (Instance.tags inst))
-- | Generate instance file data from instance objects.
......
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