Revision 74267398

b/snf-cyclades-app/synnefo/logic/rapi.py
472 472
    return self._SendRequest(HTTP_POST, "/%s/instances" % GANETI_RAPI_VERSION,
473 473
                             query, body)
474 474

  
475
  def DeleteInstance(self, instance, dry_run=False):
475
  def DeleteInstance(self, instance, dry_run=False, shutdown_timeout=None):
476 476
    """Deletes an instance.
477 477

  
478 478
    @type instance: str
......
485 485
    query = []
486 486
    _AppendDryRunIf(query, dry_run)
487 487

  
488
    body = None
489
    if shutdown_timeout is not None:
490
        body = {"shutdown_timeout": shutdown_timeout}
491

  
488 492
    return self._SendRequest(HTTP_DELETE,
489 493
                             ("/%s/instances/%s" %
490
                              (GANETI_RAPI_VERSION, instance)), query, None)
494
                              (GANETI_RAPI_VERSION, instance)), query, body)
491 495

  
492 496
  def ModifyInstance(self, instance, **kwargs):
493 497
    """Modifies an instance.
......
642 646
                              (GANETI_RAPI_VERSION, instance)), query, None)
643 647

  
644 648
  def RebootInstance(self, instance, reboot_type=None, ignore_secondaries=None,
645
                     dry_run=False):
649
                     dry_run=False, shutdown_timeout=None):
646 650
    """Reboots an instance.
647 651

  
648 652
    @type instance: str
......
664 668
    _AppendIf(query, ignore_secondaries is not None,
665 669
              ("ignore_secondaries", ignore_secondaries))
666 670

  
671
    body = None
672
    if shutdown_timeout is not None:
673
        body = {"shutdown_timeout": shutdown_timeout}
674

  
667 675
    return self._SendRequest(HTTP_POST,
668 676
                             ("/%s/instances/%s/reboot" %
669
                              (GANETI_RAPI_VERSION, instance)), query, None)
677
                              (GANETI_RAPI_VERSION, instance)), query, body)
670 678

  
671
  def ShutdownInstance(self, instance, dry_run=False, no_remember=False):
679
  def ShutdownInstance(self, instance, dry_run=False, no_remember=False,
680
                       timeout=None):
672 681
    """Shuts down an instance.
673 682

  
674 683
    @type instance: str
......
684 693
    query = []
685 694
    _AppendDryRunIf(query, dry_run)
686 695
    _AppendIf(query, no_remember, ("no-remember", 1))
696
    body = None
697
    if timeout is not None:
698
        body = {"timeout": timeout}
699

  
687 700

  
688 701
    return self._SendRequest(HTTP_PUT,
689 702
                             ("/%s/instances/%s/shutdown" %
690
                              (GANETI_RAPI_VERSION, instance)), query, None)
703
                              (GANETI_RAPI_VERSION, instance)), query, body)
691 704

  
692 705
  def StartupInstance(self, instance, dry_run=False, no_remember=False):
693 706
    """Starts up an instance.

Also available in: Unified diff