Revision 4944a1f8 snf-cyclades-app/synnefo/volume/util.py
b/snf-cyclades-app/synnefo/volume/util.py | ||
---|---|---|
1 | 1 |
from synnefo.db import models |
2 | 2 |
from snf_django.lib.api import faults |
3 |
from synnefo.api.util import get_image_dict, get_vm |
|
3 |
from synnefo.api.util import get_image_dict, get_vm, image_backend
|
|
4 | 4 |
|
5 | 5 |
|
6 | 6 |
def get_volume(user_id, volume_id, for_update=False, |
... | ... | |
15 | 15 |
|
16 | 16 |
|
17 | 17 |
def get_snapshot(user_id, snapshot_id, exception=faults.ItemNotFound): |
18 |
try: |
|
19 |
return get_image_dict(snapshot_id, user_id) |
|
20 |
except faults.ItemNotFound: |
|
21 |
raise exception("Snapshot %s not found" % snapshot_id) |
|
18 |
with image_backend(user_id) as b: |
|
19 |
return b.get_snapshot(user_id, snapshot_id) |
|
22 | 20 |
|
23 | 21 |
|
24 | 22 |
def get_image(user_id, image_id, exception=faults.ItemNotFound): |
Also available in: Unified diff