API is not reachable if manila is deployed with uWSGI and mounted in /share

Bug #1815038 reported by Victoria Martinez de la Cruz on 2019-02-07
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Manila
Medium
Goutham Pacha Ravi

Bug Description

As part of the effort of deploying manila in devstack by default with uWSGI, it was noticed that URLs with the form HOSTNAME[:PORT]/share/VERSION are not being correctly resolved properly. We need to extend the method remove_version_from_href in api/common to consider this format as valid.

Excerpt from gate log:

Feb 06 19:22:05.693033 ubuntu-bionic-rax-dfw-0002413398 <email address hidden>[8827]: ERROR manila.api.middleware.fault File "/opt/stack/new/manila/manila/api/common.py", line 213, in _get_bookmark_link
Feb 06 19:22:05.693033 ubuntu-bionic-rax-dfw-0002413398 <email address hidden>[8827]: ERROR manila.api.middleware.fault base_url = remove_version_from_href(request.application_url)
Feb 06 19:22:05.693033 ubuntu-bionic-rax-dfw-0002413398 <email address hidden>[8827]: ERROR manila.api.middleware.fault File "/opt/stack/new/manila/manila/api/common.py", line 162, in remove_version_from_href
Feb 06 19:22:05.693033 ubuntu-bionic-rax-dfw-0002413398 <email address hidden>[8827]: ERROR manila.api.middleware.fault raise ValueError(msg)
Feb 06 19:22:05.693033 ubuntu-bionic-rax-dfw-0002413398 <email address hidden>[8827]: ERROR manila.api.middleware.fault ValueError: href http://104.130.127.170/share/v2 does not contain version
Feb 06 19:22:05.693033 ubuntu-bionic-rax-dfw-0002413398 <email address hidden>[8827]: ERROR manila.api.middleware.fault
Feb 06 19:22:05.744883 ubuntu-bionic-rax-dfw-0002413398 <email address hidden>[8827]: ERROR manila.db.sqlalchemy.api [None req-f3115133-bd59-4e35-b4c7-3ee12518312e None None] ShareType a4d8f5d6-cf68-4b62-be46-8c0ecbd6140b deletion failed, ShareType in use.
Feb 06 19:22:06.087746 ubuntu-bionic-rax-dfw-0002413398 <email address hidden>[8827]: ERROR manila.api.v2.share_networks [None req-2e9f82c9-2896-43fb-a671-fba30a671672 None None] Can not delete share network d38b6818-a98c-4f3b-82cc-201a392142b4, it has 1 share(s).

Changed in manila:
assignee: nobody → Victoria Martinez de la Cruz (vkmc)

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

Changed in manila:
status: New → In Progress

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

Changed in manila:
assignee: Victoria Martinez de la Cruz (vkmc) → Goutham Pacha Ravi (gouthamr)
Changed in manila:
assignee: Goutham Pacha Ravi (gouthamr) → Victoria Martinez de la Cruz (vkmc)

Reviewed: https://review.openstack.org/637057
Committed: https://git.openstack.org/cgit/openstack/manila-tempest-plugin/commit/?id=50a6760a64bc67ad6875db1496c501ed77b55b4e
Submitter: Zuul
Branch: master

commit 50a6760a64bc67ad6875db1496c501ed77b55b4e
Author: Goutham Pacha Ravi <email address hidden>
Date: Thu Feb 14 13:35:52 2019 -0800

    Fix microversion request URL

    The code in the client assumes that we're hitting the
    base URL. However, the manila endpoint URL isn't always
    of the format HOST[:PORT]/VERSION/xyzzy. It's possible
    that the endpoint URL pertains to a proxy configuration
    which is of the format
    HOST/PROXY/ENDPOINT/FOR/MANILA/VERSION/xyzzy.

    This patch also adds logging to the microversion
    request since we're using tempest's "raw_request"
    which doesn't do logging for us.

    Change-Id: I50906ec245b965faaba630fa4d01a8137d4bc3d5
    Partial-Bug: #1815038

Changed in manila:
importance: Undecided → Medium
status: In Progress → Fix Committed
milestone: none → stein-3
status: Fix Committed → In Progress

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

Changed in manila:
assignee: Victoria Martinez de la Cruz (vkmc) → Goutham Pacha Ravi (gouthamr)

Change abandoned by Goutham Pacha Ravi (<email address hidden>) on branch: master
Review: https://review.openstack.org/639805
Reason: This is bound to fail, so will propose an alternative fix

Reviewed: https://review.openstack.org/635502
Committed: https://git.openstack.org/cgit/openstack/manila/commit/?id=6d970b7375689eb73fc6a26ceb1c4d6e5553fa70
Submitter: Zuul
Branch: master

commit 6d970b7375689eb73fc6a26ceb1c4d6e5553fa70
Author: Victoria Martinez de la Cruz <email address hidden>
Date: Thu Feb 7 12:56:42 2019 +0000

    Extend remove_version_from_href support

    Improve remove_version_from_href so that it supports URLs for which
    the version does not directly trail the hostname

    Given: 'http://manila.example.com/share/v1.1/123'
    Returns: 'http://manila.example.com/share/123'

    Based on I8ccc449116ff164aacc0aefca3a0ec2ac8f73aa8

    Change-Id: I13010d3ee0a83a67204145837503abe7126263cd
    Closes-Bug: #1815038

Changed in manila:
status: In Progress → Fix Released

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

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

Reviewed: https://review.openstack.org/642822
Committed: https://git.openstack.org/cgit/openstack/manila/commit/?id=670449f3e1213018f076e461aa659de5fb94c8bb
Submitter: Zuul
Branch: stable/rocky

commit 670449f3e1213018f076e461aa659de5fb94c8bb
Author: Victoria Martinez de la Cruz <email address hidden>
Date: Thu Feb 7 12:56:42 2019 +0000

    Extend remove_version_from_href support

    Improve remove_version_from_href so that it supports URLs for which
    the version does not directly trail the hostname

    Given: 'http://manila.example.com/share/v1.1/123'
    Returns: 'http://manila.example.com/share/123'

    Based on I8ccc449116ff164aacc0aefca3a0ec2ac8f73aa8

    Change-Id: I13010d3ee0a83a67204145837503abe7126263cd
    Closes-Bug: #1815038
    (cherry picked from commit 6d970b7375689eb73fc6a26ceb1c4d6e5553fa70)

tags: added: in-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)

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

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

Reviewed: https://review.openstack.org/643764
Committed: https://git.openstack.org/cgit/openstack/manila/commit/?id=4bfff6055b8b3afef61a2ac818b4f4e60a54a5c9
Submitter: Zuul
Branch: stable/queens

commit 4bfff6055b8b3afef61a2ac818b4f4e60a54a5c9
Author: Victoria Martinez de la Cruz <email address hidden>
Date: Thu Feb 7 12:56:42 2019 +0000

    Extend remove_version_from_href support

    Improve remove_version_from_href so that it supports URLs for which
    the version does not directly trail the hostname

    Given: 'http://manila.example.com/share/v1.1/123'
    Returns: 'http://manila.example.com/share/123'

    Based on I8ccc449116ff164aacc0aefca3a0ec2ac8f73aa8

    Change-Id: I13010d3ee0a83a67204145837503abe7126263cd
    Closes-Bug: #1815038
    (cherry picked from commit 6d970b7375689eb73fc6a26ceb1c4d6e5553fa70)
    (cherry picked from commit 670449f3e1213018f076e461aa659de5fb94c8bb)

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

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

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  Edit
Everyone can see this information.

Other bug subscribers