OpenStack Image Registry and Delivery Service (Glance)

Glance always picks the first endpoint from the service catalog

Reported by Juerg Haefliger on 2012-02-20
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Glance
High
Stuart McLaren

Bug Description

Glance is hardcoded to pick the first endpoint from the service catalog with keystone. From common/auth.py:

            # FIXME(sirp): for now just using the first endpoint we get back
            # from the service catalog for glance, and using the public url.
            for service in resp_auth['serviceCatalog']:
                if service['type'] == 'image':
                    glance_endpoint = service['endpoints'][0]['publicURL']
                    break
            else:
                raise exception.NoServiceEndpoint()

Obviously this fails when there are multiple endpoints per service:

{
     "name": "Image Management",
      "type": "image",
      "endpoints": [
        {
          "tenantId": "<TENANT ID",
          "publicURL": "<URL>",
          "region": "az-1.region-a.geo-1",
          "versionId": "1.0"
        },
        {
          "tenantId": "<TENANT ID>",
          "publicURL": "<URL>",
          "region": "az-2.region-a.geo-1",
          "versionId": "1.0"
        }
      ]
    },

I believe at the minimum it should also honor the region identifier.

Jay Pipes (jaypipes) wrote :

Hi Juerg!

Yes, this is a clear need. Steps needed:

1) Create a region configuration option that will be used by the Glance API -> Glance Registry client communication
2) Allow a region parameter (and corresponding environ variable) to the Glance CLI tool that allows to pick a specific region from a list of region identifiers
3) Change the code mentioned above in the common/auth.py code to pick an appropriate region

Best,
-jay

Changed in glance:
status: New → Triaged
importance: Undecided → High
milestone: none → essex-4
tags: added: auth low-hanging-fruit
Eoghan Glynn (eglynn) on 2012-02-20
Changed in glance:
assignee: nobody → Eoghan Glynn (eglynn)
Juerg Haefliger (juergh) wrote :

Eoghan, can I have this one? To get familiar with bug fixing process?

Eoghan Glynn (eglynn) wrote :

Juerg - sure, go for it if you have the time.

Jay Pipes (jaypipes) wrote :

Hi Juerg! Feel free to find Eoghan or myself on IRC if you have any questions about the contribution process. I'm jaypipes and Eoghan is eglynn.

Best,
-jay

Changed in glance:
assignee: Eoghan Glynn (eglynn) → Juerg Haefliger (juergh)
Stuart McLaren (stuart-mclaren) wrote :

I missed this bug and put in a duplicate (937819).

I'd the code ready to go, so after conferring with Juerg I pushed it up.

Will close this bug as a dup of 937819.

Changed in glance:
assignee: Juerg Haefliger (juergh) → Stuart McLaren (stuart-mclaren)
status: Triaged → In Progress
Thierry Carrez (ttx) wrote :

Proposed to master as: https://review.openstack.org/#change,4350
Must land there first.

Reviewed: https://review.openstack.org/4350
Committed: http://github.com/openstack/glance/commit/8d46288e9cfb10745adfb06a510ed93433a7a9c5
Submitter: Jenkins
Branch: master

commit 8d46288e9cfb10745adfb06a510ed93433a7a9c5
Author: Stuart McLaren <email address hidden>
Date: Tue Feb 21 15:07:51 2012 +0000

    Allow region selection when using V2 keystone

    Fix for bug 936798. Allow a client to select which
    region endpoint they want from the service catalogue.

    The region can be set via the environment variable
    OS_REGION_NAME or via the '-R/--region' command line
    option.

    If a single image endpoint is returned from keystone,
    the client will use that even if no region was specified
    (the default). Where multiple endpoints exist a region
    must be provided.

    Change-Id: I6797f8ddf88d5875caf194913082c3fe24c86585

Changed in glance:
status: In Progress → Fix Committed

Reviewed: https://review.openstack.org/4728
Committed: http://github.com/openstack/glance/commit/5a7cc1691dd0e79904d06a93b0938e3e51ecc007
Submitter: Jenkins
Branch: milestone-proposed

commit 5a7cc1691dd0e79904d06a93b0938e3e51ecc007
Author: Stuart McLaren <email address hidden>
Date: Tue Feb 21 15:07:51 2012 +0000

    Allow region selection when using V2 keystone

    Fix for bug 936798. Allow a client to select which
    region endpoint they want from the service catalogue.

    The region can be set via the environment variable
    OS_REGION_NAME or via the '-R/--region' command line
    option.

    If a single image endpoint is returned from keystone,
    the client will use that even if no region was specified
    (the default). Where multiple endpoints exist a region
    must be provided.

    Change-Id: I6797f8ddf88d5875caf194913082c3fe24c86585

Changed in glance:
status: Fix Committed → Fix Released
Jay Pipes (jaypipes) on 2012-03-01
Changed in glance:
milestone: essex-4 → essex-rc1
Thierry Carrez (ttx) wrote :

Was actually fixed in E4

Changed in glance:
milestone: essex-rc1 → essex-4
Thierry Carrez (ttx) on 2012-04-05
Changed in glance:
milestone: essex-4 → 2012.1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers