Manila allows share type deletion despite quota allocations

Bug #1811680 reported by Arne Wiebalck on 2019-01-14
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Manila
Medium
Goutham Pacha Ravi

Bug Description

Manila seems allows share type deletions when there are still per project quota allocations.

I found this when purging our Manila DB ("manila-manage db purge") and ran into a situation where the foreign key constraint on project_share_type_quotas prevents the purge of share_types.

Apart from direct DB manipulation there seems to be no way to get out of this situation.

I think Manila should do one of the following:
a) make "manila type-delete" fail if that violates a foreign key constraint (in this case if there are entries in project_share_type_quotas that reference the type to be deleted), or
b) offer a "--force" option to "manila quota-delete" to ignore non-existing types.

My preference would be a), but b) is probably easier coding-wise (and would at least avoid that operators need to directly change the database).

Tom Barron (tpb) on 2019-01-14
tags: added: db
tags: added: quotas
Changed in manila:
importance: Undecided → Medium
Goutham Pacha Ravi (gouthamr) wrote :

Hey Arne,

Do you think we should rather cleanup quota allocations when you delete a share type? I don't think we care about quotas if the type cannot be used.

Arne Wiebalck (arne-wiebalck) wrote :

Hey Goutham!

I agree, sounds like a good and simple option c) :-)

I probably thought it was intentional to force the operator to do the quota cleanup prior to a type deletion (kind of due diligence) ... what will Manila do if you try to delete a type when there are still shares around?

Thanks!
 Arne

Goutham Pacha Ravi (gouthamr) wrote :

Hi Arne,

Manila prevents deleting share types that are currently in use [1]. I'll work on this quotas bug post M3.

[1] https://github.com/openstack/manila/blob/5391830/manila/db/sqlalchemy/api.py#L4006

Changed in manila:
assignee: nobody → Goutham Pacha Ravi (gouthamr)

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

Changed in manila:
status: New → In Progress
Changed in manila:
milestone: none → stein-3
tags: added: backport-potential
Tom Barron (tpb) on 2019-03-17
Changed in manila:
milestone: stein-3 → stein-rc1

Reviewed: https://review.openstack.org/643516
Committed: https://git.openstack.org/cgit/openstack/manila/commit/?id=4b6cfcf69023dc7a4b004c59513c50d92b979152
Submitter: Zuul
Branch: master

commit 4b6cfcf69023dc7a4b004c59513c50d92b979152
Author: Goutham Pacha Ravi <email address hidden>
Date: Fri Mar 15 00:07:32 2019 -0700

    Destroy type quotas when a share type is deleted

    Upon share type deletion, we were leaving behind
    share type quotas, usages and reservations. These
    couldn't be cleaned up without resorting to manual
    intervention.

    Cleanup quotas when a share type is being destroyed,
    since the resources that they pertained to are gone
    too.

    Closes-Bug: #1811680
    Change-Id: I04b1fe88808596aa8c05429b964190d654587f9a

Changed in manila:
status: In Progress → Fix Released

Reviewed: https://review.openstack.org/644374
Committed: https://git.openstack.org/cgit/openstack/manila/commit/?id=aae7bc723591728c6be2a500ca44af8e6a032268
Submitter: Zuul
Branch: stable/rocky

commit aae7bc723591728c6be2a500ca44af8e6a032268
Author: Goutham Pacha Ravi <email address hidden>
Date: Fri Mar 15 00:07:32 2019 -0700

    Destroy type quotas when a share type is deleted

    Upon share type deletion, we were leaving behind
    share type quotas, usages and reservations. These
    couldn't be cleaned up without resorting to manual
    intervention.

    Cleanup quotas when a share type is being destroyed,
    since the resources that they pertained to are gone
    too.

    Closes-Bug: #1811680
    Change-Id: I04b1fe88808596aa8c05429b964190d654587f9a
    (cherry picked from commit 4b6cfcf69023dc7a4b004c59513c50d92b979152)

tags: added: in-stable-rocky

Reviewed: https://review.openstack.org/644585
Committed: https://git.openstack.org/cgit/openstack/manila/commit/?id=c9f954119391770899a68372bb0bd2829fc9b3c2
Submitter: Zuul
Branch: stable/queens

commit c9f954119391770899a68372bb0bd2829fc9b3c2
Author: Goutham Pacha Ravi <email address hidden>
Date: Fri Mar 15 00:07:32 2019 -0700

    Destroy type quotas when a share type is deleted

    Upon share type deletion, we were leaving behind
    share type quotas, usages and reservations. These
    couldn't be cleaned up without resorting to manual
    intervention.

    Cleanup quotas when a share type is being destroyed,
    since the resources that they pertained to are gone
    too.

    Closes-Bug: #1811680
    Change-Id: I04b1fe88808596aa8c05429b964190d654587f9a
    (cherry picked from commit 4b6cfcf69023dc7a4b004c59513c50d92b979152)
    (cherry picked from commit aae7bc723591728c6be2a500ca44af8e6a032268)

tags: added: in-stable-queens

Reviewed: https://review.openstack.org/644877
Committed: https://git.openstack.org/cgit/openstack/manila/commit/?id=79a96fc559d82e8b51b2e0eabca5cfe03374c69f
Submitter: Zuul
Branch: stable/pike

commit 79a96fc559d82e8b51b2e0eabca5cfe03374c69f
Author: Goutham Pacha Ravi <email address hidden>
Date: Fri Mar 15 00:07:32 2019 -0700

    Destroy type quotas when a share type is deleted

    Upon share type deletion, we were leaving behind
    share type quotas, usages and reservations. These
    couldn't be cleaned up without resorting to manual
    intervention.

    Cleanup quotas when a share type is being destroyed,
    since the resources that they pertained to are gone
    too.

    Closes-Bug: #1811680
    Change-Id: I04b1fe88808596aa8c05429b964190d654587f9a
    (cherry picked from commit 4b6cfcf69023dc7a4b004c59513c50d92b979152)
    (cherry picked from commit aae7bc723591728c6be2a500ca44af8e6a032268)
    (cherry picked from commit c9f954119391770899a68372bb0bd2829fc9b3c2)

tags: added: in-stable-pike

This issue was fixed in the openstack/manila 8.0.0.0rc1 release candidate.

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

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

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

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers