'Restore an existing backup to a volume.'

@wsgi.response(http_client.ACCEPTED)
def restore(self, req, id, body):

    LOG.debug('Restoring    backup    %(backup_id)s    (%(body)s)', {'backup_id': id, 'body': body})
    self.assert_valid_body(body, 'restore')
    context = req.environ['cinder.context']
    restore = body['restore']
    volume_id = restore.get('volume_id', None)
    name = restore.get('name', None)
    LOG.info('Restoring    backup    %(backup_id)s    to    volume    %(volume_id)s.', {'backup_id': id, 'volume_id': volume_id}, context=context)
    try:
        new_restore = self.backup_api.restore(context, backup_id=id, volume_id=volume_id, name=name)
    except (exception.InvalidInput, exception.InvalidVolume, exception.InvalidBackup) as error:
        raise exc.HTTPBadRequest(explanation=error.msg)
    except (exception.VolumeSizeExceedsAvailableQuota, exception.VolumeLimitExceeded) as error:
        raise exc.HTTPRequestEntityTooLarge(explanation=error.msg, headers={'Retry-After': '0'})
    retval = self._view_builder.restore_summary(req, dict(new_restore))
    return retval
