Glance service selection from ServiceCatalog when using keystone

Bug #904850 reported by Stuart McLaren
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Medium
Stuart McLaren

Bug Description

When glance receives a token from the keystone server it looks through the
returned json for a serviceName:

            for service in resp_auth['serviceCatalog']:
                if service['name'] == 'glance':

We were in touch with the Keystone folks about this:

----------
You're correct, they should be looking at the type field. The name is purely an operator-specified, marketing name (I.e. At Rackspace we would call it "Cloud Servers").

Yes, the core openstack services are canonical. Any other services should be added as extensions (ex: "HP-dnsext:dns"). This is specified in the XSD contracts (but not enforced in JSON as
we don't have validation there…. Yet…

Thanks!

Z[iad]
-----------

the change would be something like:

--- a/glance/common/auth.py
+++ b/glance/common/auth.py
@@ -175,7 +175,7 @@ class KeystoneStrategy(BaseStrategy):
             # 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['name'] == 'glance':
+ if service['type'] == 'image-service':
                     glance_endpoint = service['endpoints'][0]['publicURL']
                     break
             else:

compare the equivalent swift bug: https://bugs.launchpad.net/swift/+bug/904830

https://bugs.launchpad.net/swift/+bug/904830

Revision history for this message
Stuart McLaren (stuart-mclaren) wrote :

Note, that in the keystone source they seem to refer to glance
as both of type 'image' and 'image-service':

keystone/keystone/test/sampledata.py:

    #6 Service Name:glance Type:image
    ('service', 'add', 'glance',
        'image', 'OpenStack Image Service'),

keystone/keystone/content/common/xsd/services.xsd:

            <enumeration value="image-service">
                <annotation>
                    <xsd:documentation
                        xml:lang="EN"
                        xmlns="http://www.w3.org/1999/xhtml">
                        <p>
                            The type for a Glance-compatible service
                        </p>
                    </xsd:documentation>
                </annotation>
            </enumeration>

My guess is that 'image-service' is the right type?

Revision history for this message
Jay Pipes (jaypipes) wrote :

Use whatever Nova is set to... if it's compute, then use image, if it's compute-service, I'd use image-service.

Cheers!
-jay

Changed in glance:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → Stuart McLaren (stuart-mclaren)
milestone: none → essex-3
tags: added: diablo-backport
tags: added: keystone
Revision history for this message
Stuart McLaren (stuart-mclaren) wrote :

From the keyston api doc it seems Nova is just 'compute':

"serviceCatalog":[{
        "name":"Cloud Servers",
        "type":"compute",

from the keystone tests that also seems to be the case:

 "type": "compute",

So I will set glance to look for 'image'.

Revision history for this message
Jay Pipes (jaypipes) wrote :

Hi Stu, is this in progress?

Revision history for this message
Donagh McCabe (donagh-mccabe) wrote :

> So I will set glance to look for 'image'

Wrt #2 and #3, as per keystone/blob/master/keystone/content/common/xsd/services.xsd, glance should be "image-service", not "image". Project/type mapping is:

Nova compute (not "compute-service")
Glance image-service (not "image")
Swift object-store
Keystone identity

> Stu, is this in progress?
Stuart is on vacation so it will be a couple of weeks before you see anything from him

Revision history for this message
Jay Pipes (jaypipes) wrote :

Hi Donagh, thanks for the heads up on Stuart :)

re: the name of the service, I think I would prefer "image" over "images" to align with the rest of the service names (none of the others have -service attached to them.) Lemme chat with Ziad and see if we can get that aligned in Keystone.

Thanks!
-jay

Jay Pipes (jaypipes)
Changed in glance:
milestone: essex-3 → essex-4
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

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

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

Reviewed: https://review.openstack.org/3546
Committed: http://github.com/openstack/glance/commit/28f2cae1612b1dbd854fa45859ac46c995b0d5d1
Submitter: Jenkins
Branch: master

commit 28f2cae1612b1dbd854fa45859ac46c995b0d5d1
Author: Stuart McLaren <email address hidden>
Date: Mon Jan 30 14:09:09 2012 +0000

    Check service catalogue type rather than name

    Fix for bug 904850. After authenticating with Keystone select
    the 'type' field from the returned ServiceCatalog json rather
    than the 'name'.

    Change-Id: I4e3d92a1ff58fa2be1669789fe371f61c53f652a

Changed in glance:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in glance:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in glance:
milestone: essex-4 → 2012.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.