Revision e5b7c4ca lib/rapi/rlib2.py

b/lib/rapi/rlib2.py
493 493
    return baserlib.SubmitJob([op])
494 494

  
495 495

  
496
class R_2_instances_name_reinstall(baserlib.R_Generic):
497
  """/2/instances/[instance_name]/reinstall resource.
498

  
499
  Implements an instance reinstall.
500

  
501
  """
502

  
503
  DOC_URI = "/2/instances/[instance_name]/reinstall"
504

  
505
  def POST(self):
506
    """Reinstall an instance.
507

  
508
    The URI takes os=name and nostartup=[0|1] optional
509
    parameters. By default, the instance will be started
510
    automatically.
511

  
512
    """
513
    instance_name = self.items[0]
514
    ostype = self._checkStringVariable('os')
515
    nostartup = self._checkIntVariable('nostartup')
516
    ops = [
517
      opcodes.OpShutdownInstance(instance_name=instance_name),
518
      opcodes.OpReinstallInstance(instance_name=instance_name, os_type=ostype),
519
      ]
520
    if not nostartup:
521
      ops.append(opcodes.OpStartupInstance(instance_name=instance_name,
522
                                           force=False))
523
    return baserlib.SubmitJob(ops)
524

  
525

  
496 526
class _R_Tags(baserlib.R_Generic):
497 527
  """ Quasiclass for tagging resources
498 528

  

Also available in: Unified diff