Revision 981bb5cf

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

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

  
84 85
instance T.Element Instance where
......
157 158
-- Some parameters are not initialized by function, and must be set
158 159
-- later (via 'setIdx' for example).
159 160
create :: String -> Int -> Int -> Int -> T.InstanceStatus
160
       -> [String] -> Bool -> T.Ndx -> T.Ndx -> T.DiskTemplate -> Instance
161
       -> [String] -> Bool -> T.Ndx -> T.Ndx -> T.DiskTemplate -> Int
162
       -> Instance
161 163
create name_init mem_init dsk_init vcpus_init run_init tags_init
162
       auto_balance_init pn sn dt =
164
       auto_balance_init pn sn dt su =
163 165
  Instance { name = name_init
164 166
           , alias = name_init
165 167
           , mem = mem_init
......
174 176
           , movable = supportsMoves dt
175 177
           , autoBalance = auto_balance_init
176 178
           , diskTemplate = dt
179
           , spindleUsage = su
177 180
           }
178 181

  
179 182
-- | Changes the index.
b/htools/Ganeti/HTools/Luxi.hs
163 163
  xauto_balance <- convert "auto_balance" auto_balance
164 164
  xdt <- convert "disk_template" disk_template
165 165
  let inst = Instance.create xname xmem xdisk xvcpus
166
             xrunning xtags xauto_balance xpnode snode xdt
166
             xrunning xtags xauto_balance xpnode snode xdt 1
167 167
  return (xname, inst)
168 168

  
169 169
parseInstance _ v = fail ("Invalid instance query result: " ++ show v)
b/htools/Ganeti/HTools/Program/Hspace.hs
389 389
instFromSpec :: RSpec -> DiskTemplate -> Instance.Instance
390 390
instFromSpec spx disk_template =
391 391
  Instance.create "new" (rspecMem spx) (rspecDsk spx)
392
    (rspecCpu spx) Running [] True (-1) (-1) disk_template
392
    (rspecCpu spx) Running [] True (-1) (-1) disk_template 1
393 393

  
394 394
-- | Main function.
395 395
main :: Options -> [String] -> IO ()
b/htools/Ganeti/HTools/QC.hs
175 175
-- | Create an instance given its spec.
176 176
createInstance mem dsk vcpus =
177 177
  Instance.create "inst-unnamed" mem dsk vcpus Types.Running [] True (-1) (-1)
178
    Types.DTDrbd8
178
    Types.DTDrbd8 1
179 179

  
180 180
-- | Create a small cluster by repeating a node spec.
181 181
makeSmallCluster :: Node.Node -> Int -> Node.List
......
313 313
  sn <- arbitrary
314 314
  vcpus <- choose (0, lim_cpu)
315 315
  return $ Instance.create name mem dsk vcpus run_st [] True pn sn
316
         Types.DTDrbd8
316
         Types.DTDrbd8 1
317 317

  
318 318
-- | Generates an instance smaller than a node.
319 319
genInstanceSmallerThanNode :: Node.Node -> Gen Instance.Instance
b/htools/Ganeti/HTools/Rapi.hs
124 124
  auto_balance <- extract "auto_balance" beparams
125 125
  dt <- extract "disk_template" a
126 126
  let inst = Instance.create name mem disk vcpus running tags
127
             auto_balance pnode snode dt
127
             auto_balance pnode snode dt 1
128 128
  return (name, inst)
129 129

  
130 130
-- | Construct a node from a JSON object.
b/htools/Ganeti/HTools/Text.hs
226 226
           " has same primary and secondary node - " ++ pnode
227 227
  let vtags = commaSplit tags
228 228
      newinst = Instance.create name vmem vdsk vvcpus vstatus vtags
229
                auto_balance pidx sidx disk_template
229
                auto_balance pidx sidx disk_template 1
230 230
  return (name, newinst)
231 231
loadInst _ s = fail $ "Invalid/incomplete instance data: '" ++ show s ++ "'"
232 232

  

Also available in: Unified diff