获取token

[root@controller ~]# openstack token issue |awk '/ id /{print $4}'
gAAAAABaa0MpXNGCHgaytnvyPMbIF3IecIu9jA4WeMaL1kLWueNYs_Q1APXwdXDU7K34wdLg0I1spUIzDhAkst-Qdrizn_L3N5YBlApUrkY7gSw96MkKpTTDjUhIgm0eAD85Ayi6TL_1HmJJQIhm5ERY91zcKi9dvl73jj0dFNDWRqD9Cc9_oPA
将获取token给变量复制

token= token=openstack token issue |awk '/ id /{print $4}'`
1.16.2 常用获取命令
参考:http://www.qstack.com.cn/archives/168.html

使用api端口查看镜像列表

curl -H "X-Auth-Token:$token" -H "Content-Type: application/json" http://10.0.0.32:9292/v2/images
获取roles列表

curl -H "X-Auth-Token:$token" -H "Content-Type: application/json" http://10.0.0.11:35357/v3/roles
获取主机列表

curl -H "X-Auth-Token:$token" -H "Content-Type: application/json" http://10.0.0.11:8774/v2.1/servers
获取网络列表

curl -H "X-Auth-Token:$token" -H "Content-Type: application/json" http://10.0.0.11:9696/v2.0/networks
获取子网列表

curl -H "X-Auth-Token:$token" -H "Content-Type: application/json" http://10.0.0.11:9696/v2.0/subnets
下载一个镜像

curl -o clsn.qcow2 -H "X-Auth-Token:$token" -H "Content-Type: application/json" http://10.0.0.11:9292/v2/images/eb9e7015-d5ef-48c7-bd65-88a144c59115/file
1.17 附录
1.17.1 附录-常见错误
1、配置用户时的错误

【错误】Multiple service matches found for 'identity', use an ID to be more specific.

解决办法:

openstack endpoint list # 查看列表

openstack endpoint delete  'id'  # 利用ID删除API 端点

openstack service list  # 查看服务列表

2、用户管理时错误

HTTP 503错误:

glance日志位置: /var/log/glance/

用户删除后,重新重建用户后,再关联次角色

openstack role add --project service --user glance admin

3、未加载环境变量时出错

[root@controller ~]# openstack user list

Missing parameter(s):

Set a username with --os-username, OS_USERNAME, or auth.username

Set an authentication URL, with --os-auth-url, OS_AUTH_URL or auth.auth_url

Set a scope, such as a project or domain, set a project scope with --os-project-name, OS_PROJECT_NAME or auth.project_name, set a domain scope with --os-domain-name, OS_DOMAIN_NAME or auth.domain_name

posted on 2020-02-03 15:05  砖头哥-  阅读(682)  评论(0编辑  收藏  举报