novaclient endpoints command doesn't filter regions

Bug #1256009 reported by Phil Day
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
python-novaclient
Fix Released
Low
Laurens Van Houtven

Bug Description

nova client uses OS_REGION_NAME to select which endpoint to use from the service catalogue, but doesn't use this when filtering results in the endpoint command. Instead it always just prints the first region for each endpoint

https://github.com/openstack/python-novaclient/blob/master/novaclient/v1_1/shell.py#L2976-L2977

  for e in catalog['access']['serviceCatalog']:
        utils.print_dict(e['endpoints'][0], e['name'])

should be something like:

    for e in catalog['access']['serviceCatalog']:
        for endpoint in e['endpoints']:
            if (not cs.client.region_name or
                endpoint['region'] == cs.client.region_name):
                    utils.print_dict(endpoint, e['name'])

Changed in python-novaclient:
assignee: nobody → anusha rayani (anusha-rayani-7)
Changed in python-novaclient:
importance: Undecided → Low
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-novaclient (master)

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

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

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

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

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

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

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

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

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

Joe Gordon (jogo)
Changed in python-novaclient:
status: In Progress → Won't Fix
status: Won't Fix → New
assignee: anusha rayani (anusha-rayani-7) → nobody
Changed in python-novaclient:
assignee: nobody → Laurens Van Houtven (lvh)
Revision history for this message
Laurens Van Houtven (lvh) wrote :

Hi! New to novaclient. Why does exactly the same code live in the shell modules of the v1_1 and v3 packages? It seems like there's lots of duplication there, notably I seem to have to fix this issue in two different places.

Revision history for this message
melanie witt (melwitt) wrote :

Hi Laurens, welcome to novaclient. The reason for the code duplication you notice is that there are two versions of the nova api active: v2.0 and v3, represented as v1_1 and v3 in the novaclient code. You can see similar duplication on the server side:

v2: https://github.com/openstack/nova/tree/master/nova/api/openstack/compute/contrib
v3: https://github.com/openstack/nova/tree/master/nova/api/openstack/compute/plugins/v3

You are right that you should fix things for both versions. If you do some openstack-dev mailing list archive searches, you can find discussions on the code duplication.

Changed in python-novaclient:
status: New → Confirmed
Revision history for this message
Laurens Van Houtven (lvh) wrote :

Thanks Melanie! That's what I gathered from the code around me, so that's what I did: but for some reason hudson-openstack isn't adding my Gerrit patch (which has received good reviews but apparently not enough to get merged): https://review.openstack.org/#/c/98718/

Revision history for this message
melanie witt (melwitt) wrote :

Hi Laurens, the reason your patch isn't linking to this bug is because you need to add a notation to your commit message in gerrit so it can link it:

Closes-Bug: #1256009

See doc at:

https://wiki.openstack.org/wiki/GitCommitMessages#Summary_of_GIT_commit_message_structure

Revision history for this message
Laurens Van Houtven (lvh) wrote :

Ah! Thanks :) Should I still do that now, or will that get rid of the current reviews?

Changed in python-novaclient:
status: Confirmed → In Progress
Revision history for this message
Laurens Van Houtven (lvh) wrote :

Looks like I'll have to do that anyway to make Jenkins happy :)

Revision history for this message
Michael Still (mikal) wrote :

The review for this bug is https://review.openstack.org/#/c/98718/

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

Reviewed: https://review.openstack.org/98718
Committed: https://git.openstack.org/cgit/openstack/python-novaclient/commit/?id=6ee0b28e64b55a5d2a83a2cfe6be72e2c072f1c0
Submitter: Jenkins
Branch: master

commit 6ee0b28e64b55a5d2a83a2cfe6be72e2c072f1c0
Author: Laurens Van Houtven <email address hidden>
Date: Mon Jun 9 11:12:15 2014 +0200

    Filter endpoints by region whenever possible

    Previously, the endpoints command just returned the first endpoint. This
    was not very useful; people expected to see the endpoints in the region
    they specified. This patch does the following:

    - If there's only one endpoint, use that.
    - If there's a specific one for your region, use that.
    - If there isn't, warn, and show the other ones.

    Closes-Bug: #1256009
    Change-Id: I70b82bdffb9b2e3da415a3bb941bcff287e39789

Changed in python-novaclient:
status: In Progress → Fix Committed
Michael Still (mikal)
Changed in python-novaclient:
milestone: none → 2.19.0
status: Fix Committed → Fix Released
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.