HTTP 500 raised by POST /shares API when failing to handle "share_type" in request

Bug #1944478 reported by Goutham Pacha Ravi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Shared File Systems Service (Manila)
Fix Released
Low
melaku alehegn

Bug Description

Description
===========

The POST /shares API [1] does not validate the "share_type" as expected. If the request contains an object instead of a string, HTTP 500 is raised due to a DB lookup error:

Example Request:

        POST https://shared-file-systems.com/share/v2/shares
        Body: {"share": {"share_proto": "cephfs", "description": "share-desc-1579612894", "snapshot_id": null, "name": "share-1663895707", "size": 1, "metadata": {}, "is_public": false, "share_type": {"id": "9b158411-67de-4a90-9b10-92f545d4967f", "name": "type-1726987944", "extra_specs": {"driver_handles_share_servers": "False"}, "required_extra_specs": {"driver_handles_share_servers": false}, "share_type_access:is_public": true, "description": null, "is_default": false}}}

Log from the failure: https://paste.opendev.org/show/809481/

Steps to reproduce
==================

A chronological list of steps which will help reproduce the issue you hit:

* curl -i -X POST $MANILA_ENDPOINT -H "X-Auth-Token: $TOKEN" -H "Accept: application/json" -H "Content-Type: application/json" -d '{"share": {"size": 1, "share_proto": "nfs", "share_type": {"id": "9b158411-67de-4a90-9b10-92f545d4967f", "name": "type-1726987944", "extra_specs": {"driver_handles_share_servers": "False"}, "required_extra_specs": {"driver_handles_share_servers": false}, "share_type_access:is_public": true, "description": null, "is_default": false}}'

Expected result
===============

HTTP 400, BadRequest - the share_type parameter was badly formatted

Actual result
=============

HTTP 500, Internal Server Error

Environment
===========
1. dev branch of openstack/manila

[1] https://docs.openstack.org/api-ref/shared-file-system/?expanded=create-share-detail#create-share

tags: added: low-hanging-fruit
Vida Haririan (vhariria)
tags: added: api
Elena Lindqvist (eqvist)
Changed in manila:
assignee: nobody → Elena Lindqvist (eqvist)
Changed in manila:
assignee: Elena Lindqvist (eqvist) → nobody
Changed in manila:
assignee: nobody → Yuchen Zhang (yuchenz-ubuntu)
Changed in manila:
importance: Undecided → Low
Changed in manila:
assignee: Yuchen Zhang (yuchenz-ubuntu) → nobody
Changed in manila:
assignee: nobody → Goutham Pacha Ravi (gouthamr)
Changed in manila:
assignee: Goutham Pacha Ravi (gouthamr) → nobody
assignee: nobody → Shazia Parveen (sparveen)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to manila (master)

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

Changed in manila:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Changed in manila:
assignee: Shazia Parveen (sparveen) → nobody
status: In Progress → New
status: New → Confirmed
Changed in manila:
status: Confirmed → In Progress
Changed in manila:
status: In Progress → New
Revision history for this message
Clifford Emeka (emclidon) wrote :

Hi Goutham,

Is the bug still open so I can take it up?

Revision history for this message
Goutham Pacha Ravi (gouthamr) wrote :

> Hi Goutham,
> Is the bug still open so I can take it up?

Hey Clifford,

Yes it is. Bugs that have no asignee (see field "Assigned to") and the Status as "New" are open to claim. Thanks for asking.

Vida Haririan (vhariria)
Changed in manila:
status: New → Triaged
Changed in manila:
assignee: nobody → melaku alehegn (melakua)
milestone: none → caracal-1
Changed in manila:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to manila (master)

Reviewed: https://review.opendev.org/c/openstack/manila/+/899346
Committed: https://opendev.org/openstack/manila/commit/b24ef91f2c6e1e63c6bae8e52b778bba22ff15ff
Submitter: "Zuul (22348)"
Branch: master

commit b24ef91f2c6e1e63c6bae8e52b778bba22ff15ff
Author: melakualehegn <email address hidden>
Date: Thu Oct 26 03:11:03 2023 +0300

    Change status and error handling for /shares API

    This change modifies the status and error handling
    logic of the /shares API when it fails to handle
    the specified share_type in the request. The updated
    logic ensures that appropriate responses are
    generated to handle this scenario effectively.

    Closes-Bug: #1944478

    Change-Id: I8d4b30daae2fe8c88c30d93d402bf2e5a558f804

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

