Revision c465e496

b/snf-cyclades-app/synnefo/logic/backend.py
1073 1073
        return client.ModifyInstance(**kwargs)
1074 1074

  
1075 1075

  
1076
def snapshot_instance(vm, snapshot_name):
1077
    #volume = instance.volumes.all()[0]
1078
    with pooled_rapi_client(vm) as client:
1079
        return client.SnapshotInstance(instance=vm.backend_vm_id,
1080
                                       snapshot_name=snapshot_name)
1081

  
1082

  
1076 1083
def get_instances(backend, bulk=True):
1077 1084
    with pooled_rapi_client(backend) as c:
1078 1085
        return c.GetInstances(bulk=bulk)
b/snf-cyclades-app/synnefo/logic/rapi.py
546 546
                             ("/%s/instances/%s/deactivate-disks" %
547 547
                              (GANETI_RAPI_VERSION, instance)), None, None)
548 548

  
549
  def SnapshotInstance(self, instance, snapshot_name, dry_run=False):
550
    """Replaces disks on an instance.
551

  
552
    @type instance: str
553
    @param instance: instance whose disks to replace
554
    @type snapshot_name: str
555
    @param snapshot_name: name of the new snapshot
556

  
557
    @rtype: string
558
    @return: job id
559

  
560
    """
561

  
562
    body = {
563
      "disks": [(0, {"snapshot_name": snapshot_name})],
564
      }
565

  
566
    query = []
567
    _AppendDryRunIf(query, dry_run)
568

  
569
    return self._SendRequest(HTTP_PUT,
570
                             ("/%s/instances/%s/snapshot" %
571
                              (GANETI_RAPI_VERSION, instance)), query, body)
572

  
549 573
  def RecreateInstanceDisks(self, instance, disks=None, nodes=None):
550 574
    """Recreate an instance's disks.
551 575

  

Also available in: Unified diff