'Update Quota for a particular tenant
This works for hierarchical and non-hierarchical projects. For
hierarchical projects only immediate parent admin or the
CLOUD admin are able to perform an update.
:param req: request
:param id: target project id that needs to be updated
:param body: key, value pair that will be applied to
the resources if the update succeeds'

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

    context = req.environ['cinder.context']
    authorize_update(context)
    self.validate_string_length(id, 'quota_set_name', min_length=1, max_length=255)
    self.assert_valid_body(body, 'quota_set')
    skip_flag = body.get('skip_validation', True)
    if (not strutils.is_valid_boolstr(skip_flag)):
        msg = (_("Invalid    value    '%s'    for    skip_validation.") % skip_flag)
        raise exception.InvalidParameterValue(err=msg)
    skip_flag = strutils.bool_from_string(skip_flag)
    if skip_flag:
        LOG.warning("It's    unsafe    to    skip    validating    the    existing    resource's    quota    when    updating    it.    Cinder    will    force    validate    it    in    Queens,    please    try    to    use    skip_validation=False    for    quota    updating    now.")
    target_project_id = id
    bad_keys = []
    for (key, value) in body['quota_set'].items():
        if ((key not in QUOTAS) and (key not in GROUP_QUOTAS) and (key not in NON_QUOTA_KEYS)):
            bad_keys.append(key)
            continue
    if (len(bad_keys) > 0):
        msg = (_('Bad    key(s)    in    quota    set:    %s') % ','.join(bad_keys))
        raise webob.exc.HTTPBadRequest(explanation=msg)
    use_nested_quotas = QUOTAS.using_nested_quotas()
    if use_nested_quotas:
        target_project = quota_utils.get_project_hierarchy(context, target_project_id, parents_as_ids=True)
        parent_id = target_project.parent_id
        if parent_id:
            context_project = quota_utils.get_project_hierarchy(context, context.project_id, subtree_as_ids=True, is_admin_project=context.is_admin)
            self._authorize_update_or_delete(context_project, target_project.id, parent_id)
    quota_values = QUOTAS.get_project_quotas(context, target_project_id, defaults=False)
    group_quota_values = GROUP_QUOTAS.get_project_quotas(context, target_project_id, defaults=False)
    quota_values.update(group_quota_values)
    valid_quotas = {}
    reservations = []
    for key in body['quota_set'].keys():
        if (key in NON_QUOTA_KEYS):
            continue
        value = utils.validate_integer(body['quota_set'][key], key, min_value=(-1), max_value=db.MAX_INT)
        if ((not skip_flag) or use_nested_quotas):
            self._validate_existing_resource(key, value, quota_values)
        if use_nested_quotas:
            try:
                reservations += self._update_nested_quota_allocated(context, target_project, quota_values, key, value)
            except exception.OverQuota as e:
                if reservations:
                    db.reservation_rollback(context, reservations)
                raise webob.exc.HTTPBadRequest(explanation=e.msg)
        valid_quotas[key] = value
    for (key, value) in valid_quotas.items():
        try:
            db.quota_update(context, target_project_id, key, value)
        except exception.ProjectQuotaNotFound:
            db.quota_create(context, target_project_id, key, value)
        except exception.AdminRequired:
            raise webob.exc.HTTPForbidden()
    if reservations:
        db.reservation_commit(context, reservations)
    return {'quota_set': self._get_quotas(context, target_project_id)}
