Revision ec629280

b/htools/Ganeti/HTools/IAlloc.hs
70 70
  vcpus <- extract "vcpus"
71 71
  tags  <- extract "tags"
72 72
  dt    <- extract "disk_template"
73
  su    <- extract "spindle_usage"
73
  su    <- extract "spindle_use"
74 74
  return (n, Instance.create n mem disk vcpus Running tags True 0 0 dt su)
75 75

  
76 76
-- | Parses an instance as found in the cluster instance list.
b/htools/Ganeti/HTools/Instance.hs
80 80
  , autoBalance  :: Bool      -- ^ Is the instance auto-balanced?
81 81
  , tags         :: [String]  -- ^ List of instance tags
82 82
  , diskTemplate :: T.DiskTemplate -- ^ The disk template of the instance
83
  , spindleUsage :: Int       -- ^ The numbers of used spindles
83
  , spindleUse   :: Int       -- ^ The numbers of used spindles
84 84
  } deriving (Show, Read, Eq)
85 85

  
86 86
instance T.Element Instance where
......
177 177
           , movable = supportsMoves dt
178 178
           , autoBalance = auto_balance_init
179 179
           , diskTemplate = dt
180
           , spindleUsage = su
180
           , spindleUse = su
181 181
           }
182 182

  
183 183
-- | Changes the index.
b/htools/Ganeti/HTools/Luxi.hs
107 107
  L.Query L.QRInstance ["name", "disk_usage", "be/memory", "be/vcpus",
108 108
                        "status", "pnode", "snodes", "tags", "oper_ram",
109 109
                        "be/auto_balance", "disk_template",
110
                        "be/spindle_usage"] ()
110
                        "be/spindle_use"] ()
111 111

  
112 112
-- | The input data for cluster query.
113 113
queryClusterInfoMsg :: L.LuxiOp
......
163 163
  xtags <- convert "tags" tags
164 164
  xauto_balance <- convert "auto_balance" auto_balance
165 165
  xdt <- convert "disk_template" disk_template
166
  xsu <- convert "be/spindle_usage" su
166
  xsu <- convert "be/spindle_use" su
167 167
  let inst = Instance.create xname xmem xdisk xvcpus
168 168
             xrunning xtags xauto_balance xpnode snode xdt xsu
169 169
  return (xname, inst)
b/htools/Ganeti/HTools/Node.hs
316 316
  in t {peers=pmap, failN1 = new_failN1, rMem = new_rmem, pRem = new_prem}
317 317

  
318 318
-- | Calculate the new spindle usage
319
calcSpindleUsage :: Node -> Instance.Instance -> Double
320
calcSpindleUsage n i = incIf (Instance.usesLocalStorage i) (instSpindles n)
321
                         (fromIntegral $ Instance.spindleUsage i)
319
calcSpindleUse :: Node -> Instance.Instance -> Double
320
calcSpindleUse n i = incIf (Instance.usesLocalStorage i) (instSpindles n)
321
                       (fromIntegral $ Instance.spindleUse i)
322 322

  
323 323
-- | Assigns an instance to a node as primary and update the used VCPU
324 324
-- count, utilisation data and tags map.
......
328 328
                  , pCpu = fromIntegral new_count / tCpu t
329 329
                  , utilLoad = utilLoad t `T.addUtil` Instance.util inst
330 330
                  , pTags = addTags (pTags t) (Instance.tags inst)
331
                  , instSpindles = calcSpindleUsage t inst
331
                  , instSpindles = calcSpindleUse t inst
332 332
                  }
333 333
  where new_count = Instance.applyIfOnline inst (+ Instance.vcpus inst)
334 334
                    (uCpu t )
......
338 338
setSec t inst = t { sList = Instance.idx inst:sList t
339 339
                  , utilLoad = old_load { T.dskWeight = T.dskWeight old_load +
340 340
                                          T.dskWeight (Instance.util inst) }
341
                  , instSpindles = calcSpindleUsage t inst
341
                  , instSpindles = calcSpindleUse t inst
342 342
                  }
343 343
  where old_load = utilLoad t
344 344

  
b/htools/Ganeti/HTools/QC.hs
796 796
                                      then Node.noSecondary
797 797
                                      else sdx) &&
798 798
               Instance.autoBalance i == autobal &&
799
               Instance.spindleUsage i == su &&
799
               Instance.spindleUse i == su &&
800 800
               Types.isBad fail1
801 801

  
802 802
prop_Text_Load_InstanceFail ktn fields =
b/htools/Ganeti/HTools/Rapi.hs
123 123
  tags <- extract "tags" a
124 124
  auto_balance <- extract "auto_balance" beparams
125 125
  dt <- extract "disk_template" a
126
  su <- extract "spindle_usage" beparams
126
  su <- extract "spindle_use" beparams
127 127
  let inst = Instance.create name mem disk vcpus running tags
128 128
             auto_balance pnode snode dt su
129 129
  return (name, inst)
b/htools/Ganeti/HTools/Text.hs
107 107
       (Instance.vcpus inst) (instanceStatusToRaw (Instance.runSt inst))
108 108
       (if Instance.autoBalance inst then "Y" else "N")
109 109
       pnode snode (diskTemplateToRaw (Instance.diskTemplate inst))
110
       (intercalate "," (Instance.tags inst)) (Instance.spindleUsage inst)
110
       (intercalate "," (Instance.tags inst)) (Instance.spindleUse inst)
111 111

  
112 112
-- | Generate instance file data from instance objects.
113 113
serializeInstances :: Node.List -> Instance.List -> String
......
223 223
                         "' for instance " ++ name
224 224
  disk_template <- annotateResult ("Instance " ++ name)
225 225
                   (diskTemplateFromRaw dt)
226
  spindle_usage <- tryRead name su
226
  spindle_use <- tryRead name su
227 227
  when (sidx == pidx) $ fail $ "Instance " ++ name ++
228 228
           " has same primary and secondary node - " ++ pnode
229 229
  let vtags = commaSplit tags
230 230
      newinst = Instance.create name vmem vdsk vvcpus vstatus vtags
231
                auto_balance pidx sidx disk_template spindle_usage
231
                auto_balance pidx sidx disk_template spindle_use
232 232
  return (name, newinst)
233 233

  
234 234
loadInst ktn [ name, mem, dsk, vcpus, status, auto_bal, pnode, snode

Also available in: Unified diff