Revision 18ca395d snf-cyclades-app/synnefo/volume/views.py

b/snf-cyclades-app/synnefo/volume/views.py
222 222
    data = {
223 223
        "id": snapshot["uuid"],
224 224
        "size": int(snapshot["size"]) >> 30,  # gigabytes
225
        "name": snapshot["name"],
226
        "description": snapshot["description"],
225
        "display_name": snapshot["name"],
226
        "display_description": snapshot["description"],
227 227
        "status": status,
228 228
        "user_id": owner,
229 229
        "tenant_id": owner,
......
232 232
        "created_at": utils.isoformat(date_parse(snapshot["created_at"])),
233 233
        "metadata": snapshot.get("metadata", {}),
234 234
        "volume_id": snapshot.get("volume_id"),
235
        "links": "",  # TODO fix links
235
        "links": util.snapshot_to_links(snapshot["uuid"])
236 236
    }
237 237
    return data
238 238

  
......
263 263
    volume = util.get_volume(user_id, volume_id, for_update=True,
264 264
                             exception=faults.BadRequest)
265 265

  
266
    name = new_snapshot.get("name", None)
266
    name = new_snapshot.get("display_name", None)
267 267
    if name is None:
268 268
        name = "snapshot_volume_%s_%s" %\
269 269
            (volume.id, str(datetime.datetime.now()))
270
    description = new_snapshot.get("description", "")
270
    description = new_snapshot.get("display_description", "")
271 271

  
272 272
    # TODO: What to do with force ?
273 273
    force = new_snapshot.get("force", False)
......
329 329
    req = utils.get_request_dict(request)
330 330
    log.debug('update_snapshot snapshot_id: %s, request: %s', snapshot_id, req)
331 331
    snapshot = util.get_snapshot(request.user_uniq, snapshot_id)
332
    # TODO
333
    #snapshot.name = req.get("name", snapshot.name)
334
    #snapshot.description = req.get("description", snapshot.description)
335
    #snapshot.save()
332

  
333
    new_name = req.get("display_name")
334
    new_description = req.get("display_description")
335
    if new_name is None and new_description is None:
336
        raise faults.BadRequest("Nothing to update.")
337

  
338
    if new_name is not None:
339
        snapshot = snapshots.rename(snapshot, new_name)
340
    if new_description is not None:
341
        snapshot = snapshots.update_description(snapshot, new_description)
342

  
336 343
    data = json.dumps({'snapshot': snapshot_to_dict(snapshot, detail=True)})
337 344
    return HttpResponse(data, content_type="application/json", status=200)

Also available in: Unified diff