Revision 89363686 snf-cyclades-app/synnefo/api/util.py
b/snf-cyclades-app/synnefo/api/util.py | ||
---|---|---|
82 | 82 |
get_service_path(cyclades_services, "image", version="v1.0")) |
83 | 83 |
IMAGES_PLANKTON_URL = join_urls(PLANKTON_URL, "images/") |
84 | 84 |
|
85 |
PITHOSMAP_PREFIX = "pithosmap://" |
|
85 | 86 |
|
86 | 87 |
log = getLogger('synnefo.api') |
87 | 88 |
|
... | ... | |
173 | 174 |
def get_image_dict(image_id, user_id): |
174 | 175 |
image = {} |
175 | 176 |
img = get_image(image_id, user_id) |
176 |
properties = img.get('properties', {}) |
|
177 | 177 |
image["id"] = img["id"] |
178 | 178 |
image["name"] = img["name"] |
179 |
image['backend_id'] = img['location'] |
|
180 |
image['format'] = img['disk_format'] |
|
181 |
image['metadata'] = dict((key.upper(), val) |
|
179 |
image["format"] = img["disk_format"] |
|
180 |
image["checksum"] = img["checksum"] |
|
181 |
image["location"] = img["location"] |
|
182 |
|
|
183 |
checksum = image["checksum"] = img["checksum"] |
|
184 |
size = image["size"] = img["size"] |
|
185 |
image["backend_id"] = PITHOSMAP_PREFIX + "/".join([checksum, str(size)]) |
|
186 |
|
|
187 |
properties = img.get("properties", {}) |
|
188 |
image["metadata"] = dict((key.upper(), val) |
|
182 | 189 |
for key, val in properties.items()) |
183 |
image['checksum'] = img['checksum'] |
|
190 |
|
|
184 | 191 |
|
185 | 192 |
return image |
186 | 193 |
|
Also available in: Unified diff