api_version_request.matches does not accept a string or None

Bug #1550337 reported by Scott DAngelo
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
Scott DAngelo
OpenStack Compute (nova)
Fix Released
Undecided
Scott DAngelo
OpenStack Shared File Systems Service (Manila)
Fix Released
Medium
Tom Barron

Bug Description

According to the Cinder devref (https://github.com/openstack/cinder/blob/master/doc/source/devref/api_microversion_dev.rst)
you should be able to use the following pattern:

def index(self, req):
    <common code>

    req_version = req.api_version_request
    if req_version.matches("3.1", "3.5"):
        ....stuff....
    elif req_version.matches("3.6", "3.10"):
        ....other stuff....
    elif req_version > api_version_request.APIVersionRequest("3.10"):
        ....more stuff.....

    <common code>

However, the api_version_request.matches() function will not accept a string, it requires an api_version_request object.

Fix this to accept a string.

Changed in cinder:
assignee: nobody → Scott DAngelo (scott-dangelo)
Revision history for this message
Scott DAngelo (scott-dangelo) wrote :

I don't see this pattern used in Manila or Nova, but it won't work without a fix.

Changed in manila:
assignee: nobody → Scott DAngelo (scott-dangelo)
Changed in nova:
assignee: nobody → Scott DAngelo (scott-dangelo)
summary: - api_version_request.matches does not accept a string
+ api_version_request.matches does not accept a string or None
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/285409

Changed in nova:
status: New → In Progress
Revision history for this message
Scott DAngelo (scott-dangelo) wrote :

I've unit tests in the Cinder patch that use ddt:
https://review.openstack.org/#/c/285293

But for some reason the ddt.unpack does not work in Nova. I'll work on fixing this at some point.

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/285426

Changed in manila:
status: New → In Progress
Revision history for this message
Scott DAngelo (scott-dangelo) wrote :

Fix was proposed to Cinder, but it did not show up in Launchpad:
https://review.openstack.org/#/c/285293/4

Changed in cinder:
status: New → In Progress
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/287194

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

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

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

Change abandoned by Scott DAngelo (<email address hidden>) on branch: master
Review: https://review.openstack.org/287194
Reason: I failed to re-use the commit ID. This is replaced with https://review.openstack.org/#/c/287202/

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

Reviewed: https://review.openstack.org/287202
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=3f046e209ffd5729b73dd97a91a5b6cbcdc47ecb
Submitter: Jenkins
Branch: master

commit 3f046e209ffd5729b73dd97a91a5b6cbcdc47ecb
Author: scottda <email address hidden>
Date: Wed Mar 2 06:55:39 2016 -0700

    Api_version_request.matches does not accept a string or None

    According to the Cinder devref:
    https://github.com/openstack/cinder/blob/master/doc/source/devref/api_microversion_dev.rst)
    you should be able to use the following pattern:

    def index(self, req):
    <common code>

    req_version = req.api_version_request
    if req_version.matches("3.1", "3.5"):
        ....stuff....
    elif req_version.matches("3.6", "3.10"):
        ....other stuff....
    elif req_version > api_version_request.APIVersionRequest("3.10"):
        ....more stuff.....

    <common code>

    However, the api_version_request.matches() function will not accept a
    string, it requires an api_version_request object.
    This changes the doc to implement an api_version_request object to use
    this pattern.

    Closes-Bug: #1550337
    Change-Id: I14a943b21e9e98dd848c0c292ca1a1ae941cb98b

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/nova 13.0.0.0b3

This issue was fixed in the openstack/nova 13.0.0.0b3 development milestone.

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

Change abandoned by Scott DAngelo (<email address hidden>) on branch: master
Review: https://review.openstack.org/285409
Reason: Replaced with: https://review.openstack.org/287202 which has merged.

Changed in manila:
importance: Undecided → Medium
milestone: none → mitaka-rc1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/285293
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=72876024648052b25aac036add8c5feb2440e10f
Submitter: Jenkins
Branch: master

commit 72876024648052b25aac036add8c5feb2440e10f
Author: scottda <email address hidden>
Date: Fri Feb 26 06:17:08 2016 -0700

    Allow api_version_request.matches to accept a string

    According to the Cinder devref you should be able to use the following
    pattern:

        if req_version.matches("3.1", "3.5"):
            ....stuff....
        elif req_version.matches("3.6", "3.10"):
            ....other stuff....
        elif req_version > api_version_request.APIVersionRequest("3.10"):
            ....more stuff.....

    However, the api_version_request.matches() function will not accept a
    string, it requires an api_version_request object.

    Fix this to accept a string, as well as None for object.

    Closes-Bug: 1550337
    Change-Id: Ic90f4a13cfad601a181fd3a91684ecbb2b2fba74

Changed in cinder:
status: In Progress → Fix Released
Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/cinder 8.0.0.0rc1

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

Changed in manila:
milestone: mitaka-rc1 → newton-1
Changed in manila:
assignee: Scott DAngelo (scott-dangelo) → Tom Barron (tpb)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to manila (master)

Reviewed: https://review.openstack.org/285426
Committed: https://git.openstack.org/cgit/openstack/manila/commit/?id=29b8358ef56160b2845d6ce6f5fd46695617bf7e
Submitter: Zuul
Branch: master

commit 29b8358ef56160b2845d6ce6f5fd46695617bf7e
Author: scottda <email address hidden>
Date: Fri Feb 26 09:49:28 2016 -0700

    Allow api_version_request.matches to accept a string or None

    According to the Manila devref you should be able to use the following
    pattern:

    if req_version.matches("2.1", "2.5"):
        ....stuff....
    elif req_version.matches("2.6", "2.10"):
        ....other stuff....
    elif req_version > api_version_request.APIVersionRequest("2.10"):
        ....more stuff.....

    However, the api_version_request.matches() function will not accept a
    string, it requires an api_version_request object.

    Fix this to accept a string, as well as None for object.

    Change-Id: Ic2faaaa7696cc7a647679cbb7a8600b30c3d66d7
    Closes-Bug: 1550337

Changed in manila:
status: In Progress → Fix Released
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/577806

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

Reviewed: https://review.openstack.org/577806
Committed: https://git.openstack.org/cgit/openstack/manila/commit/?id=93b48681a341ce674bbae6f7784d92db05d5da5b
Submitter: Zuul
Branch: stable/queens

commit 93b48681a341ce674bbae6f7784d92db05d5da5b
Author: scottda <email address hidden>
Date: Fri Feb 26 09:49:28 2016 -0700

    Allow api_version_request.matches to accept a string or None

    According to the Manila devref you should be able to use the following
    pattern:

    if req_version.matches("2.1", "2.5"):
        ....stuff....
    elif req_version.matches("2.6", "2.10"):
        ....other stuff....
    elif req_version > api_version_request.APIVersionRequest("2.10"):
        ....more stuff.....

    However, the api_version_request.matches() function will not accept a
    string, it requires an api_version_request object.

    Fix this to accept a string, as well as None for object.

    Change-Id: Ic2faaaa7696cc7a647679cbb7a8600b30c3d66d7
    Closes-Bug: 1550337
    (cherry picked from commit 29b8358ef56160b2845d6ce6f5fd46695617bf7e)

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

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

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

This issue was fixed in the openstack/manila 7.0.0.0b3 development milestone.

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.