Inconsistent return code for "Feature not implemented' API

Bug #1938093 reported by Ghanshyam Mann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Ghanshyam Mann

Bug Description

There is inconsistency on return code nova API return for "Feature not implemented'. Current return code are 400, 409, and 403.

- 400 case: Example: Multiattach Swap Volume Not Supported:
https://github.com/openstack/nova/blob/0c64f4c3eae8e2654ec11f60682c0fa5eda30c1a/nova/exception.py#L295
https://github.com/openstack/nova/blob/788035add9b32fa841389d906a0e307c231456ba/nova/api/openstack/compute/volumes.py#L429

- 403 case: Cyborg integration.
https://github.com/openstack/nova/blob/0c64f4c3eae8e2654ec11f60682c0fa5eda30c1a/nova/exception.py#L158
https://github.com/openstack/nova/blob/0e7cd9d1a95a30455e3c91916ece590454235e0e/nova/api/openstack/compute/suspend_server.py#L47

- 409 case: Example: Operation Not Supported For SEV , Operation Not Supported For VTPM
https://github.com/openstack/nova/blob/0c64f4c3eae8e2654ec11f60682c0fa5eda30c1a/nova/exception.py#L528-L537

In xena PTG, we agreed to fix this by returning 400 in all cases and backport the fix. L446: https://etherpad.opendev.org/p/nova-xena-ptg

Tags: api
Changed in nova:
status: New → Triaged
assignee: nobody → Ghanshyam Mann (ghanshyammann)
tags: added: api
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/+/806294

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

Reviewed: https://review.opendev.org/c/openstack/nova/+/806294
Committed: https://opendev.org/openstack/nova/commit/1b6a6e3916806849025f3a90cd6ec48811b02e8a
Submitter: "Zuul (22348)"
Branch: master

commit 1b6a6e3916806849025f3a90cd6ec48811b02e8a
Author: Ghanshyam Mann <email address hidden>
Date: Thu Aug 26 19:46:09 2021 -0500

    Convert features not supported error to HTTPBadRequest

    There is inconsistency on return code nova API return
    for "Feature not supported/implemented'. Current return
    code are 400, 409, and 403.
    - 400 case: Example: Multiattach Swap Volume Not Supported
    - 403 case: Cyborg integration
    - 409 case: Example: Operation Not Supported For SEV ,
      Operation Not Supported For VTPM

    In xena PTG, we agreed to fix this by returning 400 in all cases
    - L446: https://etherpad.opendev.org/p/nova-xena-ptg

    This commit convert all the features not supported error to
    HTTPBadRequest(400).

    To avoid converting every NotSupported inherited exception
    in API controller to HTTPBadRequest generic conversion is
    added in expected_errors() decorator.

    Closes-Bug: #1938093

    Change-Id: I410924668a73785f1bfe5c79827915d72e1d9e03

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

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

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.