← Back to team overview

openstack team mailing list archive

Re: How to use glance and nova-manage in command with keystone

 

Hi,

I've got an issue with CLI Glance and Keystone authentication.
I try the above method with env variables, but I get this error:

# glance -d index
Traceback (most recent call last):
 File "/usr/bin/glance", line 1206, in <module>
   result = command(options, args)
 File "/usr/bin/glance", line 60, in wrapper
   ret = func(*args, **kwargs)
 File "/usr/bin/glance", line 497, in images_index
   print_header=True)
 File "/usr/bin/glance", line 443, in _images_index
   images = client.get_images(**parameters)
 File "/usr/lib/python2.7/dist-packages/glance/client.py", line 53,
in get_images
   res = self.do_request("GET", "/images", params=params)
 File "/usr/lib/python2.7/dist-packages/glance/common/client.py",
line 136, in do_request
   self._authenticate()
 File "/usr/lib/python2.7/dist-packages/glance/common/client.py",
line 123, in _authenticate
   auth_plugin.authenticate()
 File "/usr/lib/python2.7/dist-packages/glance/common/auth.py", line
103, in authenticate
   _authenticate(auth_url)
 File "/usr/lib/python2.7/dist-packages/glance/common/auth.py", line
91, in _authenticate
   self._v2_auth(token_url)
 File "/usr/lib/python2.7/dist-packages/glance/common/auth.py", line
180, in _v2_auth
   raise Exception(_('Unexpected response: %s') % resp.status)
Exception: Unexpected response: 400

And if I set the token to the glance CLI command, it works:
# glance -A 999888777666 index
ID               Name                           Disk Format
Container Format     Size
---------------- ------------------------------ --------------------
-------------------- --------------
5                Debian stable 6.0.2.1 AMD64 ne iso
bare                      176160768
3                OpenSIPs AMI                   ami
ami                      1326645248
2                Ubuntu natty kernel            aki
aki                         4592896
1                Ubuntu 11.04 server amd64      qcow2
bare                     1040449536

Can you help me ?

Doude.

2011/10/10 Vishvananda Ishaya <vishvananda@xxxxxxxxx>:
> It looks like if you change your authurl to port 35357 in your glancerc that
> you can use glance index without passing in the auth key.
> On Oct 9, 2011, at 5:45 PM, Jae Sang Lee wrote:
>
> Hi,
>
> This is my glance and nova-client rc. Change User, Key value for your
> configuration.
>
> glancerc:
> export OS_AUTH_USER=admin
> export OS_AUTH_KEY=secrete
> export OS_AUTH_TENANT=demo
> export OS_AUTH_URL=192.168.0.151:5000/v2.0/ <--- Keystone IP
> export OS_AUTH_STRATEGY=keystone
>
> testrc: (different with novarc from nova-manage)
> export NOVA_URL="http://localhost:35357/v2.0/"; <--- Keystone IP
> export NOVA_VERSION="1.1"
> export NOVA_API_KEY="secrete"
> export NOVA_USERNAME="admin"
> export NOVA_PROJECT_ID="demo"
> export NOVA_REGION_NAME="RegionOne"
>
> for example,
> -glance-
> root@nova151:~# glance index
> Not authorized to make this request. Check your credentials (OS_AUTH_USER,
> OS_AUTH_KEY, ...).
> root@nova151:~# cat glancerc
> export OS_AUTH_USER=admin
> export OS_AUTH_KEY=secrete
> export OS_AUTH_TENANT=demo
> export OS_AUTH_URL=192.168.0.151:5000/v2.0/
> export OS_AUTH_STRATEGY=keystone
> root@nova151:~# . glancerc
> root@nova151:~# glance -A 999888777666 index  <-- add your service token -A
> ID               Name                           Disk Format
> Container Format     Size
> ---------------- ------------------------------ --------------------
> -------------------- --------------
> 13               ubuntu-apm                     ami
> ami                      1071644672
> 12               initrd-ubuntu-apm              ari
> ari                         4005981
> 11               vmlinuz-ubuntu-apm             aki
> aki                         4107552
> 10               ubuntu                         ami
> ami                       524288000
> 9                initrd                         ari
> ari                         7988037
> 8                vmlinuz                        aki
> aki                         4099360
>
> -nova-
> root@nova151:~# nova list
> You must provide a username, eithervia --username or via env[NOVA_USERNAME]
> root@nova151:~# cat testrc
> export NOVA_URL="http://localhost:35357/v2.0/";
> export NOVA_VERSION="1.1"
> export NOVA_API_KEY="secrete"
> export NOVA_USERNAME="admin"
> export NOVA_PROJECT_ID="demo"
> export NOVA_REGION_NAME="RegionOne"
> root@nova151:~# . testrc
> root@nova151:~# nova list
> +----+-------+--------+------------------+
> | ID |  Name | Status |     Networks     |
> +----+-------+--------+------------------+
> | 6  | rose  | ACTIVE | private=10.0.0.7 |
> | 9  | lilly | ACTIVE | private=10.0.0.8 |
> +----+-------+--------+------------------+
>
>
>
> If you want to know exact information, try to see keystone db.
>
> 2011/10/10 mao weijie <mwjpiero@xxxxxxxxx>
>>
>> Hi,
>> I used devstack to install openstack and it work well with dashboard. But
>> now I want to use command(glance or nova-manage), it tells me
>> that credentials problem. Does anyone use dashboard with keystone and also
>> use command in terminal?
>>
>> 非淡泊無以明志,非寧靜無以致遠
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~openstack
>> Post to     : openstack@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~openstack
>> More help   : https://help.launchpad.net/ListHelp
>>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to     : openstack@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openstack
> More help   : https://help.launchpad.net/ListHelp
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to     : openstack@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openstack
> More help   : https://help.launchpad.net/ListHelp
>
>


References