分享

关于nova list 命令报错ERROR: Unauthorized (HTTP 401)

wonitazansa 发表于 2015-3-17 18:11:49 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 12 53846

执行nova  list的一些命令报错
[root@controller ~]# nova  list
ERROR: Unauthorized (HTTP 401)


[root@controller ~]# nova  --debug list
.......
REQ: curl -i 'http://controller:8774/v2/9b807b0dd7de4bba87c3e4704d9fa5e9/servers/detail' -X GET -H "X-Auth-Project-Id: admin" -H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-Auth-Token: 9003518eee3b4e75b7e1b891146f84cb"

INFO (connectionpool:203) Starting new HTTP connection (1): controller
DEBUG (connectionpool:295) "GET /v2/9b807b0dd7de4bba87c3e4704d9fa5e9/servers/detail HTTP/1.1" 401 23
RESP: [401] {'date': 'Tue, 17 Mar 2015 10:02:20 GMT', 'content-length': '23', 'content-type': 'text/plain', 'www-authenticate': "Keystone uri='http://controller:5000'"}
RESP BODY: Authentication required

DEBUG (shell:783) Unauthorized (HTTP 401)
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/novaclient/shell.py", line 780, in main
    OpenStackComputeShell().main(map(strutils.safe_decode, sys.argv[1:]))
  File "/usr/lib/python2.6/site-packages/novaclient/shell.py", line 716, in main
    args.func(self.cs, args)
  File "/usr/lib/python2.6/site-packages/novaclient/v1_1/shell.py", line 1138, in do_list
    search_opts=search_opts)
  File "/usr/lib/python2.6/site-packages/novaclient/v1_1/servers.py", line 583, in list
    return self._list("/servers%s%s" % (detail, query_string), "servers")
  File "/usr/lib/python2.6/site-packages/novaclient/base.py", line 64, in _list
    _resp, body = self.api.client.get(url)
  File "/usr/lib/python2.6/site-packages/novaclient/client.py", line 309, in get
    return self._cs_request(url, 'GET', **kwargs)
  File "/usr/lib/python2.6/site-packages/novaclient/client.py", line 301, in _cs_request
    raise e
Unauthorized: Unauthorized (HTTP 401)
ERROR: Unauthorized (HTTP 401)


怎么看这个段debug,能说明什么

已有(13)人评论

跳转到指定楼层
sstutu 发表于 2015-3-17 18:43:22
证书没有生效,或则token过期等,就是认证的问题。可以看看这篇:

OpenStack API介绍及使用快速入门
http://www.aboutyun.com/thread-12002-1-1.html
得到401请求时,是什么原因造成的?

回复

使用道具 举报

wonitazansa 发表于 2015-3-18 09:11:11
我是新手,说实话,真不太明白,能再解释一下吗
回复

使用道具 举报

howtodown 发表于 2015-3-18 12:25:46
wonitazansa 发表于 2015-3-18 09:11
我是新手,说实话,真不太明白,能再解释一下吗

你的用户名和密码可能不正确,也可能是keystone配置不正确,总之跟认证有关系。
下面的帖子可以看看,能帮助入门:
openstack【juno】入门 【keystone篇】五::Keystone部署及介绍

openstack【juno】入门 【keystone篇】六::Keystone使用及遇到问题解决办法


openstack【juno】入门 【总结篇】二十八:keystone及网络总结

Keystone, Openstack之魂


上面了解之后,如果还是不明白,最好重新部署下
回复

使用道具 举报

wonitazansa 发表于 2015-3-18 13:14:01
就不能从日志中定位吗
回复

使用道具 举报

wonitazansa 发表于 2015-3-18 17:35:12
我在这个http://www.aboutyun.com/thread-6949-1-1.html帖子找到答案

[root@controller ~]#vi /etc/nova/nova.conf

image_file_url]
[keymgr]
[keystone_authtoken]
auth_uri = http://controller:5000
auth_host =controller
auth_protocol = http
auth_port = 35357
--------------------------------------------------------
admin_user = nova
admin_tenant_name = service
admin_password = NOVA_PASS
---------------------------------------------------------
改成如下
admin_user = admin
admin_tenant_name = admin
admin_password = ADMIN_PASS

就ok了,但是我看了许多文档,都是安装没改之前的用户名和密码,这里会不会只是表象呀
这里改成admin,会不会其他地方有问题

请高人解答
回复

