<本文转自 http://manual.blog.51cto.com/3300438/973921>

三、验证

安装curl,一个运行REST API请求的命令行工具,同时还需要安装openssl,通过yum安装可以解决依赖包问题:

$ yum  install  curl   openssl


你可以运行如下命令,确保你的Identity服务可以正常工作:

curl -d '{"auth": {"tenantName": "adminTenant", "passwordCredentials":{"username": "adminUser", "password": "secretword"}}}'   \

-H "Content-type:application/json" http://192.168.206.130:35357/v2.0/tokens | python -mjson.tool

作为adminUser用户,你将收到如下响应:

{

"access": {
"serviceCatalog": {},
"token": {
"expires": "2012-04-12T00:40:12Z",
"id": "cec68088d08747639c682ee5228106d1"
},
"user": {
"id": "6b0141904f09480d810a5949d79ea0f3",
"name": "adminUser",
"roles": [],
"roles_links": [],
"username": "adminUser"
}
}
}

或者你可以运行以下命令:

curl -d '{"auth": {"tenantName": "openstackDemo", "passwordCredentials":{"username": "adminUser", "password": "secretword"}}}' \

-H "Content-type:application/json" http://192.168.206.130:35357/v2.0/tokens | python -mjson.tool

你会收到类似于如下的信息:
{
"access": {
"serviceCatalog": {},
"token": {
"expires": "2012-04-12T00:41:21Z",
"id": "a220bfdf313b404fa5e063fcc7cc1f3e",
"tenant": {
"description": "Default Tenant",
"enabled": true,
"id": "50af8cc655c24ada96f73010c96b70a2",
"name": "openstackDemo"
}
},
"user": {
"id": "6b0141904f09480d810a5949d79ea0f3",
"name": "adminUser",
"roles": [],
"roles_links": [],
"username": "adminUser"
}
}
}

这里另外还有一种快速的方法判断Keystone是否工作正常。首先,需要设置如下环境变量:

export ADMIN_TOKEN=012345SECRET99TOKEN012345

export OS_USERNAME=adminUser

export OS_PASSWORD=secretword

export OS_TENANT_NAME=openstackDemo

export OS_AUTH_URL=http://127.0.0.1:5000/v2.0/

通过输入keystone  user-list命令,你可以看到用户列表。

$ keystone user-list

Image text



blog comments powered by Disqus

Published

26 April 2013

Tags