Revision 4944a1f8 snf-cyclades-app/synnefo/api/util.py

b/snf-cyclades-app/synnefo/api/util.py
173 173
    image["id"] = img["id"]
174 174
    image["name"] = img["name"]
175 175
    image["format"] = img["disk_format"]
176
    image["checksum"] = img["checksum"]
177 176
    image["location"] = img["location"]
178

  
179
    checksum = image["checksum"] = img["checksum"]
180 177
    size = image["size"] = img["size"]
181
    image["backend_id"] = PITHOSMAP_PREFIX + "/".join([checksum, str(size)])
178

  
179
    checksum = img["checksum"]
180
    if checksum.startswith("archip:"):
181
        unprefixed_checksum, _ = checksum.split("archip:")
182
        checksum = unprefixed_checksum
183
    else:
184
        unprefixed_checksum = checksum
185
        checksum = "pithos:" + checksum
186

  
187
    image["backend_id"] = PITHOSMAP_PREFIX + "/".join([unprefixed_checksum,
188
                                                       str(size)])
189
    image["checksum"] = checksum
182 190

  
183 191
    properties = img.get("properties", {})
184 192
    image["metadata"] = dict((key.upper(), val)

Also available in: Unified diff