使用道具 举报

jixianqiuxue 发表于 2015-3-18 18:19:19
wonitazansa 发表于 2015-3-18 17:35
我在这个http://www.aboutyun.com/thread-6949-1-1.html帖子找到答案

[root@controller ~]#vi /etc/nova ...

你这里似乎少一些内容:
这是我的配置
  1. [keystone_authtoken]
  2. auth_uri = http://controller:5000/v2.0
  3. identity_uri = http://controller:35357
  4. admin_tenant_name = service
  5. admin_user = nova
  6. admin_password = NOVA_PASS
复制代码


回复

使用道具 举报

wonitazansa 发表于 2015-3-19 09:44:51
jixianqiuxue 发表于 2015-3-18 18:19
你这里似乎少一些内容:
这是我的配置


[root@controller ~]# vi /etc/nova/nova.conf
……
[keystone_authtoken]
auth_uri = http://controller:5000
auth_host = controller
auth_protocol = http
auth_port = 35357
identity_uri = http://controller:35357
admin_user = nova
admin_tenant_name = service
admin_password = NOVA_PASS

安装上面设置后
tail /var/log/nova/api.log
2015-03-19 09:33:37.514 570 WARNING keystoneclient.middleware.auth_token [-] Unexpected response from keystone service: {u'error': {u'message': u'The resource could not be found.', u'code': 404, u'title': u'Not Found'}}
2015-03-19 09:33:37.515 570 WARNING keystoneclient.middleware.auth_token [-] Authorization failed for token
2015-03-19 09:33:37.519 563 WARNING keystoneclient.middleware.auth_token [-] Unable to find authentication token in headers


[root@controller ~]# nova --debug list
......
REQ: curl -i 'http://controller:8774/v2/9b807b0dd7de4bba87c3e4704d9fa5e9/servers/detail' -X GET -H "X-Auth-Project-Id: admin" -H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-Auth-Token: e0b3b0758a854bdc853cad4469cc31ce"

INFO (connectionpool:203) Starting new HTTP connection (1): controller
DEBUG (connectionpool:295) "GET /v2/9b807b0dd7de4bba87c3e4704d9fa5e9/servers/detail HTTP/1.1" 401 23
RESP: [401] {'date': 'Thu, 19 Mar 2015 01:36:43 GMT', 'content-length': '23', 'content-type': 'text/plain', 'www-authenticate': "Keystone uri='http://controller:5000'"}
RESP BODY: Authentication required

DEBUG (shell:783) Unauthorized (HTTP 401)
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/novaclient/shell.py", line 780, in main
    OpenStackComputeShell().main(map(strutils.safe_decode, sys.argv[1:]))
  File "/usr/lib/python2.6/site-packages/novaclient/shell.py", line 716, in main
    args.func(self.cs, args)
  File "/usr/lib/python2.6/site-packages/novaclient/v1_1/shell.py", line 1138, in do_list
    search_opts=search_opts)
  File "/usr/lib/python2.6/site-packages/novaclient/v1_1/servers.py", line 583, in list
    return self._list("/servers%s%s" % (detail, query_string), "servers")
  File "/usr/lib/python2.6/site-packages/novaclient/base.py", line 64, in _list
    _resp, body = self.api.client.get(url)
  File "/usr/lib/python2.6/site-packages/novaclient/client.py", line 309, in get
    return self._cs_request(url, 'GET', **kwargs)
  File "/usr/lib/python2.6/site-packages/novaclient/client.py", line 301, in _cs_request
    raise e
Unauthorized: Unauthorized (HTTP 401)
ERROR: Unauthorized (HTTP 401)


为什么这个nova这个用户不行呀,是不是过期了,如何检查这个用户
回复

使用道具 举报

jixianqiuxue 发表于 2015-3-19 11:04:53
wonitazansa 发表于 2015-3-19 09:44
[root@controller ~]# vi /etc/nova/nova.conf
……
[keystone_authtoken]

nova用户不会过期,而是token过期。
在执行这个命令的时候,记得先生效一个用户名和密码。
回复

使用道具 举报

wonitazansa 发表于 2015-3-19 13:53:37
jixianqiuxue 发表于 2015-3-19 11:04
nova用户不会过期,而是token过期。
在执行这个命令的时候,记得先生效一个用户名和密码。

什么意思怎么生效一个用户名和密码
回复

使用道具 举报

12下一页
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条