Revision 1316db51
b/snf-cyclades-app/synnefo/logic/backend.py | ||
---|---|---|
1079 | 1079 |
return client.ModifyInstance(**kwargs) |
1080 | 1080 |
|
1081 | 1081 |
|
1082 |
def snapshot_instance(vm, snapshot_name): |
|
1083 |
#volume = instance.volumes.all()[0] |
|
1084 |
with pooled_rapi_client(vm) as client: |
|
1085 |
return client.SnapshotInstance(instance=vm.backend_vm_id, |
|
1086 |
snapshot_name=snapshot_name) |
|
1087 |
|
|
1088 |
|
|
1082 | 1089 |
def get_instances(backend, bulk=True): |
1083 | 1090 |
with pooled_rapi_client(backend) as c: |
1084 | 1091 |
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