Revision ebeb600f lib/rapi/client.py

b/lib/rapi/client.py
840 840
                             ("/%s/instances/%s/replace-disks" %
841 841
                              (GANETI_RAPI_VERSION, instance)), query, None)
842 842

  
843
  def PrepareExport(self, instance, mode):
844
    """Prepares an instance for an export.
845

  
846
    @type instance: string
847
    @param instance: Instance name
848
    @type mode: string
849
    @param mode: Export mode
850
    @rtype: string
851
    @return: Job ID
852

  
853
    """
854
    query = [("mode", mode)]
855
    return self._SendRequest(HTTP_PUT,
856
                             ("/%s/instances/%s/prepare-export" %
857
                              (GANETI_RAPI_VERSION, instance)), query, None)
858

  
859
  def ExportInstance(self, instance, mode, destination, shutdown=None,
860
                     remove_instance=None,
861
                     x509_key_name=None, destination_x509_ca=None):
862
    """Exports an instance.
863

  
864
    @type instance: string
865
    @param instance: Instance name
866
    @type mode: string
867
    @param mode: Export mode
868
    @rtype: string
869
    @return: Job ID
870

  
871
    """
872
    body = {
873
      "destination": destination,
874
      "mode": mode,
875
      }
876

  
877
    if shutdown is not None:
878
      body["shutdown"] = shutdown
879

  
880
    if remove_instance is not None:
881
      body["remove_instance"] = remove_instance
882

  
883
    if x509_key_name is not None:
884
      body["x509_key_name"] = x509_key_name
885

  
886
    if destination_x509_ca is not None:
887
      body["destination_x509_ca"] = destination_x509_ca
888

  
889
    return self._SendRequest(HTTP_PUT,
890
                             ("/%s/instances/%s/export" %
891
                              (GANETI_RAPI_VERSION, instance)), None, body)
892

  
843 893
  def GetJobs(self):
844 894
    """Gets all jobs for the cluster.
845 895

  

Also available in: Unified diff