Revision 0c55c24b lib/rapi/rlib2.py

b/lib/rapi/rlib2.py
257 257
  def GET(self):
258 258
    """Reboot an instance.
259 259

  
260
    The URI takes type=[hard|soft|full] and
261
    ignore_secondaries=[False|True] parameters.
262

  
260 263
    """
261 264
    instance_name = self.items[0]
262
    reboot_type = self.queryargs.get('reboot_type',
263
                                     constants.INSTANCE_REBOOT_HARD)
264
    ignore_secondaries = self.queryargs.get('ignore_secondaries', False)
265
    reboot_type = self.queryargs.get('type',
266
                                     [constants.INSTANCE_REBOOT_HARD])[0]
267
    ignore_secondaries = bool(self.queryargs.get('ignore_secondaries',
268
                                                 [False])[0])
265 269
    op = ganeti.opcodes.OpRebootInstance(
266 270
        instance_name=instance_name,
267 271
        reboot_type=reboot_type,
......
272 276
    return job_id
273 277

  
274 278

  
279
class R_2_instances_name_startup(baserlib.R_Generic):
280
  """/2/instances/[instance_name]/startup resource.
281

  
282
  Implements an instance startup.
283

  
284
  """
285

  
286
  DOC_URI = "/2/instances/[instance_name]/startup"
287

  
288
  def GET(self):
289
    """Startup an instance.
290

  
291
    The URI takes force=[False|True] parameter to start the instance if even if
292
    secondary disks are failing.
293

  
294
    """
295
    instance_name = self.items[0]
296
    force_startup = bool(self.queryargs.get('force', [False])[0])
297
    op = ganeti.opcodes.OpStartupInstance(instance_name=instance_name,
298
                                          force=force_startup)
299

  
300
    job_id = ganeti.cli.SendJob([op])
301

  
302
    return job_id
303

  
304

  
305
class R_2_instances_name_shutdown(baserlib.R_Generic):
306
  """/2/instances/[instance_name]/shutdown resource.
307

  
308
  Implements an instance shutdown.
309

  
310
  """
311

  
312
  DOC_URI = "/2/instances/[instance_name]/shutdown"
313

  
314
  def GET(self):
315
    """Shutdown an instance.
316

  
317
    """
318
    instance_name = self.items[0]
319
    op = ganeti.opcodes.OpShutdownInstance(instance_name=instance_name)
320

  
321
    job_id = ganeti.cli.SendJob([op])
322

  
323
    return job_id
324

  
325

  
275 326
class R_2_instances_name_tags(baserlib.R_Generic):
276 327
  """/2/instances/[instance_name]/tags resource.
277 328

  
......
291 342
  def POST(self):
292 343
    """Add a set of tags to the instance.
293 344

  
294
    The reqest as a list of strings should be POST to this URI. And you'll have
345
    The request as a list of strings should be POST to this URI. And you'll have
295 346
    back a job id.
296 347

  
297 348
    """

Also available in: Unified diff