invalid quota resource when update volume type name

Bug #1909630 reported by haixin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Triaged
Medium
haixin

Bug Description

When we need to update volume type name, will call:
QUOTAS.update_quota_resource(elevated, old_type_name,name)
in this function the code below:
def update_quota_resource(self, context, old_type_name, new_type_name):
for quota in ('volumes', 'gigabytes', 'snapshots'):
    old_res = "%s_%s" % (quota, old_type_name)
    new_res = "%s_%s" % (quota, new_type_name)
    db.quota_usage_update_resource(context,
                                   old_res,
                                   new_res)
    db.quota_class_update_resource(context, # it is not necessary
                                   old_res,
                                   new_res)
    db.quota_update_resource(context,
                             old_res,
                             new_res)
As everyone knows, there is no such resource named as "%s_%s" % (quota_type, volulme_type_name) in database table of quota_classes.
in table quota_classes, there are only quota default value for new project.
Unless we manually set the default quota for volume type. These values are default values, and we don't know how the user will name the volume type before we create it,So it doesn't make sense to preset a default value for a volume type in advance.

so resource named as "%s_%s" % (quota_type, volulme_type_name) only exist in table quota_usages or quotas if we set quota for specified volume type.
will not appear in table of quota_classes.

so we not need to call quota_class_update_resource when update volume type name.

haixin (haixin77)
Changed in cinder:
assignee: nobody → haixin (haixin77)
haixin (haixin77)
summary: - invalid quota resource when update volume type
+ invalid quota resource when update volume type name
haixin (haixin77)
description: updated
tags: added: quota volume-type
Changed in cinder:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on cinder (master)

Change abandoned by "haixin <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/cinder/+/768858

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.