Revision d50b3059 lib/rapi/rlib2.py

b/lib/rapi/rlib2.py
205 205
    """
206 206
    opts = self.req.request_post_data
207 207

  
208
    # beparams
209
    mem = opts.get('mem', None)
210
    vcpus = opts.get('vcpus', None)
211
    auto_balance = opts.get('auto_balance', None)
212

  
213
    beparams = {}
214

  
215
    for key, const in [(mem, constants.BE_MEMORY),
216
                       (vcpus, constants.BE_VCPUS),
217
                       (auto_balance, constants.BE_AUTO_BALANCE)]:
218
      if key is not None:
219
        beparams[const] = key
208
    beparams = baserlib.MakeParamsDict(opts, constants.BES_PARAMETERS)
209
    hvparams = baserlib.MakeParamsDict(opts, constants.HVS_PARAMETERS)
220 210

  
221 211
    op = ganeti.opcodes.OpCreateInstance(
222 212
        instance_name=opts.get('name'),
......
234 224
        wait_for_sync=opts.get('wait_for_sync', True),
235 225
        mac=opts.get('mac', 'auto'),
236 226
        hypervisor=opts.get('hypervisor', None),
237
        hvparams=opts.get('hvparams', {}),
227
        hvparams=hvparams,
238 228
        beparams=beparams,
239 229
        iallocator=opts.get('iallocator', None),
240 230
        file_storage_dir=opts.get('file_storage_dir', None),

Also available in: Unified diff