Revision ad8676d2 snf-cyclades-app/synnefo/volume/snapshots.py

b/snf-cyclades-app/synnefo/volume/snapshots.py
132 132
    return snapshot
133 133

  
134 134

  
135
def rename(snapshot, new_name):
136
    # user_id = snapshot["owner"]
137
    raise NotImplemented("Renaming a snapshot is not implemented!")
135
def update(snapshot, name=None, description=None):
136
    """Update a snapshot
138 137

  
139

  
140
def update_description(snapshot, new_description):
141
    # user_id = snapshot["owner"]
142
    raise NotImplemented("Updating snapshot's description is not implemented!")
138
    Update the name or description of a snapshot.
139
    """
140
    metadata = {}
141
    if name is not None:
142
        metadata["name"] = name
143
    if description is not None:
144
        metadata["description"] = description
145
    if not metadata:
146
        return
147
    user_id = snapshot["owner"]
148
    with image_backend(user_id) as b:
149
        return b.update_metadata(snapshot["id"], metadata)

Also available in: Unified diff