placement trait and inventory handler use nonstandard HTTP error message details

Bug #1771325 reported by Balazs Gibizer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Balazs Gibizer
Pike
Fix Released
Medium
Elod Illes
Queens
Fix Released
Medium
Balazs Gibizer

Bug Description

DELETE /traits/<standard trait name>

Actual
------

{"errors": [{"status": 400, "request_id": "req-b30e30ba-9fce-403f-9f24-b6e32cd0b8c9", "detail": "Cannot delete standard trait HW_GPU_API_DXVA.\n\n ", "title": "Bad Request"}]}

Expected
--------

{"errors": [{"status": 400, "request_id": "req-3caa15be-a726-41f2-a7cb-f4afb3c97a44", "detail": "The server could not comply with the request since it is either malformed or otherwise incorrect.\n\n Cannot delete standard trait HW_GPU_API_DXVA. ", "title": "Bad Request"}]}

Most of the placement wsgi code passes one positional argument to the constructor of the webob.exc.HTTPXXX exception classes but the trait [1] and inventory handlers uses the 'explanation' kwargs. As the above example shows this leads to different behavior. This inconsistency leads to incorrect behavior in osc placement client [2].

[1] https://github.com/openstack/nova/blob/ae131868f71700d69053b65a0a37f9c2d65c3770/nova/api/openstack/placement/handlers/trait.py#L133
[2] https://github.com/openstack/osc-placement/blob/2357807c95d74afc836852e1c54f0631c6fd2d60/osc_placement/http.py#L35

tags: added: placement
Changed in nova:
assignee: nobody → Balazs Gibizer (balazs-gibizer)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

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

Reviewed: https://review.openstack.org/568567
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=90d2dbedefbcc99a20a6a86888ef1d316d5d119f
Submitter: Zuul
Branch: master

commit 90d2dbedefbcc99a20a6a86888ef1d316d5d119f
Author: Balazs Gibizer <email address hidden>
Date: Tue May 15 13:44:59 2018 +0200

    placement: Fix HTTP error generation

    The traits and the inventories wsgi handler inserted the detailed error
    message to the webob.exc.HTTPXXX exceptions via the 'explanation' kwarg.
    This caused that the generated error messages does not contain the generic
    explanation of the HTTP error code just the passed in explanation text.
    The rest of the placement API uses first positional arg of the exception
    classes to pass in the extra details. Having this inconsistency makes
    really hard to print proper error messages from the osc-placement
    plugin.

    This patch removes the incosistency by changing the code to use the
    positional arg.

    The change does not affect nova.scheduler.client.report._RE_INV_IN_USE
    regex usage as that regex applied via re.search() and this change only
    adds a new sentece to the message.

    Change-Id: I196c2e3dabcbf0564c1ca0bd4870dc2df3efc836
    Close-Bug: #1771325

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

Fix proposed to branch: stable/queens
Review: https://review.openstack.org/568784

jichenjc (jichenjc)
Changed in nova:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/queens)

Reviewed: https://review.openstack.org/568784
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=dddee4189c0789565d1bb0328ef03fab3fb6a45a
Submitter: Zuul
Branch: stable/queens

commit dddee4189c0789565d1bb0328ef03fab3fb6a45a
Author: Balazs Gibizer <email address hidden>
Date: Tue May 15 13:44:59 2018 +0200

    placement: Fix HTTP error generation

    The traits and the inventories wsgi handler inserted the detailed error
    message to the webob.exc.HTTPXXX exceptions via the 'explanation' kwarg.
    This caused that the generated error messages does not contain the generic
    explanation of the HTTP error code just the passed in explanation text.
    The rest of the placement API uses first positional arg of the exception
    classes to pass in the extra details. Having this inconsistency makes
    really hard to print proper error messages from the osc-placement
    plugin.

    This patch removes the incosistency by changing the code to use the
    positional arg.

    The change does not affect nova.scheduler.client.report._RE_INV_IN_USE
    regex usage as that regex applied via re.search() and this change only
    adds a new sentece to the message.

    Change-Id: I196c2e3dabcbf0564c1ca0bd4870dc2df3efc836
    Close-Bug: #1771325
    (cherry picked from commit 90d2dbedefbcc99a20a6a86888ef1d316d5d119f)

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

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

Revision history for this message
Fan Zhang (fanzhang) wrote :

Patches have been merged into master, stable/queens and stable/pike. Maybe the status should be changed into Fix Released? Looks like the launchpad didn't change the status automatically.

Revision history for this message
Balazs Gibizer (balazs-gibizer) wrote :

This haven't been merged to stable/pike yet https://review.openstack.org/571218

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

Reviewed: https://review.openstack.org/571218
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=51e8b8e6ac3b38b3b3c82ea1d842da89977b68e1
Submitter: Zuul
Branch: stable/pike

commit 51e8b8e6ac3b38b3b3c82ea1d842da89977b68e1
Author: Balazs Gibizer <email address hidden>
Date: Tue May 15 13:44:59 2018 +0200

    placement: Fix HTTP error generation

    The traits and the inventories wsgi handler inserted the detailed error
    message to the webob.exc.HTTPXXX exceptions via the 'explanation' kwarg.
    This caused that the generated error messages does not contain the generic
    explanation of the HTTP error code just the passed in explanation text.
    The rest of the placement API uses first positional arg of the exception
    classes to pass in the extra details. Having this inconsistency makes
    really hard to print proper error messages from the osc-placement
    plugin.

    This patch removes the incosistency by changing the code to use the
    positional arg.

    The change does not affect nova.scheduler.client.report._RE_INV_IN_USE
    regex usage as that regex applied via re.search() and this change only
    adds a new sentece to the message.

    Change-Id: I196c2e3dabcbf0564c1ca0bd4870dc2df3efc836
    Close-Bug: #1771325
    (cherry picked from commit 90d2dbedefbcc99a20a6a86888ef1d316d5d119f)
    (cherry picked from commit dddee4189c0789565d1bb0328ef03fab3fb6a45a)

tags: added: in-stable-pike
Revision history for this message
Elod Illes (elod-illes) wrote :

Fix released for stable/queens in 17.0.5

Chris Dent (cdent)
Changed in nova:
status: Confirmed → Fix Committed
Changed in nova:
status: Fix Committed → Fix Released
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.