Revision c172f4ab snf-cyclades-app/synnefo/api/util.py

b/snf-cyclades-app/synnefo/api/util.py
70 70
              get_service_path(cyclades_services, "image", version="v1.0"))
71 71
IMAGES_PLANKTON_URL = join_urls(PLANKTON_URL, "images/")
72 72

  
73
PITHOSMAP_PREFIX = "pithosmap://"
73 74

  
74 75
log = getLogger('synnefo.api')
75 76

  
......
161 162
def get_image_dict(image_id, user_id):
162 163
    image = {}
163 164
    img = get_image(image_id, user_id)
164
    properties = img.get('properties', {})
165 165
    image["id"] = img["id"]
166 166
    image["name"] = img["name"]
167
    image['backend_id'] = img['location']
168
    image['format'] = img['disk_format']
169
    image['metadata'] = dict((key.upper(), val)
167
    image["format"] = img["disk_format"]
168
    image["checksum"] = img["checksum"]
169
    image["location"] = img["location"]
170

  
171
    checksum = image["checksum"] = img["checksum"]
172
    size = image["size"] = img["size"]
173
    image["backend_id"] = PITHOSMAP_PREFIX + "/".join([checksum, str(size)])
174

  
175
    properties = img.get("properties", {})
176
    image["metadata"] = dict((key.upper(), val)
170 177
                             for key, val in properties.items())
171
    image['checksum'] = img['checksum']
178

  
172 179

  
173 180
    return image
174 181

  

Also available in: Unified diff