Fix proposed to branch: stable/2023.2
Review: https://review.opendev.org/c/openstack/manila/+/899333

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

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on manila (master)

Change abandoned by "Goutham Pacha Ravi <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/manila/+/858225
Reason: Fixed with https://review.opendev.org/c/openstack/manila/+/899346

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by "Goutham Pacha Ravi <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/manila/+/858214
Reason: Addressed with https://review.opendev.org/c/openstack/manila/+/899346

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by "Goutham Pacha Ravi <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/manila/+/858228
Reason: Addressed with https://review.opendev.org/c/openstack/manila/+/899346

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by "Goutham Pacha Ravi <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/manila/+/899521
Reason: Bad rebase

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

Reviewed: https://review.opendev.org/c/openstack/manila/+/899333
Committed: https://opendev.org/openstack/manila/commit/2aa760011d4dd1ea8f17dad9df94db4d4156692a
Submitter: "Zuul (22348)"
Branch: stable/2023.2

commit 2aa760011d4dd1ea8f17dad9df94db4d4156692a
Author: melakualehegn <email address hidden>
Date: Thu Oct 26 03:11:03 2023 +0300

    Change status and error handling for /shares API

    This change modifies the status and error handling
    logic of the /shares API when it fails to handle
    the specified share_type in the request. The updated
    logic ensures that appropriate responses are
    generated to handle this scenario effectively.

    Closes-Bug: #1944478

    Change-Id: I8d4b30daae2fe8c88c30d93d402bf2e5a558f804
    (cherry picked from commit b24ef91f2c6e1e63c6bae8e52b778bba22ff15ff)

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

Fix proposed to branch: stable/2023.1
Review: https://review.opendev.org/c/openstack/manila/+/905459

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

Reviewed: https://review.opendev.org/c/openstack/manila/+/905459
Committed: https://opendev.org/openstack/manila/commit/7918f1d4bb4a66497fc1c76085100dd7f5e82231
Submitter: "Zuul (22348)"
Branch: stable/2023.1

commit 7918f1d4bb4a66497fc1c76085100dd7f5e82231
Author: melakualehegn <email address hidden>
Date: Thu Oct 26 03:11:03 2023 +0300

    Change status and error handling for /shares API

    This change modifies the status and error handling
    logic of the /shares API when it fails to handle
    the specified share_type in the request. The updated
    logic ensures that appropriate responses are
    generated to handle this scenario effectively.

    Closes-Bug: #1944478

    Change-Id: I8d4b30daae2fe8c88c30d93d402bf2e5a558f804
    (cherry picked from commit b24ef91f2c6e1e63c6bae8e52b778bba22ff15ff)
    (cherry picked from commit 2aa760011d4dd1ea8f17dad9df94db4d4156692a)

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

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

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

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

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

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

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

Fix proposed to branch: stable/wallaby
Review: https://review.opendev.org/c/openstack/manila/+/905730

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

Reviewed: https://review.opendev.org/c/openstack/manila/+/905727
Committed: https://opendev.org/openstack/manila/commit/c0fc23a39f87629b59fae7bbf46f70e3e1b459cd
Submitter: "Zuul (22348)"
Branch: stable/zed

commit c0fc23a39f87629b59fae7bbf46f70e3e1b459cd
Author: melakualehegn <email address hidden>
Date: Thu Oct 26 03:11:03 2023 +0300

    Change status and error handling for /shares API

    This change modifies the status and error handling
    logic of the /shares API when it fails to handle
    the specified share_type in the request. The updated
    logic ensures that appropriate responses are
    generated to handle this scenario effectively.

    Closes-Bug: #1944478

    Change-Id: I8d4b30daae2fe8c88c30d93d402bf2e5a558f804
    (cherry picked from commit b24ef91f2c6e1e63c6bae8e52b778bba22ff15ff)
    (cherry picked from commit 2aa760011d4dd1ea8f17dad9df94db4d4156692a)
    (cherry picked from commit 7918f1d4bb4a66497fc1c76085100dd7f5e82231)

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

