From 0e09422b91e258e963cc829e171f82589a6f6d44 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Sat, 2 Jul 2011 21:51:59 +0200
Subject: [PATCH] htools: rename Instance.auto_balance
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

… to autoBalance, per the recommended style.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 htools/Ganeti/HTools/Cluster.hs  | 2 +-
 htools/Ganeti/HTools/Instance.hs | 4 ++--
 htools/Ganeti/HTools/Node.hs     | 6 +++---
 htools/Ganeti/HTools/QC.hs       | 8 ++++----
 htools/Ganeti/HTools/Text.hs     | 2 +-
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/htools/Ganeti/HTools/Cluster.hs b/htools/Ganeti/HTools/Cluster.hs
index 95178e46a..f839e75ca 100644
--- a/htools/Ganeti/HTools/Cluster.hs
+++ b/htools/Ganeti/HTools/Cluster.hs
@@ -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
diff --git a/htools/Ganeti/HTools/Instance.hs b/htools/Ganeti/HTools/Instance.hs
index e21c30ef8..4cf80586d 100644
--- a/htools/Ganeti/HTools/Instance.hs
+++ b/htools/Ganeti/HTools/Instance.hs
@@ -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.
diff --git a/htools/Ganeti/HTools/Node.hs b/htools/Ganeti/HTools/Node.hs
index 5394904ad..cc723ad43 100644
--- a/htools/Ganeti/HTools/Node.hs
+++ b/htools/Ganeti/HTools/Node.hs
@@ -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
diff --git a/htools/Ganeti/HTools/QC.hs b/htools/Ganeti/HTools/QC.hs
index df3051bc2..241caf802 100644
--- a/htools/Ganeti/HTools/QC.hs
+++ b/htools/Ganeti/HTools/QC.hs
@@ -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)
diff --git a/htools/Ganeti/HTools/Text.hs b/htools/Ganeti/HTools/Text.hs
index 05eff2d53..fccb65237 100644
--- a/htools/Ganeti/HTools/Text.hs
+++ b/htools/Ganeti/HTools/Text.hs
@@ -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.
-- 
GitLab