region_name specified when instantiating HTTPClient is ignored

Bug #1147530 reported by Lin Hua Cheng
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
High
Bartosz Górski
python-keystoneclient
Fix Released
Medium
Jamie Lennox

Bug Description

The region_name attribute on instances of HTTPClient is described in the class docstring as "Name of a region to select when choosing an endpoint from the service catalog". However, the attribute is not used in any way.

The constructors of AccessInfoV2 and AccessInfoV3 (both descendants of dict) pass the value returned by self.get("region_name") to the factory class method on the ServiceCatalog class. self.get("region_name") always returns none because nothing attempts to set it[1]. As such, the region_name attribute on the service catalog is always none and thus get_urls and url_for do not return endpoints only for the region specified when instantiating HTTPClient.

Another side effect of this bug is that the management_url set on HTTPClient is not necessarily the endpoint for the region specified as it is set to the first endpoint in the tuple returned by the AccessInfo.management_url method (which calls get_urls).

description: updated
summary: - Take region_name into account when setting management_url
+ Take region_name and version into account when setting management_url
summary: - Take region_name and version into account when setting management_url
+ Take region_name into account when setting management_url
Revision history for this message
Guang Yee (guang-yee) wrote :

Indeed AccessInfo is ignoring region when obtaining the management URL.

Changed in python-keystoneclient:
status: New → Confirmed
Changed in python-keystoneclient:
assignee: nobody → Harshavardhan Reddy M (hvreddy1110)
Revision history for this message
Harshavardhan Reddy M (hvreddy1110) wrote :

Hi Lin Hua Cheng,

I have gone through the code of python-keystoneclient. So you mean to say that ,in keystoneclient/client.py
in the class HTTPClient we are setting
self.region_name = region_name.
So along with do we need to update "self.management_url" with region_name.

Thank You,

Revision history for this message
Lin Hua Cheng (lin-hua-cheng) wrote :

Hi,

Thanks for looking into this.

Yes, when the code tries to figure out the management_url it should take into account the region_name passed. This should be included as matching criteria when looking up the url from the service catalog. Right now, it is just picks the first record in the service catalog.

Dolph Mathews (dolph)
Changed in python-keystoneclient:
importance: Undecided → Medium
Revision history for this message
Harshavardhan Reddy M (hvreddy1110) wrote :

Hi Lin,

Thanks for the reply.

Can you please tell me the procedure to verify/reproduse it..?

Thank You,

Regards,
Harsha

Revision history for this message
Harshavardhan Reddy M (hvreddy1110) wrote :

As no response from the author, I am untagging myself from this bug.

Thanks,

Regards,
Harsha

Changed in python-keystoneclient:
assignee: Harshavardhan Reddy M (hvreddy1110) → nobody
Dolph Mathews (dolph)
Changed in python-keystoneclient:
status: Confirmed → Incomplete
Revision history for this message
Lin Hua Cheng (lin-hua-cheng) wrote :

You can reproduce this by creating another set of endpoint (e.g. region=RegionTwo) for the identity service. When instantiating keystoneclient, pass region=RegionTwo. Getting managementurl should return the endpoint from the endpoint that matches the region.

For testing you can create another endpoint here:

https://github.com/openstack/python-keystoneclient/blob/master/tests/client_fixtures.py#L51

{u'adminURL': u'http://admin-regiontwo:35357/v2.0',
u'internalURL': u'http://interna-regiontwol:5000/v2.0',
u'publicURL': u'http://public.com:5000/v2.0',
u'region': u'RegioTwo'}

When you test keystoneclient with region=regionTwo, management_url should return http://admin-regiontwo:35357/v2.0'

Changed in python-keystoneclient:
status: Incomplete → Confirmed
Revision history for this message
Lin Hua Cheng (lin-hua-cheng) wrote :

Additional info added, setting back the status to Confirmed

summary: - Take region_name into account when setting management_url
+ region_name specified when instantiating HTTPClient is ignored
description: updated
Revision history for this message
Cody A.W. Somerville (cody-somerville) wrote :