Reviewed: https://review.opendev.org/c/openstack/manila/+/905728
Committed: https://opendev.org/openstack/manila/commit/84111ad7cb4496d1083703fba8f0e55002347363
Submitter: "Zuul (22348)"
Branch: stable/yoga

commit 84111ad7cb4496d1083703fba8f0e55002347363
Author: melakualehegn <email address hidden>
Date: Thu Oct 26 03:11:03 2023 +0300

    Change status and error handling for /shares API

    This change modifies the status and error handling
    logic of the /shares API when it fails to handle
    the specified share_type in the request. The updated
    logic ensures that appropriate responses are
    generated to handle this scenario effectively.

    Closes-Bug: #1944478

    Change-Id: I8d4b30daae2fe8c88c30d93d402bf2e5a558f804
    (cherry picked from commit b24ef91f2c6e1e63c6bae8e52b778bba22ff15ff)
    (cherry picked from commit 2aa760011d4dd1ea8f17dad9df94db4d4156692a)
    (cherry picked from commit 7918f1d4bb4a66497fc1c76085100dd7f5e82231)
    (cherry picked from commit c0fc23a39f87629b59fae7bbf46f70e3e1b459cd)

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

Reviewed: https://review.opendev.org/c/openstack/manila/+/905729
Committed: https://opendev.org/openstack/manila/commit/ede80c4f365072d53a82ef3f4840cc57a663732d
Submitter: "Zuul (22348)"
Branch: stable/xena

commit ede80c4f365072d53a82ef3f4840cc57a663732d
Author: melakualehegn <email address hidden>
Date: Thu Oct 26 03:11:03 2023 +0300

    Change status and error handling for /shares API

    This change modifies the status and error handling
    logic of the /shares API when it fails to handle
    the specified share_type in the request. The updated
    logic ensures that appropriate responses are
    generated to handle this scenario effectively.

    Closes-Bug: #1944478

    Change-Id: I8d4b30daae2fe8c88c30d93d402bf2e5a558f804
    (cherry picked from commit b24ef91f2c6e1e63c6bae8e52b778bba22ff15ff)
    (cherry picked from commit 2aa760011d4dd1ea8f17dad9df94db4d4156692a)
    (cherry picked from commit 7918f1d4bb4a66497fc1c76085100dd7f5e82231)
    (cherry picked from commit c0fc23a39f87629b59fae7bbf46f70e3e1b459cd)
    (cherry picked from commit 84111ad7cb4496d1083703fba8f0e55002347363)

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

Reviewed: https://review.opendev.org/c/openstack/manila/+/905730
Committed: https://opendev.org/openstack/manila/commit/fb6e28140164b771f3ec3fdb723f2a63988fb6c5
Submitter: "Zuul (22348)"
Branch: stable/wallaby

commit fb6e28140164b771f3ec3fdb723f2a63988fb6c5
Author: melakualehegn <email address hidden>
Date: Thu Oct 26 03:11:03 2023 +0300

    Change status and error handling for /shares API

    This change modifies the status and error handling
    logic of the /shares API when it fails to handle
    the specified share_type in the request. The updated
    logic ensures that appropriate responses are
    generated to handle this scenario effectively.

    Closes-Bug: #1944478

    Change-Id: I8d4b30daae2fe8c88c30d93d402bf2e5a558f804
    (cherry picked from commit b24ef91f2c6e1e63c6bae8e52b778bba22ff15ff)
    (cherry picked from commit 2aa760011d4dd1ea8f17dad9df94db4d4156692a)
    (cherry picked from commit 7918f1d4bb4a66497fc1c76085100dd7f5e82231)
    (cherry picked from commit c0fc23a39f87629b59fae7bbf46f70e3e1b459cd)
    (cherry picked from commit 84111ad7cb4496d1083703fba8f0e55002347363)
    (cherry picked from commit ede80c4f365072d53a82ef3f4840cc57a663732d)

tags: added: in-stable-wallaby
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/manila 17.2.0

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

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

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

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

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

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

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

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

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

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

This issue was fixed in the openstack/manila xena-eom release.

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

This issue was fixed in the openstack/manila 18.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.