← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1703666] [NEW] Templated catalog does not handle multi-regions properly

 

Public bug reported:

The current implementation of the keystone templated catalog does not
group endpoints properly when there are multiple region 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 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 contains RegionTwo.

As a work-around for Horizon a change like this is required

 -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

** Affects: keystone
     Importance: Medium
     Assignee: Erik Olof Gunnar Andersson (eandersson)
         Status: Triaged

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Identity (keystone).
https://bugs.launchpad.net/bugs/1703666

Title:
  Templated catalog does not handle multi-regions properly

Status in OpenStack Identity (keystone):
  Triaged

Bug description:
  The current implementation of the keystone templated catalog does not
  group endpoints properly when there are multiple region 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 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 contains RegionTwo.

  As a work-around for Horizon a change like this is required

   -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

To manage notifications about this bug go to:
https://bugs.launchpad.net/keystone/+bug/1703666/+subscriptions


Follow ups