This affects heat (and makes heat basically a one-region pony - or something like that) as heat overrides the management_url on all other clients it uses (e.g. python-novaclient, etc. etc.) with the value returned by python-keystoneclient.

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

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

Changed in python-keystoneclient:
assignee: nobody → Bartosz Górski (bartosz-gorski)
status: Confirmed → In Progress
Dolph Mathews (dolph)
Changed in python-keystoneclient:
milestone: none → 0.3.3
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Changed in python-keystoneclient:
assignee: Bartosz Górski (bartosz-gorski) → Jamie Lennox (jamielennox)
Steven Dake (sdake)
Changed in heat:
milestone: none → icehouse-1
assignee: nobody → Steven Dake (sdake)
importance: Undecided → High
status: New → Triaged
Revision history for this message
Steve Baker (steve-stevebaker) wrote :

I've tagged this havana-rc-potential for the heat portion of this bug

tags: added: havana-rc-potential
Thierry Carrez (ttx)
Changed in heat:
milestone: icehouse-1 → havana-rc2
Dolph Mathews (dolph)
Changed in python-keystoneclient:
milestone: 0.3.3 → none
Steven Hardy (shardy)
Changed in heat:
milestone: havana-rc2 → icehouse-1
Thierry Carrez (ttx)
tags: removed: havana-rc-potential
Changed in heat:
milestone: icehouse-1 → icehouse-2
Changed in python-keystoneclient:
assignee: Jamie Lennox (jamielennox) → Dolph Mathews (dolph)
Changed in python-keystoneclient:
assignee: Dolph Mathews (dolph) → Jamie Lennox (jamielennox)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-keystoneclient (master)

Reviewed: https://review.openstack.org/49106
Committed: http://github.com/openstack/python-keystoneclient/commit/d4c06d3035fa2910bc421d2196f2c0bf76f77cdb
Submitter: Jenkins
Branch: master

commit d4c06d3035fa2910bc421d2196f2c0bf76f77cdb
Author: Jamie Lennox <email address hidden>
Date: Tue Oct 22 09:41:00 2013 +1000

    Properly handle Regions in keystoneclient

    Region name is taken as a parameter but is ignored in all communication
    with the service catalog. Currently region can be stored in the token
    data and then requests to url functions will return the appropriate
    region. This is the wrong approach because there is nothing specific to
    the token (or auth_data) that is region specific. Instead region
    information should be held by the client.

    Closes-Bug: 1147530
    Closes-Bug: 1255992
    Change-Id: I812aa89c8b4af28e294e63926a7f88e8246fffc5

Changed in python-keystoneclient:
status: In Progress → Fix Committed
Changed in heat:
assignee: Steven Dake (sdake) → Bartosz Górski (bartosz-gorski)
status: Triaged → In Progress
Dolph Mathews (dolph)
Changed in python-keystoneclient:
milestone: none → 0.4.2
Revision history for this message
Steve Baker (steve-stevebaker) wrote :

The python-keystonclient fix is in, where does this leave heat with this bug?

Changed in heat:
milestone: icehouse-2 → icehouse-3
Dolph Mathews (dolph)
Changed in python-keystoneclient:
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

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

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

Reviewed: https://review.openstack.org/71540
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=7782b3013be7356e4f7e3bfdb9e401b6fec9c40f
Submitter: Jenkins
Branch: master

commit 7782b3013be7356e4f7e3bfdb9e401b6fec9c40f
Author: Bartosz Górski <email address hidden>
Date: Tue Oct 1 13:56:04 2013 -0700

    Adding option in config to specify region name

    This patch allows to specify region name which will be used to
    get appropriate API endpoints for services from Keystone.

    Change-Id: Iaca5987da447fdb77cd8f2253e6543bb7df022c4
    Closes-Bug: #1213291
    Closes-Bug: #1147530

Changed in heat:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in heat:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in heat:
milestone: icehouse-3 → 2014.1
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.