'Refresh the usage records for a particular project and user
on a list of resources.  This will force usage records to be
sync\'d immediately to the actual usage.
This method will raise a QuotaUsageRefreshNotAllowed exception if a
usage refresh is not allowed on a resource for the given project
or user.
:param context: The request context, for access checks.
:param resources: A dictionary of the registered resources.
:param project_id: Optional: Project whose resources to
refresh.  If not set, then the project_id
is taken from the context.
:param user_id: Optional: User whose resources to refresh.
If not set, then the user_id is taken from the
context.
:param resources_names: Optional: A list of the resource names
for which the usage must be refreshed.
If not specified, then all the usages
for the project and user will be refreshed.'

def usage_refresh(self, context, resources, project_id=None, user_id=None, resource_names=None):

    if (project_id is None):
        project_id = context.project_id
    if (user_id is None):
        user_id = context.user_id
    syncable_resources = self._get_syncable_resources(resources, user_id)
    if resource_names:
        for res_name in resource_names:
            if (res_name not in syncable_resources):
                raise exception.QuotaUsageRefreshNotAllowed(resource=res_name, project_id=project_id, user_id=user_id, syncable=syncable_resources)
    else:
        resource_names = syncable_resources
    return db.quota_usage_refresh(context, resources, resource_names, CONF.quota.until_refresh, CONF.quota.max_age, project_id=project_id, user_id=user_id)
