Templated catalog does not handle multi-regions properly

Bug #1703666 reported by Erik Olof Gunnar Andersson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
Medium
Erik Olof Gunnar Andersson

Bug Description

The current implementation of the keystone templated catalog does not group endpoints properly when there are multiple regions available.

This is an working example when using the sql backend and the openstack catalog list command.

| nova | compute | RegionTwo
| | | admin: http://10.0.3.15:8774/v2.1
| | | RegionOne
| | | admin: http://10.0.2.15:8774/v2.1

This is the same example using the templated backend and the openstack catalog list command.

| nova | compute | RegionTwo
| | | admin: http://10.0.3.15:8774/v2.1
| nova | compute | RegionOne
| | | admin: http://10.0.2.15:8774/v2.1

This causes issues in services that expects each service_type to include the endpoint for all regions.

This is because the code in for example Horizon is initially only looking for the service_type, which will return the first one, in this case is RegionTwo. If Horizon was requesting RegionOne, this would fail, as the list of endpoints would only contain RegionTwo.

As a work-around for Horizon a change like this is required
http://paste.openstack.org/show/614967/

 -def get_service_from_catalog(catalog, service_type):
 +def get_service_from_catalog(catalog, service_type, region):
      if catalog:
          for service in catalog:
              if 'type' not in service:
                  continue
              if service['type'] == service_type:
 - return service
 + for endpoint in service['endpoints']:
 + if endpoint['region'] == region:
 + return service
      return None

Revision history for this message
Lance Bragstad (lbragstad) wrote :

This is likely a small amount of work require to get the templated catalog at feature parity with the SQL catalog backend.

There is a patch proposed to fix this specific issue though [0].

[0] https://review.openstack.org/#/c/482364/

Changed in keystone:
status: New → Triaged
importance: Undecided → Medium
milestone: none → pike-3
assignee: nobody → Erik Olof Gunnar Andersson (eandersson)
description: updated
Changed in keystone:
status: Triaged → In Progress
Revision history for this message
Lance Bragstad (lbragstad) wrote :

FWIW - there is a patch proposed to use YAML instead [0]. We should double check to make sure this bug doesn't exist there. If that implementation [0] lands before the fix for this does, then we can mark this as Invalid since the templated catalog is going to be deprecated right afterwords.

[0] https://review.openstack.org/#/c/483514/

Revision history for this message
Lance Bragstad (lbragstad) wrote :

Marking this as invalid for now since we are going to move forward with a better file-based implementation [0]. Once that change lands, we'll be deprecate the templated catalog for removal all together.

[0] https://review.openstack.org/#/c/483514/

Changed in keystone:
milestone: pike-3 → pike-rc1
status: In Progress → Invalid
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on keystone (master)

Change abandoned by Erik Olof Gunnar Andersson (<email address hidden>) on branch: master
Review: https://review.openstack.org/482364

Changed in keystone:
status: Invalid → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (master)

Reviewed: https://review.openstack.org/482364
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=1483e056bd26cc2802adbe6a4ad0beae32c374bb
Submitter: Zuul
Branch: master

commit 1483e056bd26cc2802adbe6a4ad0beae32c374bb
Author: Erik Olof Gunnar Andersson <email address hidden>
Date: Mon Jul 10 17:43:20 2017 -0700

    Fixing multi-region support in templated v3 catalog

    Previously each region had its own entry for each service_type
    with only it's own endpoints listed. This patch changes this
    so that each service type has the endpoints from all regions
    listed.

    We also move the flawed templated get_v3_catalog function call
    from the base catalog class into the templated class.

    Change-Id: Ifddf08990539b6ac7d8289d410092b2ae9f5cbed
    Closes-Bug: #1703666

Changed in keystone:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/keystone 14.0.0.0b1

This issue was fixed in the openstack/keystone 14.0.0.0b1 development milestone.

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.