commit 7959cbb9e9bc627be364d3e3e404c3d45141ed16
Author: Iustin Pop <iustin@google.com>
Date:   Mon Feb 20 11:43:50 2012 +0100

    Shorten some function names
    
    Since we use the functions always module-qualified, let's drop the
    `instance` prefix and use a shorter one.
    
    Signed-off-by: Iustin Pop <iustin@google.com>
    Reviewed-by: Michael Hanselmann <hansmi@google.com>

diff --git a/htools/Ganeti/HTools/Cluster.hs b/htools/Ganeti/HTools/Cluster.hs
index 37af920..cb49ffc 100644
--- a/htools/Ganeti/HTools/Cluster.hs
+++ b/htools/Ganeti/HTools/Cluster.hs
@@ -1208,7 +1208,7 @@ computeMoves i inam mv c d =
     ReplaceSecondary _ -> (printf "r:%s" d, [rep d])
     ReplaceAndFailover _ -> (printf "r:%s f" c, [rep c, mig])
     ReplacePrimary _ -> (printf "f r:%s f" c, [mig, rep c, mig])
-  where morf = if Instance.instanceRunning i then "migrate" else "failover"
+  where morf = if Instance.isRunning i then "migrate" else "failover"
         mig = printf "%s -f %s" morf inam::String
         rep n = printf "replace-disks -n %s %s" n inam
 
@@ -1306,7 +1306,7 @@ printNodes nl fs =
 printInsts :: Node.List -> Instance.List -> String
 printInsts nl il =
   let sil = sortBy (comparing Instance.idx) (Container.elems il)
