the items in quota_usage table will longer than 255

Bug #1608849 reported by wangxiyuan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Medium
Brin Zhang

Bug Description

In quota_usage table, the "resource" list contain the resource's name and its length is <=255. But some resource's name , such as "volumes", "snapshots" and "gigabytes" may contain volume type's name, it looks like: "volumes_{volume_type_name}","snapshots_{volume_type_name}" and "gigabytes_{volume_type_name}".
When the volume type's name's length is 255, the quota_usaga'name will be longer than 255. then it will raise 500 error from db layer.

wangxiyuan (wangxiyuan)
description: updated
Changed in cinder:
status: New → Incomplete
status: Incomplete → Confirmed
assignee: nobody → Karthik Prabhu Vinod (karthik-prabhu-vinod)
Changed in cinder:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (stable/newton)

Fix proposed to branch: stable/newton
Review: https://review.openstack.org/375187

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on cinder (stable/newton)

Change abandoned by Karthik Prabhu Vinod (<email address hidden>) on branch: stable/newton
Review: https://review.openstack.org/375187
Reason: This is the wrongly created. This should have been cherry picked from master

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (stable/newton)

Fix proposed to branch: stable/newton
Review: https://review.openstack.org/378080

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on cinder (master)

Change abandoned by Karthik Prabhu Vinod (<email address hidden>) on branch: master
Review: https://review.openstack.org/355214

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on cinder (stable/newton)

Change abandoned by Mike Perez (<email address hidden>) on branch: stable/newton
Review: https://review.openstack.org/378080

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on cinder (master)

Change abandoned by Karthik Prabhu Vinod (<email address hidden>) on branch: master
Review: https://review.openstack.org/375179
Reason: Handled it in a new change:
https://review.openstack.org/#/c/390166/

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Sean McGinnis (<email address hidden>) on branch: master
Review: https://review.openstack.org/390166
Reason: This review is > 4 weeks without comment, and failed Jenkins the last time it was checked. We are abandoning this for now. Feel free to reactivate the review by pressing the restore button and leaving a 'recheck' comment to get fresh test results.

Revision history for this message
Eric Harney (eharney) wrote :

WIP tempest test to help troubleshoot this issue: https://review.openstack.org/#/c/381287/

Changed in cinder:
status: In Progress → New
assignee: Karthik Prabhu Vinod (karthik-prabhu-vinod) → nobody
Changed in cinder:
status: New → Confirmed
Changed in cinder:
assignee: nobody → Brin Zhang (zhangbailin)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/611530
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=24dd74748d22232bd91147367c9ac6a6ccf25cc5
Submitter: Zuul
Branch: master

commit 24dd74748d22232bd91147367c9ac6a6ccf25cc5
Author: zhangbailin <email address hidden>
Date: Thu Oct 18 03:44:12 2018 -0400

    Increase the length of resource property in quota_usages

    When updating the volume type, the length of the name is checked to be
    0-255. If the user input length is 255 characters
    (e.g. volume_type_name='X*255'), when synchronizing the quota resource,
    the resource name needs to be updated to the form of 'resource +
    volume_type_name' in quota_usages [1], because the resource attribute in
    the DB is set to 'String(255)', the length limit is exceeded.

    Therefore, the resource column attribute in the quota_usages database table
    needs to be changed from 'String(255)' to 'String(300)'.

    [1]https://github.com/openstack/cinder/blob/master/cinder/db/sqlalchemy/api.py#L352

    Closes-Bug: #1798327
    Closes-Bug: #1608849
    Change-Id: I6c30a6be750f6b9ecff7399dbb0aea66cdc097da

Changed in cinder:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/cinder 14.0.0.0rc1

This issue was fixed in the openstack/cinder 14.0.0.0rc1 release candidate.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to cinder (master)

Reviewed: https://review.openstack.org/616850
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=c34e42af75b7b31adab7060fc2bd6ddfcab92bf5
Submitter: Zuul
Branch: master

commit c34e42af75b7b31adab7060fc2bd6ddfcab92bf5
Author: suguangfeng <email address hidden>
Date: Fri Nov 9 02:52:34 2018 -0500

    Rollback the volume_types table when failed to update quota_usages

    We create a new volume based on a volume type, then update the volume
    type name to a new name of 255 characters in length.
    When updating the volume type table, the quota_usages table is updated
    synchronously. If DB error occurs in the quota_usages table, we need to
    roll back the volume types table.Otherwise, when the volume is deleted,
    the information of the quota_usages table will not be updated.

    Closes-bug: #1802430
    Related-Bug: #1608849

    Change-Id: I040ccde7f04ae39258afd9b7322c939c8d796bde

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to cinder (stable/stein)

Related fix proposed to branch: stable/stein
Review: https://review.opendev.org/687149

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to cinder (stable/stein)

Reviewed: https://review.opendev.org/687149
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=c9efc9e81b4e8b7992d75f06d159faeef8fa77ad
Submitter: Zuul
Branch: stable/stein

commit c9efc9e81b4e8b7992d75f06d159faeef8fa77ad
Author: suguangfeng <email address hidden>
Date: Fri Nov 9 02:52:34 2018 -0500

    Rollback the volume_types table when failed to update quota_usages

    We create a new volume based on a volume type, then update the volume
    type name to a new name of 255 characters in length.
    When updating the volume type table, the quota_usages table is updated
    synchronously. If DB error occurs in the quota_usages table, we need to
    roll back the volume types table.Otherwise, when the volume is deleted,
    the information of the quota_usages table will not be updated.

    Closes-bug: #1802430
    Related-Bug: #1608849

    Change-Id: I040ccde7f04ae39258afd9b7322c939c8d796bde
    (cherry picked from commit c34e42af75b7b31adab7060fc2bd6ddfcab92bf5)

tags: added: in-stable-stein
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to cinder (master)

Related fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/cinder/+/815712

Changed in cinder:
importance: Undecided → Medium
tags: added: quotas
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to cinder (master)

Reviewed: https://review.opendev.org/c/openstack/cinder/+/815712
Committed: https://opendev.org/openstack/cinder/commit/3a968212d6fc259f9f5855154a3e5246aa18eb10
Submitter: "Zuul (22348)"
Branch: master

commit 3a968212d6fc259f9f5855154a3e5246aa18eb10
Author: Gorka Eguileor <email address hidden>
Date: Wed Oct 27 18:46:53 2021 +0200

    DB: Set quota resource property length to 300

    On change I6c30a6be750f6b9ecff7399dbb0aea66cdc097da we increased the
    `resource` column of the quota_usages table from 255 to 300, because its
    value is constructed from (prefix + volume_type_name), but the length of
    `volume_type_name` can be up to 255 characters, so if we add a prefix
    such as 'volumes_' or 'gigabytes_' to it we'll exceed the db length
    limit of the `resource` column.

    There are other 3 quota related tables (quotas, quota_classes,
    reservations) that have a `resource` column, and they are all
    referencing the same kind of thing, but they still have a maximum size
    of 255 characters, so there will be things that we won't be able to do
    when using a volume type with a 255 characters name. Some of the
    operations we won't be able to do are setting a default quota limit for
    it or migrate volumes using that volume type.

    Related-Bug: #1798327
    Related-Bug: #1608849
    Closes-Bug: #1948962
    Change-Id: I40546b20322443dc34556de4aababf33a230db78

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.