glance image-list gets HTTP 500 error

asked 2015-03-02 13:37:02 -0500

RedCricket gravatar image

updated 2015-03-03 12:19:25 -0500

Hi, I am wondering why I cannot get glance to work. When I do glance --debug image-list I get this output:

    [root@ost-mgmt-rhel7-001 ~]# glance --debug image-list
    curl -i -X GET -H 'User-Agent: python-glanceclient' -H 'Content-Type: application/octet-stream' -H 'Accept-Encoding: gzip, deflate' -H 'Accept: */*' -H 'X-Auth-Token: {SHA1}xxxxxxxxxxxx'  --cert None --key None https://ost-el7.example.com:9292/v1/images/detail?sort_key=name&sort_dir=asc&limit=20
    Request returned failure status 500.
    Traceback (most recent call last):
      File "/usr/lib/python2.7/site-packages/glanceclient/shell.py", line 602, in main
        args.func(client, args)
      File "/usr/lib/python2.7/site-packages/glanceclient/v1/shell.py", line 107, in do_image_list
        utils.print_list(images, columns)
      File "/usr/lib/python2.7/site-packages/glanceclient/common/utils.py", line 121, in print_list
        for o in objs:
      File "/usr/lib/python2.7/site-packages/glanceclient/v1/images.py", line 196, in paginate
        images, resp = self._list(url, "images")
      File "/usr/lib/python2.7/site-packages/glanceclient/v1/images.py", line 62, in _list
        resp, body = self.client.get(url)
      File "/usr/lib/python2.7/site-packages/glanceclient/common/http.py", line 253, in get
        return self._request('GET', url, **kwargs)
      File "/usr/lib/python2.7/site-packages/glanceclient/common/http.py", line 221, in _request
        raise exc.from_response(resp, resp.content)
    HTTPInternalServerError: HTTPInternalServerError (HTTP 500)
    HTTPInternalServerError (HTTP 500)

I see --cert None --key None in the debug output so I was thinking that I need to set these values:

ca_file = None (StrOpt) CA certificate file to use to verify connecting clients. cert_file = None (StrOpt) Certificate file to use when starting API server securely. key_file = None (StrOpt) Private key file to use when starting API server securely.

But I have no idea what to set them too.

Here's an Update: When I execute the curl that is described in the debug output ...

    curl -i -X GET \
    -H 'User-Agent: python-glanceclient' \
    -H 'Content-Type: application/octet-stream'   \
    -H 'Accept-Encoding: gzip, deflate' \
    -H 'Accept: */*'   \
    -H 'X-Auth-Token: {SHA1}f61557e61a6f594ab6613c79a1e092b78fe46835' \
    --cert None \
    --key None  \
    'https://ost-el7.example.com:9292/v1/images/detail?sort_key=name&sort_dir=asc&limit=20' ; echo

... I get this output ...

    HTTP/1.1 401 Unauthorized
    Content-Length: 358
    Content-Type: text/html; charset=UTF-8
    Www-Authenticate: Keystone uri='https://ost-el7.example.com:5000/v2.0'
    Date: Mon, 02 Mar 2015 20:35:05 GMT

    <html>
     <head>
      <title>401 Unauthorized</title>
     </head>
     <body>
      <h1>401 Unauthorized</h1>
      This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.<br /><br />



     </body>
    </html>

Update:

Update:

Thanks Haneef, I do not thank glance is working. Here's how I checked.

    [root@ost-mgmt-rhel7-001 ~]# cat test_glance.sh
    #!/bin/sh

    export OS_TENANT_NAME=admin
    export OS_USERNAME=admin
    export OS_PASSWORD=xxxxxxxxxxxx
    export OS_AUTH_URL=https://ost-el7.example.com:35357/v2.0

    token=`keystone token-get | grep " id " | cut -d \| -f3 | sed -e's/ //g'`
    #glance --debug image-list
    echo "token is [$token]"
    curl -ki -X GET \
    -H 'User-Agent: python-glanceclient' \
    -H 'Content-Type: application/octet-stream' \
    -H 'Accept-Encoding ...
(more)
edit retag flag offensive close merge delete

Comments

You can't take the token from the curl command shown in debug. That is mangled token and not the real token. Real token won't have {SHA1}

Haneef Ali gravatar imageHaneef Ali ( 2015-03-02 22:38:33 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2015-03-02 22:46:29 -0500

updated 2015-03-03 12:49:18 -0500

Couple of things are wrong here.

1) You can't take the token from the curl command shown in debug. That is mangled token and not the real token. Real token won't have {SHA1}

2) Frist verify the glance is working fine. I have removed cert options and added "-k" for curl. Also you need to add the token from keystone token-get command

      keytone token-get

       curl -ki -X GET \
    -H 'User-Agent: python-glanceclient' \
    -H 'Content-Type: application/octet-stream'   \
    -H 'Accept-Encoding: gzip, deflate' \
    -H 'Accept: */*'   \
    -H 'X-Auth-Token: <id for="" the="" keystone="" token-get="" response="">
    'https://ost-el7.example.com:9292/v1/images/detail?sort_key=name&sort_dir=asc&limit=20' ; echo
    

3) Also what is your environment setting, especially the values of the varaibles OS_*. Since you are able to get the token, most probably it is not cert issue.

Update 1:

In your glance.conf under keystone_authtoken section, there will be username/password and tenant name. Is that correct? You should be able to get a token using that username/password/tenant name. Please check that.

Since your are able to get token using for admin username with admin tenant, you can also use those credentials in glance.conf

Update 2:

Try this

 keystone  --os-username glance --os-password <glance user password> --os-tenant-name services  --os-auth-url      "https://ost-el7.example.com:35357/v2.0"  token-get

Normally those setup scripts creates project with the name "service", but you have "services" in your config file. Above command should help you to check that out

edit flag offensive delete link more

Comments

Ok that works. I can get a token using --ose-username --os-password --os-tenant-name and --os-auth-url. But why can't I do a glance image-list? Thanks for all your help so far BTW :)

RedCricket gravatar imageRedCricket ( 2015-03-03 14:52:38 -0500 )edit

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2015-03-02 13:37:02 -0500

Seen: 2,607 times

Last updated: Mar 03 '15