Quotas per share_type has bad db unique contraint

Bug #1722707 reported by Sam Morrison
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Shared File Systems Service (Manila)
Fix Released
High
Valeriy Ponomaryov

Bug Description

The unique constraint on the project_share_type_quotas makes it essentially impossible to use.

UNIQUE KEY `uc_quotas_per_share_types` (`share_type_id`,`resource`,`deleted`),

It needs to take into account project_id so more than one project can have per share-type quotas.

This will fix it:

ALTER TABLE project_share_type_quotas
   DROP INDEX `uc_quotas_per_share_types`,
   ADD UNIQUE KEY `uc_quotas_per_share_types` (`share_type_id`,`resource`,`deleted`, project_id);

Sam Morrison (sorrison)
description: updated
Revision history for this message
Dustin Schoenbrun (dschoenb) wrote :

Hey Valeriy, Tom was telling me that you'd worked on the quotas stuff in the past; what do you think about this one? Thanks!

Revision history for this message
Sam Morrison (sorrison) wrote :

I've been trying to figure out in alembic how to do a drop and add index in the same alter table command, can't do a drop then an add as it violates a foreign key somehow

ALTER TABLE project_share_type_quotas DROP INDEX `uc_quotas_per_share_types`;
ERROR 1553 (HY000): Cannot drop index 'uc_quotas_per_share_types': needed in a foreign key constraint

Changed in manila:
status: New → Triaged
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to manila (master)

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

Changed in manila:
assignee: nobody → Valeriy Ponomaryov (vponomaryov)
status: Triaged → In Progress
Changed in manila:
milestone: none → queens-1
tags: added: pike-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to manila (stable/pike)

Fix proposed to branch: stable/pike
Review: https://review.openstack.org/518900

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to manila (stable/pike)

Reviewed: https://review.openstack.org/518900
Committed: https://git.openstack.org/cgit/openstack/manila/commit/?id=91dbbb4d156ec29e79b1ab8698bfc382d59a3c2d
Submitter: Zuul
Branch: stable/pike

commit 91dbbb4d156ec29e79b1ab8698bfc382d59a3c2d
Author: Valeriy Ponomaryov <email address hidden>
Date: Fri Oct 13 10:54:05 2017 +0300

    Fix 'project_share_type_quotas' DB table unique constraint

    It should be possible to use share type quotas in each project/tenant.
    But we get error trying to set share types quota in second+ project
    for the same share type. It happens so due to the bug in DB schema,
    where we don't have 'project_id' in unique constraint.
    So, add new DB migration that fixes unique constraint and cover it with
    DB and tempest tests.

    Change-Id: I1405ced4e12b40904b7227c9f6285e2775005f8a
    Closes-Bug: #1722707
    (cherry picked from commit 7ba41320f3ee36116d114874cb01d589a92f3291)

tags: added: in-stable-pike
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to manila (master)

Reviewed: https://review.openstack.org/511753
Committed: https://git.openstack.org/cgit/openstack/manila/commit/?id=7ba41320f3ee36116d114874cb01d589a92f3291
Submitter: Zuul
Branch: master

commit 7ba41320f3ee36116d114874cb01d589a92f3291
Author: Valeriy Ponomaryov <email address hidden>
Date: Fri Oct 13 10:54:05 2017 +0300

    Fix 'project_share_type_quotas' DB table unique constraint

    It should be possible to use share type quotas in each project/tenant.
    But we get error trying to set share types quota in second+ project
    for the same share type. It happens so due to the bug in DB schema,
    where we don't have 'project_id' in unique constraint.
    So, add new DB migration that fixes unique constraint and cover it with
    DB and tempest tests.

    Change-Id: I1405ced4e12b40904b7227c9f6285e2775005f8a
    Closes-Bug: #1722707

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

This issue was fixed in the openstack/manila 6.0.0.0b2 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/manila 5.0.2

This issue was fixed in the openstack/manila 5.0.2 release.

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.