'Update a snapshot.'

def update(self, req, id, body):

    context = req.environ['cinder.context']
    if (not body):
        msg = _('Missing    request    body')
        raise exc.HTTPBadRequest(explanation=msg)
    if ('snapshot' not in body):
        msg = (_("Missing    required    element    '%s'    in    request    body") % 'snapshot')
        raise exc.HTTPBadRequest(explanation=msg)
    snapshot = body['snapshot']
    update_dict = {}
    valid_update_keys = ('name', 'description', 'display_name', 'display_description')
    self.validate_name_and_description(snapshot)
    if ('name' in snapshot):
        snapshot['display_name'] = snapshot.pop('name')
    if ('description' in snapshot):
        snapshot['display_description'] = snapshot.pop('description')
    for key in valid_update_keys:
        if (key in snapshot):
            update_dict[key] = snapshot[key]
    snapshot = self.volume_api.get_snapshot(context, id)
    volume_utils.notify_about_snapshot_usage(context, snapshot, 'update.start')
    self.volume_api.update_snapshot(context, snapshot, update_dict)
    snapshot.update(update_dict)
    req.cache_db_snapshot(snapshot)
    volume_utils.notify_about_snapshot_usage(context, snapshot, 'update.end')
    return self._view_builder.detail(req, snapshot)
