Impossible to remove deleted project from private flavor's access list

Bug #1980845 reported by Alexey Stupnikov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Alexey Stupnikov

Bug Description

Private flavors have a list of projects which can use them. This list of projects is maintained in flavor_projects table and this list is not updated automatically when some project is removed by Keystone.

As a result, OpenStack users may face situations when project associated with private flavor no longer exists and it is impossible to remove it.

Steps to reproduce:
(overcloud) [stack@undercloud-0 ~]$ openstack project create testproject
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | |
| domain_id | default |
| enabled | True |
| id | e9884959c0ad46f5a9b1dfe9654aa577 |
| is_domain | False |
| name | testproject |
| options | {} |
| parent_id | default |
| tags | [] |
+-------------+----------------------------------+
(overcloud) [stack@undercloud-0 ~]$ openstack flavor create --private --project testproject --ram 64 --disk 1 test_testproj
+----------------------------+--------------------------------------+
| Field | Value |
+----------------------------+--------------------------------------+
| OS-FLV-DISABLED:disabled | False |
| OS-FLV-EXT-DATA:ephemeral | 0 |
| description | None |
| disk | 1 |
| extra_specs | {} |
| id | b1a3307c-03d2-4da8-bfa9-d138025d5203 |
| name | test_testproj |
| os-flavor-access:is_public | False |
| properties | |
| ram | 64 |
| rxtx_factor | 1.0 |
| swap | 0 |
| vcpus | 1 |
+----------------------------+--------------------------------------+
(overcloud) [stack@undercloud-0 ~]$ openstack project delete testproject
(overcloud) [stack@undercloud-0 ~]$ openstack flavor unset --project testproject test_testproj
Failed to remove flavor access from project: No project with a name or ID of 'testproject' exists.
Command Failed: One or more of the operations failed

Code: https://github.com/openstack/nova/blob/master/nova/api/openstack/identity.py

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

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/nova/+/849131

Changed in nova:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.opendev.org/c/openstack/nova/+/849131
Committed: https://opendev.org/openstack/nova/commit/8c6daaacbedc33e738ce85aec0ead5f6947d60bf
Submitter: "Zuul (22348)"
Branch: master

commit 8c6daaacbedc33e738ce85aec0ead5f6947d60bf
Author: Alexey Stupnikov <email address hidden>
Date: Fri Jul 8 17:56:38 2022 +0200

    Remove deleted projects from flavor access list

    Previously Nova was unable to remove deleted projects from flavor's
    access lists. This patch lifts described limitation and improves
    logic of nova/api/openstack/identity.py library by introducing two
    separate kinds of exceptions:

    - webob.exc.HTTPInternalServerError is raised when Keystone identity
      service version 3.0 was not found.
    - webob.exc.HTTPBadRequest is raised when specified project is not
      found.

    Closes-bug: #1980845
    Change-Id: Icbf3bdd944f9a6c38f25ddea0b521ca48ee87a7f

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/zed)

Fix proposed to branch: stable/zed
Review: https://review.opendev.org/c/openstack/nova/+/870053

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 27.0.0.0rc1

This issue was fixed in the openstack/nova 27.0.0.0rc1 release candidate.

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

Reviewed: https://review.opendev.org/c/openstack/nova/+/870053
Committed: https://opendev.org/openstack/nova/commit/2ea2b556da5f10d662641bd96b0a07735d2b9607
Submitter: "Zuul (22348)"
Branch: stable/zed

commit 2ea2b556da5f10d662641bd96b0a07735d2b9607
Author: Alexey Stupnikov <email address hidden>
Date: Fri Jul 8 17:56:38 2022 +0200

    Remove deleted projects from flavor access list

    Previously Nova was unable to remove deleted projects from flavor's
    access lists. This patch lifts described limitation and improves
    logic of nova/api/openstack/identity.py library by introducing two
    separate kinds of exceptions:

    - webob.exc.HTTPInternalServerError is raised when Keystone identity
      service version 3.0 was not found.
    - webob.exc.HTTPBadRequest is raised when specified project is not
      found.

    Closes-bug: #1980845
    Change-Id: Icbf3bdd944f9a6c38f25ddea0b521ca48ee87a7f
    (cherry picked from commit 8c6daaacbedc33e738ce85aec0ead5f6947d60bf)

tags: added: in-stable-zed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/yoga)

Fix proposed to branch: stable/yoga
Review: https://review.opendev.org/c/openstack/nova/+/881314

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

Reviewed: https://review.opendev.org/c/openstack/nova/+/881314
Committed: https://opendev.org/openstack/nova/commit/6c1b862274546a32a43e1184f24101ebb6c30680
Submitter: "Zuul (22348)"
Branch: stable/yoga

commit 6c1b862274546a32a43e1184f24101ebb6c30680
Author: Alexey Stupnikov <email address hidden>
Date: Fri Jul 8 17:56:38 2022 +0200

    Remove deleted projects from flavor access list

    Previously Nova was unable to remove deleted projects from flavor's
    access lists. This patch lifts described limitation and improves
    logic of nova/api/openstack/identity.py library by introducing two
    separate kinds of exceptions:

    - webob.exc.HTTPInternalServerError is raised when Keystone identity
      service version 3.0 was not found.
    - webob.exc.HTTPBadRequest is raised when specified project is not
      found.

    Closes-bug: #1980845
    Change-Id: Icbf3bdd944f9a6c38f25ddea0b521ca48ee87a7f
    (cherry picked from commit 8c6daaacbedc33e738ce85aec0ead5f6947d60bf)
    (cherry picked from commit 2ea2b556da5f10d662641bd96b0a07735d2b9607)

tags: added: in-stable-yoga
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/xena)

Fix proposed to branch: stable/xena
Review: https://review.opendev.org/c/openstack/nova/+/883014

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

This issue was fixed in the openstack/nova 25.2.0 release.

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

This issue was fixed in the openstack/nova 26.2.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova wallaby-eom

This issue was fixed in the openstack/nova wallaby-eom release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova xena-eom

This issue was fixed in the openstack/nova xena-eom 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.