modify project's subnet quota,value > used is successful

Bug #1508275 reported by lumeihong
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Invalid
Medium
Unassigned

Bug Description

set project's subnet quota is 10,then create 2 subnets,the useage of subnet quota is :{'available': 8, 'used': 2, 'quota': 10}.
then modify this project's subnet quota ,set the value is 1,it is sucessful.but from the code of "UpdateProjectQuotaAction",
value > used is not allowed.

Revision history for this message
zhengyue (zhengyue-5) wrote :

It is certainly a real problem in my env. But i think should set the limit at neutron API.

Revision history for this message
zhengyue (zhengyue-5) wrote :

The API bug fix in progress: https://bugs.launchpad.net/neutron/+bug/1304234
The input limit at page is also necessary.

Revision history for this message
lumeihong (lu-meihong) wrote :

but currently,this limit in dashboard,the problem as follows: there is no key of "subnet" in usages,
class UpdateProjectQuotaAction(ProjectQuotaAction):
    def clean(self):
        cleaned_data = super(UpdateProjectQuotaAction, self).clean()
        usages = quotas.tenant_quota_usages(
            self.request, tenant_id=self.initial['project_id'])
        # Validate the quota values before updating quotas.

        bad_values = []
        for key, value in cleaned_data.items():
            used = usages[key].get('used', 0) // here, key is "subnet",but in usages, it is "subnets", in stead of "subnet"

            if value is not None and value >= 0 and used > value:
                bad_values.append(_('%(used)s %(key)s used') %
                                  {'used': used,
                                   'key': quotas.QUOTA_NAMES.get(key, key)})
        if bad_values:
            value_str = ", ".join(bad_values)
            msg = (_('Quota value(s) cannot be less than the current usage '
                     'value(s): %s.') %
                   value_str)
            raise forms.ValidationError(msg)
        return cleaned_data

Revision history for this message
zhengyue (zhengyue-5) wrote :

Yes, you are right! The names in from is not match with name of usage item that get from quotas.tenant_quota_usages.
I suggest you to fix the problem by a patch.

Changed in horizon:
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/240493

Changed in horizon:
assignee: nobody → zhengyue (zhengyue-5)
status: Confirmed → In Progress
Changed in horizon:
importance: Undecided → Medium
milestone: none → mitaka-1
Changed in horizon:
assignee: zhengyue (zhengyue-5) → Timur Sufiev (tsufiev-x)
Timur Sufiev (tsufiev-x)
Changed in horizon:
assignee: Timur Sufiev (tsufiev-x) → zhengyue (zhengyue-5)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/240493
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=02fb01b4b7b23fb7d32520e9293cfce3dc8d8b3f
Submitter: Jenkins
Branch: master

commit 02fb01b4b7b23fb7d32520e9293cfce3dc8d8b3f
Author: ZhengYue <email address hidden>
Date: Thu Oct 8 11:55:19 2015 +0800

    Fix bug at update quota of project's network item

    Because the result keys not match between neutron tenant_quota_get
    and tenant_quota_usages, lead to validate lose efficacy at project's
    quota update.
    We should not change result from neutron API, and the tenant_quota_usages
    has depended other pages. So that changing the key at workflow clean
    of quota update.

    Change-Id: Ib110bc41ae10a882a901b8853d15c31b313e62aa
    Closes-bug: #1508275

Changed in horizon:
status: In Progress → Fix Released
Revision history for this message
Lin Hua Cheng (lin-hua-cheng) wrote :

re-opening - the bug caused a regression and have to be reverted.

See: https://bugs.launchpad.net/horizon/+bug/1550505

Changed in horizon:
status: Fix Released → New
Changed in horizon:
assignee: zhengyue (zhengyue-5) → nobody
milestone: mitaka-1 → next
Changed in horizon:
assignee: nobody → Sunkara Ramya Sree (ramyasunkara)
Changed in horizon:
assignee: Sunkara Ramya Sree (ramyasunkara) → nobody
Revision history for this message
NAVYA (navyas1) wrote :

The bug seems to be fixed in horizon(rocky version). Please find the attachment for the same.

However, the bug is still present while executing from CLI.

Revision history for this message
Akihiro Motoki (amotoki) wrote :

Perhaps it was fixed as part of quota refactoring.

Changed in horizon:
milestone: next → none
Revision history for this message
Akihiro Motoki (amotoki) wrote :

As of Rocky and Stein (development version), this bug does not exist.
From this reason, I mark this as Invalid.

Akihiro Motoki (amotoki)
Changed in horizon:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.