-      helper inst = [ if Instance.instanceRunning inst then "R" else " "
+      helper inst = [ if Instance.isRunning inst then "R" else " "
                     , Instance.name inst
                     , Container.nameOf nl (Instance.pNode inst)
                     , let sdx = Instance.sNode inst
diff --git a/htools/Ganeti/HTools/Instance.hs b/htools/Ganeti/HTools/Instance.hs
index 0f32080..4b5924e 100644
--- a/htools/Ganeti/HTools/Instance.hs
+++ b/htools/Ganeti/HTools/Instance.hs
@@ -31,9 +31,9 @@ module Ganeti.HTools.Instance
   , AssocList
   , List
   , create
-  , instanceRunning
-  , instanceOffline
-  , instanceNotOffline
+  , isRunning
+  , isOffline
+  , notOffline
   , instanceDown
   , usesSecMem
   , applyIfOnline
@@ -89,36 +89,36 @@ instance T.Element Instance where
   allNames n = [name n, alias n]
 
 -- | Check if instance is running.
-instanceRunning :: Instance -> Bool
-instanceRunning (Instance {runSt = T.Running}) = True
-instanceRunning (Instance {runSt = T.ErrorUp}) = True
-instanceRunning _                              = False
+isRunning :: Instance -> Bool
+isRunning (Instance {runSt = T.Running}) = True
+isRunning (Instance {runSt = T.ErrorUp}) = True
+isRunning _                              = False
 
 -- | Check if instance is offline.
-instanceOffline :: Instance -> Bool
-instanceOffline (Instance {runSt = T.AdminOffline}) = True
-instanceOffline _                                   = False
+isOffline :: Instance -> Bool
+isOffline (Instance {runSt = T.AdminOffline}) = True
+isOffline _                                   = False
 
 
 -- | Helper to check if the instance is not offline.
-instanceNotOffline :: Instance -> Bool
-instanceNotOffline = not . instanceOffline
+notOffline :: Instance -> Bool
+notOffline = not . isOffline
 
 -- | Check if instance is down.
 instanceDown :: Instance -> Bool
-instanceDown inst | instanceRunning inst = False
-instanceDown inst | instanceOffline inst = False
-instanceDown _                           = True
+instanceDown inst | isRunning inst = False
+instanceDown inst | isOffline inst = False
+instanceDown _                     = True
 
 -- | Apply the function if the instance is online. Otherwise use
 -- the initial value
 applyIfOnline :: Instance -> (a -> a) -> a -> a
-applyIfOnline = applyIf . instanceNotOffline
+applyIfOnline = applyIf . notOffline
 
 -- | Helper for determining whether an instance's memory needs to be
 -- taken into account for secondary memory reservation.
 usesSecMem :: Instance -> Bool
-usesSecMem inst = instanceNotOffline inst && autoBalance inst
+usesSecMem inst = notOffline inst && autoBalance inst
 
 -- | Constant holding the local storage templates.
 --
diff --git a/htools/Ganeti/HTools/Loader.hs b/htools/Ganeti/HTools/Loader.hs
index d7f40bf..169dd48 100644
--- a/htools/Ganeti/HTools/Loader.hs
+++ b/htools/Ganeti/HTools/Loader.hs
@@ -341,7 +341,7 @@ nodeImem :: Node.Node -> Instance.List -> Int
 nodeImem node il =
   let rfind = flip Container.find il
       il' = map rfind $ Node.pList node
-      oil' = filter Instance.instanceNotOffline il'
+      oil' = filter Instance.notOffline il'
   in sum . map Instance.mem $ oil'
 
 
diff --git a/htools/Ganeti/HTools/Node.hs b/htools/Ganeti/HTools/Node.hs
index 2f5de9b..128a3f5 100644
--- a/htools/Ganeti/HTools/Node.hs
+++ b/htools/Ganeti/HTools/Node.hs
@@ -348,7 +348,7 @@ setFmem t new_mem =
 removePri :: Node -> Instance.Instance -> Node
 removePri t inst =
   let iname = Instance.idx inst
-      i_online = Instance.instanceNotOffline inst
+      i_online = Instance.notOffline inst
       uses_disk = Instance.usesLocalStorage inst
       new_plist = delete iname (pList t)
       new_mem = incIf i_online (fMem t) (Instance.mem inst)
@@ -409,7 +409,7 @@ addPriEx :: Bool               -- ^ Whether to override the N+1 and
                                -- or a failure mode
 addPriEx force t inst =
   let iname = Instance.idx inst
-      i_online = Instance.instanceNotOffline inst
+      i_online = Instance.notOffline inst
       uses_disk = Instance.usesLocalStorage inst
       cur_dsk = fDsk t
       new_mem = decIf i_online (fMem t) (Instance.mem inst)
diff --git a/htools/Ganeti/HTools/QC.hs b/htools/Ganeti/HTools/QC.hs
index df1f552..7b3d253 100644
--- a/htools/Ganeti/HTools/QC.hs
+++ b/htools/Ganeti/HTools/QC.hs
@@ -960,7 +960,7 @@ prop_Node_setMcpu node mc =
 -- rejected.
 prop_Node_addPriFM node inst =
   Instance.mem inst >= Node.fMem node && not (Node.failN1 node) &&
-  not (Instance.instanceOffline inst) ==>
+  not (Instance.isOffline inst) ==>
   case Node.addPri node inst'' of
     Types.OpFail Types.FailMem -> True
     _ -> False
@@ -980,7 +980,7 @@ prop_Node_addPriFD node inst =
 prop_Node_addPriFC =
   forAll (choose (1, maxCpu)) $ \extra ->
   forAll genOnlineNode $ \node ->
-  forAll (arbitrary `suchThat` Instance.instanceNotOffline) $ \inst ->
+  forAll (arbitrary `suchThat` Instance.notOffline) $ \inst ->
   let inst' = setInstanceSmallerThanNode node inst
       inst'' = inst' { Instance.vcpus = Node.availCpu node + extra }
   in case Node.addPri node inst'' of
@@ -991,7 +991,7 @@ prop_Node_addPriFC =
 -- rejected.
 prop_Node_addSec node inst pdx =
   ((Instance.mem inst >= (Node.fMem node - Node.rMem node) &&
-    not (Instance.instanceOffline inst)) ||
+    not (Instance.isOffline inst)) ||
    Instance.dsk inst >= Node.fDsk node) &&
   not (Node.failN1 node) ==>
       isFailure (Node.addSec node inst pdx)
@@ -1011,7 +1011,7 @@ prop_Node_addOffline (NonNegative extra_mem) (NonNegative extra_cpu) pdx =
 
 -- | Checks for memory reservation changes.
 prop_Node_rMem inst =
-  not (Instance.instanceOffline inst) ==>
+  not (Instance.isOffline inst) ==>
   forAll (arbitrary `suchThat` ((> Types.unitMem) . Node.fMem)) $ \node ->
   -- ab = auto_balance, nb = non-auto_balance
   -- we use -1 as the primary node of the instance
