keystone 10.11.101.4
glance 10.11.101.5
nova 10.11.101.6
在nova上执行:nova list
报ERROR: Unauthorized (HTTP 401) 下面是debug信息。
==============================================
root@kapi:~# nova --debug list
REQ: curl -i 'http://10.11.101.4:5000/v2.0/tokens' -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-novaclient" -d '{"auth": {"tenantName": "serviceTenant", "passwordCredentials": {"username": "service_admin", "password": "service_pass"}}}'
New session created for: (http://10.11.101.4:5000)
INFO (connectionpool:264) Starting new HTTP connection (1): 10.11.101.4
DEBUG (connectionpool:395) Setting read timeout to 600.0
DEBUG (connectionpool:435) "POST /v2.0/tokens HTTP/1.1" 200 1508
RESP: [200] CaseInsensitiveDict({'date': 'Fri, 10 Mar 2017 14:08:50 GMT', 'vary': 'X-Auth-Token', 'content-length': '1508', 'content-type': 'application/json', 'x-distribution': 'Ubuntu'})
RESP BODY: {"access": {"token": {"issued_at": "2017-03-10T14:08:50.285282", "expires": "2017-03-10T15:08:50Z", "id": "67a5d4a2b7ed40e8a9ccb340e96bff41", "tenant": {"description": "service tenant", "enabled": true, "id": "cfb92f7692464dee8761b307d6f208c8", "name": "serviceTenant"}}, "serviceCatalog": [{"endpoints": [{"adminURL": "http://10.11.101.5:9292/v2", "region": "RegionOne", "internalURL": "http://10.11.101.5:9292/v2", "id": "316ee67c8dfc474ab4841e003d6d80b3", "publicURL": "http://10.11.101.5:9292/v2"}], "endpoints_links": [], "type": "image", "name": "glance"}, {"endpoints": [{"adminURL": "http://10.11.101.6:8774/v2/cfb92f7692464dee8761b307d6f208c8", "region": "RegionOne", "internalURL": "http://10.11.101.6:8774/v2/cfb92f7692464dee8761b307d6f208c8", "id": "69f774c8f2c74060bfb16534881d854b", "publicURL": "http://10.11.101.6:8774/v2/cfb92f7692464dee8761b307d6f208c8"}], "endpoints_links": [], "type": "compute", "name": "nova"}, {"endpoints": [{"adminURL": "http://10.11.101.4:35357/v2.0", "region": "RegionOne", "internalURL": "http://10.11.101.4:5000/v2.0", "id": "95ab1e4708664441a920b8ec77de5e49", "publicURL": "http://10.11.101.4:5000/v2.0"}], "endpoints_links": [], "type": "identity", "name": "keystone"}], "user": {"username": "service_admin", "roles_links": [], "id": "cb81cd2eb7fa4a2882b9a48042a83405", "roles": [{"name": "admin"}, {"name": "_member_"}], "name": "service_admin"}, "metadata": {"is_admin": 0, "roles": ["58fe65fb73fa4c88969f4092818ee883", "9fe2ff9ee4384b1894a90878d3e92bab"]}}}
REQ: curl -i 'http://10.11.101.6:8774/v2/cfb92f7692464dee8761b307d6f208c8/servers/detail' -X GET -H "X-Auth-Project-Id: serviceTenant" -H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-Auth-Token: 67a5d4a2b7ed40e8a9ccb340e96bff41"
New session created for: (http://10.11.101.6:8774)
INFO (connectionpool:264) Starting new HTTP connection (1): 10.11.101.6
DEBUG (connectionpool:395) Setting read timeout to 600.0
DEBUG (connectionpool:435) "GET /v2/cfb92f7692464dee8761b307d6f208c8/servers/detail HTTP/1.1" 401 23
RESP: [401] CaseInsensitiveDict({'date': 'Fri, 10 Mar 2017 14:08:53 GMT', 'content-length': '23', 'content-type': 'text/plain', 'www-authenticate': "Keystone uri='http://10.11.101.4:5000/v2.0'"})
RESP BODY: Authentication required
REQ: curl -i 'http://10.11.101.4:5000/v2.0/tokens' -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-novaclient" -d '{"auth": {"passwordCredentials": {"username": "service_admin", "password": "service_pass"}, "tenantId": "cfb92f7692464dee8761b307d6f208c8"}}'
New session created for: (http://10.11.101.4:5000)
INFO (connectionpool:264) Starting new HTTP connection (1): 10.11.101.4
DEBUG (connectionpool:395) Setting read timeout to 600.0
DEBUG (connectionpool:435) "POST /v2.0/tokens HTTP/1.1" 200 1508
RESP: [200] CaseInsensitiveDict({'date': 'Fri, 10 Mar 2017 14:08:54 GMT', 'vary': 'X-Auth-Token', 'content-length': '1508', 'content-type': 'application/json', 'x-distribution': 'Ubuntu'})
RESP BODY: {"access": {"token": {"issued_at": "2017-03-10T14:08:54.136815", "expires": "2017-03-10T15:08:54Z", "id": "a38d9b07a93f4a0a9e88456f02c8132d", "tenant": {"description": "service tenant", "enabled": true, "id": "cfb92f7692464dee8761b307d6f208c8", "name": "serviceTenant"}}, "serviceCatalog": [{"endpoints": [{"adminURL": "http://10.11.101.5:9292/v2", "region": "RegionOne", "internalURL": "http://10.11.101.5:9292/v2", "id": "316ee67c8dfc474ab4841e003d6d80b3", "publicURL": "http://10.11.101.5:9292/v2"}], "endpoints_links": [], "type": "image", "name": "glance"}, {"endpoints": [{"adminURL": "http://10.11.101.6:8774/v2/cfb92f7692464dee8761b307d6f208c8", "region": "RegionOne", "internalURL": "http://10.11.101.6:8774/v2/cfb92f7692464dee8761b307d6f208c8", "id": "69f774c8f2c74060bfb16534881d854b", "publicURL": "http://10.11.101.6:8774/v2/cfb92f7692464dee8761b307d6f208c8"}], "endpoints_links": [], "type": "compute", "name": "nova"}, {"endpoints": [{"adminURL": "http://10.11.101.4:35357/v2.0", "region": "RegionOne", "internalURL": "http://10.11.101.4:5000/v2.0", "id": "95ab1e4708664441a920b8ec77de5e49", "publicURL": "http://10.11.101.4:5000/v2.0"}], "endpoints_links": [], "type": "identity", "name": "keystone"}], "user": {"username": "service_admin", "roles_links": [], "id": "cb81cd2eb7fa4a2882b9a48042a83405", "roles": [{"name": "admin"}, {"name": "_member_"}], "name": "service_admin"}, "metadata": {"is_admin": 0, "roles": ["58fe65fb73fa4c88969f4092818ee883", "9fe2ff9ee4384b1894a90878d3e92bab"]}}}
REQ: curl -i 'http://10.11.101.6:8774/v2/cfb92f7692464dee8761b307d6f208c8/servers/detail' -X GET -H "X-Auth-Project-Id: serviceTenant" -H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-Auth-Token: a38d9b07a93f4a0a9e88456f02c8132d"
New session created for: (http://10.11.101.6:8774)
INFO (connectionpool:264) Starting new HTTP connection (1): 10.11.101.6
DEBUG (connectionpool:395) Setting read timeout to 600.0
DEBUG (connectionpool:435) "GET /v2/cfb92f7692464dee8761b307d6f208c8/servers/detail HTTP/1.1" 401 23
RESP: [401] CaseInsensitiveDict({'date': 'Fri, 10 Mar 2017 14:08:57 GMT', 'content-length': '23', 'content-type': 'text/plain', 'www-authenticate': "Keystone uri='http://10.11.101.4:5000/v2.0'"})
RESP BODY: Authentication required
DEBUG (shell:777) Unauthorized (HTTP 401)
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/novaclient/shell.py", line 774, in main
OpenStackComputeShell().main(map(strutils.safe_decode, sys.argv[1:]))
File "/usr/lib/python2.7/dist-packages/novaclient/shell.py", line 710, in main
args.func(self.cs, args)
File "/usr/lib/python2.7/dist-packages/novaclient/v1_1/shell.py", line 1138, in do_list
search_opts=search_opts)
File "/usr/lib/python2.7/dist-packages/novaclient/v1_1/servers.py", line 587, in list
return self._list("/servers%s%s" % (detail, query_string), "servers")
File "/usr/lib/python2.7/dist-packages/novaclient/base.py", line 64, in _list
_resp, body = self.api.client.get(url)
File "/usr/lib/python2.7/dist-packages/novaclient/client.py", line 283, in get
return self._cs_request(url, 'GET', **kwargs)
File "/usr/lib/python2.7/dist-packages/novaclient/client.py", line 275, in _cs_request
raise e
Unauthorized: Unauthorized (HTTP 401)
ERROR: Unauthorized (HTTP 401)
================================================================
下面是我的配置,请大神们帮忙瞧瞧
----------------环境变量-----------
export OS_TENANT_NAME=serviceTenant
export OS_USERNAME=service_admin
export OS_PASSWORD=service_pass
#export OS_TENANT_NAME=adminTenant
#export OS_USERNAME=admin
#export OS_PASSWORD=openstack
export OS_AUTH_URL=http://10.11.101.4:5000/v2.0/
-----------------------nova.conf片段--------------------------------------
[keystone_authtoken]
auth_uri = http://10.11.101.4:5000/v2.0
identity_uri = http://10.11.101.4:35357
admin_tenant_name = serviceTenant
admin_user = service_admin
admin_password = service_pass
------------------/etc/nova/apt-paste.ini片段---------------------
[filter:authtoken]
paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
service_port = 5000
service_host = 10.11.101.4
auth_port = 35357
auth_host = 10.11.101.4
auth_portocol = http
admin_tenant_name = serviceTenant
admin_user = service_admin
admin_password = service_pass
--------------------------keytone user-list-----------------------------
+----------------------------------+---------------+---------+---------------------+
| id | name | enabled | l |
+----------------------------------+---------------+---------+---------------------+
| 619d7898959247e68a370430890a31df | admin | True | |
| cb81cd2eb7fa4a2882b9a48042a83405 | service_admin | True | |
| 2289da485451440091716509655bd0ee | testuser | True | |
+----------------------------------+---------------+---------+---------------------+
|
|