Incorrect concatenation in the version discovery

Bug #1816793 reported by s10
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
zhurong
Ocata
New
Undecided
Unassigned
Pike
New
Undecided
Unassigned
Queens
Fix Committed
Undecided
s10
Rocky
Fix Committed
Undecided
s10

Bug Description

urllib.parse.urljoin in Cinder version discovery generates wrong version URLs.

How to reproduce:
1. Start Cinder API behind the proxy, pass headers X-Forwarded-For, X-Forwarded-Proto, X-Forwarded-Prefix (/volume)
2. Enable proxy headers parsing in the http_proxy_to_wsgi middleware:
[oslo_middleware]
enable_proxy_headers_parsing=True

Expected result
===============
https://api.example.com/volume/v3/ in the version discovery responses.

Actual result
=============
$ curl https://api.example.com/volume
{"versions": [{"status": "DEPRECATED", "updated": "2017-02-25T12:00:00Z", "links": [{"href": "https://docs.openstack.org/", "type": "text/html", "rel": "describedby"}, {"href": "https://api.example.com/v2/", "rel": "self"}], "min_version": "", "version": "", "media-types": [{"base": "application/json", "type": "application/vnd.openstack.volume+json;version=2"}], "id": "v2.0"}, {"status": "CURRENT", "updated": "2017-09-19T20:18:14Z", "links": [{"href": "https://docs.openstack.org/", "type": "text/html", "rel": "describedby"}, {"href": "https://api.example.com/v3/", "rel": "self"}], "min_version": "3.0", "version": "3.50", "media-types": [{"base": "application/json", "type": "application/vnd.openstack.volume+json;version=3"}], "id": "v3.0"}]}

Environment
===========
OpenStack Pike (at least), Queens, Rocky.

Changed in cinder:
status: New → Confirmed
milestone: none → stein-3
Changed in cinder:
assignee: nobody → Sean McGinnis (sean-mcginnis)
status: Confirmed → In Progress
Changed in cinder:
assignee: Sean McGinnis (sean-mcginnis) → zhurong (zhu-rong)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/630085
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=175aaa879d8b940d800e1b96e8871bd350798038
Submitter: Zuul
Branch: master

commit 175aaa879d8b940d800e1b96e8871bd350798038
Author: zhurong <email address hidden>
Date: Fri Jan 11 16:30:01 2019 +0800

    Fix version return incorrect when endpoint url end without /

    when request to cinder endpoint url end without /
    $ curl http://127.0.0.1/volume
    the version herf return incorrect, like below:
    "href": "http://127.0.0.1/v2/"
    "href": "http://127.0.0.1/v3/"
    This patch will always add a '/' to the endpoint url end.

    Closes-bug: #1816793
    Change-Id: I6b0f47fc5b11c44a767e0ebfe2929e560c5f5432

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

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

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

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

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

Reviewed: https://review.openstack.org/638387
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=48d188c78af52696b90fb9e90d823b56e7429ab3
Submitter: Zuul
Branch: stable/rocky

commit 48d188c78af52696b90fb9e90d823b56e7429ab3
Author: zhurong <email address hidden>
Date: Fri Jan 11 16:30:01 2019 +0800

    Fix version return incorrect when endpoint url end without /

    when request to cinder endpoint url end without /
    $ curl http://127.0.0.1/volume
    the version href return incorrect, like below:
    "href": "http://127.0.0.1/v2/"
    "href": "http://127.0.0.1/v3/"
    This patch will always add a '/' to the endpoint url end.

    Closes-bug: #1816793
    Change-Id: I6b0f47fc5b11c44a767e0ebfe2929e560c5f5432
    (cherry picked from commit 175aaa879d8b940d800e1b96e8871bd350798038)

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

Reviewed: https://review.openstack.org/638389
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=309f72202d0c76b7b4be3ca96327a8b784a1bc69
Submitter: Zuul
Branch: stable/queens

commit 309f72202d0c76b7b4be3ca96327a8b784a1bc69
Author: zhurong <email address hidden>
Date: Fri Jan 11 16:30:01 2019 +0800

    Fix version return incorrect when endpoint url end without /

    when request to cinder endpoint url end without /
    $ curl http://127.0.0.1/volume
    the version href return incorrect, like below:
    "href": "http://127.0.0.1/v2/"
    "href": "http://127.0.0.1/v3/"
    This patch will always add a '/' to the endpoint url end.

    Closes-bug: #1816793
    Change-Id: I6b0f47fc5b11c44a767e0ebfe2929e560c5f5432
    (cherry picked from commit 175aaa879d8b940d800e1b96e8871bd350798038)

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

This issue was fixed in the openstack/cinder 14.0.0.0rc1 release candidate.

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

This issue was fixed in the openstack/cinder 13.0.4 release.

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

This issue was fixed in the openstack/cinder 12.0.6 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers