Commit e0345103 authored by Christos Stavrakakis's avatar Christos Stavrakakis

Pass hashmap instead of location to snf-image

Update Cyclades, to pass as 'img_id' the hashmap('checksum') of the
image, instead of the location URL. In that way, snf-image does not any
access to the Pithos database.
parent 0ed73667
......@@ -70,6 +70,7 @@ PLANKTON_URL = \
get_service_path(cyclades_services, "image", version="v1.0"))
IMAGES_PLANKTON_URL = join_urls(PLANKTON_URL, "images/")
PITHOSMAP_PREFIX = "pithosmap://"
log = getLogger('synnefo.api')
......@@ -161,14 +162,20 @@ def get_image(image_id, user_id):
def get_image_dict(image_id, user_id):
image = {}
img = get_image(image_id, user_id)
properties = img.get('properties', {})
image["id"] = img["id"]
image["name"] = img["name"]
image['backend_id'] = img['location']
image['format'] = img['disk_format']
image['metadata'] = dict((key.upper(), val)
image["format"] = img["disk_format"]
image["checksum"] = img["checksum"]
image["location"] = img["location"]
checksum = image["checksum"] = img["checksum"]
size = image["size"] = img["size"]
image["backend_id"] = PITHOSMAP_PREFIX + "/".join([checksum, str(size)])
properties = img.get("properties", {})
image["metadata"] = dict((key.upper(), val)
for key, val in properties.items())
image['checksum'] = img['checksum']
return image
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment