Problem using version specific endpoints when deploying with uWSGI

Bug #1818081 reported by Victoria Martinez de la Cruz
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Shared File Systems Service (Manila)
Fix Released
High
Goutham Pacha Ravi

Bug Description

When deploying with uWSGI, there is a problem using version specific endpoints, i.e, http://10.10.10.6/share/v1/ and http://10.10.10.6/share/v2/. Both of these are resolving to http://10.10.10.6/share/v2/.

Changed in manila:
status: New → Confirmed
assignee: nobody → Victoria Martinez de la Cruz (vkmc)
status: Confirmed → New
Jason Grosso (jgrosso)
Changed in manila:
importance: Undecided → High
Changed in manila:
assignee: Victoria Martinez de la Cruz (vkmc) → Goutham Pacha Ravi (gouthamr)
status: New → In Progress
Revision history for this message
Goutham Pacha Ravi (gouthamr) wrote :

Fix proposed to master:

 Fix version selector when for proxy-style URLs
 https://review.openstack.org/#/c/639805/

Changed in manila:
milestone: none → stein-3
tags: added: backport-potential
Changed in manila:
assignee: Goutham Pacha Ravi (gouthamr) → Tom Barron (tpb)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to manila (master)

Reviewed: https://review.openstack.org/639805
Committed: https://git.openstack.org/cgit/openstack/manila/commit/?id=0d8310ec7a169f6de113080c0cb335247805ee29
Submitter: Zuul
Branch: master

commit 0d8310ec7a169f6de113080c0cb335247805ee29
Author: Goutham Pacha Ravi <email address hidden>
Date: Wed Feb 27 11:58:58 2019 -0800

    Fix version selector when for proxy-style URLs

    When manila API is served behind a proxy, the
    "script_name" in the request can have the proxy
    component in it. So, this patch fixes the version
    selection logic by looking for the version in the
    script name string instead of equivalence.

    In addition, this patch adds some missing unit
    tests and fixes tests that invoke a mocked
    wsgi app for testing request context.

    Change-Id: I0363d7174f3d7ddefa8ced59b182faed665e9c36
    Partial-Bug: #1815038
    Closes-Bug: #1818081

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

Fix proposed to branch: stable/rocky
Review: https://review.openstack.org/642820

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

The fix https://review.openstack.org/639805 fixes the /v1/ endpoint from
returning the right "API versions" information. However, version discovery
with the root endpoint (/) is still broken, ex:

  $ curl -i -X GET http://10.10.10.10/share/

  HTTP/1.1 300 Multiple Choices
  Date: Wed, 13 Mar 2019 23:45:25 GMT
  Server: Apache/2.4.29 (Ubuntu)
  Content-Type: application/json
  Content-Length: 748
  X-OpenStack-Manila-API-Version: 2.0
  Vary: X-OpenStack-Manila-API-Version
  Connection: close

  {"versions": [{"status": "DEPRECATED", "updated": "2015-08-27T11:33:21Z", "links": [{"href": "http://docs.openstack.org/", "type": "text/html", "rel": "describedby"}, {"href": "http://10.10.10.10/share/v1/", "rel": "self"}], "min_version": "", "version": "", "media-types": [{"base": "application/json", "type": "application/vnd.openstack.share+json;version=1"}], "id": "v1.0"}, {"status": "CURRENT", "updated": "2015-08-27T11:33:21Z", "links": [{"href": "http://docs.openstack.org/", "type": "text/html", "rel": "describedby"}, {"href": "http://10.10.10.10/share/v2/", "rel": "self"}], "min_version": "2.0", "version": "2.49", "media-types": [{"base": "application/json", "type": "application/vnd.openstack.share+json;version=1"}], "id": "v2.0"}]}

Notice that I did not request the API version 2.0 (X-OpenStack-Manila-API-Version), but the server returns the header "X-OpenStack-Manila-API-Version" set to 2.0. This is wrong, and does not occur with manila configured without a reverse proxy:

  $ curl -i -X GET http://10.10.10.10:8786/
  HTTP/1.1 300 Multiple Choices
  Date: Wed, 13 Mar 2019 23:46:55 GMT
  Server: Apache/2.4.29 (Ubuntu)
  Content-Length: 746
  Connection: close
  Content-Type: application/json

  {"versions": [{"status": "DEPRECATED", "updated": "2015-08-27T11:33:21Z", "links": [{"href": "http://docs.openstack.org/", "type": "text/html", "rel": "describedby"}, {"href": "http://10.10.10.10:8786/v1/", "rel": "self"}], "min_version": "", "version": "", "media-types": [{"base": "application/json", "type": "application/vnd.openstack.share+json;version=1"}], "id": "v1.0"}, {"status": "CURRENT", "updated": "2015-08-27T11:33:21Z", "links": [{"href": "http://docs.openstack.org/", "type": "text/html", "rel": "describedby"}, {"href": "http://10.10.10.10:8786/v2/", "rel": "self"}], "min_version": "2.0", "version": "2.49", "media-types": [{"base": "application/json", "type": "application/vnd.openstack.share+json;version=1"}], "id": "v2.0"}]}

So I'm re-opening this bug.

Changed in manila:
status: Fix Released → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to manila (master)

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

Changed in manila:
assignee: Tom Barron (tpb) → Goutham Pacha Ravi (gouthamr)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to manila (master)

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

commit 4b0c953f7fe7afbbbece8db7edce8efe69fb4387
Author: Goutham Pacha Ravi <email address hidden>
Date: Wed Mar 13 16:50:27 2019 -0700

    Fix API version inferred w/ un-versioned URLs

    With [1], we fixed the issue with v1 API URLs when
    configuring manila with a reverse proxy, like uwsgi.
    However, the version discovery can be made against a
    "unversioned" URL, i.e, the "/" endpoint.

    Example version discovery target when there's no reverse
    proxy:

       curl -i -X GET www.openstack-overcloud.com:8786/

    Example version discovery target when manila is configured
    with a web proxy:

       curl -i -X GET www.openstack-overcloud.com/shared-file-system/

    Currently, the API assumes that a v2 endpoint is requested
    and hence sets a default API version in the request, which
    results in the wrong headers communicated to the client.

    Fix this issue. The release note added with [1] should
    suffice for this fix.

    [1] I0363d7174f3d7ddefa8ced59b182faed665e9c36
    Change-Id: I50d1024ee8485b8290c24fa850e60755b518fff3
    Closes-Bug: #1818081

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

Fix proposed to branch: stable/rocky
Review: https://review.openstack.org/643431

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

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

commit 6b39562c0e0fc44b8f939efb523b2c976c0b210f
Author: Goutham Pacha Ravi <email address hidden>
Date: Wed Feb 27 11:58:58 2019 -0800

    Fix version selector when for proxy-style URLs

    When manila API is served behind a proxy, the
    "script_name" in the request can have the proxy
    component in it. So, this patch fixes the version
    selection logic by looking for the version in the
    script name string instead of equivalence.

    In addition, this patch adds some missing unit
    tests and fixes tests that invoke a mocked
    wsgi app for testing request context.

    Change-Id: I0363d7174f3d7ddefa8ced59b182faed665e9c36
    Partial-Bug: #1815038
    Closes-Bug: #1818081
    (cherry picked from commit 0d8310ec7a169f6de113080c0cb335247805ee29)

tags: added: in-stable-rocky
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

commit 5a3be01535d3902e1ee21ca070d4918adefc2018
Author: Goutham Pacha Ravi <email address hidden>
Date: Wed Mar 13 16:50:27 2019 -0700

    Fix API version inferred w/ un-versioned URLs

    With [1], we fixed the issue with v1 API URLs when
    configuring manila with a reverse proxy, like uwsgi.
    However, the version discovery can be made against a
    "unversioned" URL, i.e, the "/" endpoint.

    Example version discovery target when there's no reverse
    proxy:

       curl -i -X GET www.openstack-overcloud.com:8786/

    Example version discovery target when manila is configured
    with a web proxy:

       curl -i -X GET www.openstack-overcloud.com/shared-file-system/

    Currently, the API assumes that a v2 endpoint is requested
    and hence sets a default API version in the request, which
    results in the wrong headers communicated to the client.

    Fix this issue. The release note added with [1] should
    suffice for this fix.

    [1] I0363d7174f3d7ddefa8ced59b182faed665e9c36
    Change-Id: I50d1024ee8485b8290c24fa850e60755b518fff3
    Closes-Bug: #1818081
    (Cherry-picked from commit 4b0c953f7fe7afbbbece8db7edce8efe69fb4387)

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

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

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

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

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

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

commit 587a1b2ad31934258f252c74ec1df7e202342ed3
Author: Goutham Pacha Ravi <email address hidden>
Date: Wed Feb 27 11:58:58 2019 -0800

    Fix version selector when for proxy-style URLs

    When manila API is served behind a proxy, the
    "script_name" in the request can have the proxy
    component in it. So, this patch fixes the version
    selection logic by looking for the version in the
    script name string instead of equivalence.

    In addition, this patch adds some missing unit
    tests and fixes tests that invoke a mocked
    wsgi app for testing request context.

    Change-Id: I0363d7174f3d7ddefa8ced59b182faed665e9c36
    Partial-Bug: #1815038
    Closes-Bug: #1818081
    (cherry picked from commit 0d8310ec7a169f6de113080c0cb335247805ee29)
    (cherry picked from commit 6b39562c0e0fc44b8f939efb523b2c976c0b210f)

tags: added: in-stable-queens
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

commit 07c4809940406edab9e4412b63a45ef4468bda84
Author: Goutham Pacha Ravi <email address hidden>
Date: Wed Mar 13 16:50:27 2019 -0700

    Fix API version inferred w/ un-versioned URLs

    With [1], we fixed the issue with v1 API URLs when
    configuring manila with a reverse proxy, like uwsgi.
    However, the version discovery can be made against a
    "unversioned" URL, i.e, the "/" endpoint.

    Example version discovery target when there's no reverse
    proxy:

       curl -i -X GET www.openstack-overcloud.com:8786/

    Example version discovery target when manila is configured
    with a web proxy:

       curl -i -X GET www.openstack-overcloud.com/shared-file-system/

    Currently, the API assumes that a v2 endpoint is requested
    and hence sets a default API version in the request, which
    results in the wrong headers communicated to the client.

    Fix this issue. The release note added with [1] should
    suffice for this fix.

    [1] I0363d7174f3d7ddefa8ced59b182faed665e9c36
    Change-Id: I50d1024ee8485b8290c24fa850e60755b518fff3
    Closes-Bug: #1818081
    (Cherry-picked from commit 5a3be01535d3902e1ee21ca070d4918adefc2018)
    (Cherry-picked from commit 4b0c953f7fe7afbbbece8db7edce8efe69fb4387)

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

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

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

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

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

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