opsenstack glance client的安装和配置
glanceclient的安装和配置
搜索对应openstack版本,安装对应relaease版本,然后搜索glanceclient,安装。
dnf search all openstack
dnf install centos-release-openstack-yoga.noarch -y
dnf search all glance
dnf install python3-glanceclient
dnf install python3-glanceclient -y
环境配置
export OS_PROJECT_DOMAIN_NAME=Default
export OS_USER_DOMAIN_NAME=Default
# glance 在service项目下,这里选择service,需根据实际修改。
export OS_PROJECT_NAME=service
export OS_USERNAME=GLANCE
export OS_PASSWORD=GLANCE_PASS
# service对应的
export OS_PROJECT_ID=d660e1d89bca45329cd3bf9f7ef8368b
# identical api
export OS_AUTH_URL=http://OPENSTACK:5000/v3
export OS_IMAGE_URL=http://OPENSTACK:9292
# 这里的token需要认证获取。修改。
export OS_AUTH_TOKEN=gAAAAABknn-JUWRwbCrIl3FY4xtEtQ9FGMEBhn5q_umwBAXIJ3Qy8Bt237oiHmo3demVB2T2-5z7Jd2gAEWdDIiZNxgbCJi-ABGMtRNZov_gqHiEWH9fG1X27XQsNV6xZFMtt5ce82hR9LSHXDEtbsUfe-edaYspmeccdoAFpAR-p_dv04FAia8
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
获取token
curl -s -X POST $OS_AUTH_URL/auth/tokens?nocatalog -H "Content-Type: application/json" -d '{ "auth": { "identity": { "methods": ["password"],"password": {"user": {"domain": {"name": "'"$OS_USER_DOMAIN_NAME"'"},"name": "'"$OS_USERNAME"'", "password": "'"$OS_PASSWORD"'"} } }, "scope": { "project": { "domain": { "name": "'"$OS_PROJECT_DOMAIN_NAME"'" }, "name": "'"$OS_PROJECT_NAME"'" } } }}' -D - | awk '/X-Subject-Token/ { print $2 }'
获取token来修改环境变量值的token。
以下代码有问题,source ~/.bashrc
后报Invalid OpenStack Identity credentials.
。留着后续解决。
curl -s -X POST $OS_AUTH_URL/auth/tokens?nocatalog -H "Content-Type: application/json" -d '{ "auth": { "identity": { "methods": ["password"],"password": {"user": {"domain": {"name": "'"$OS_USER_DOMAIN_NAME"'"},"name": "'"$OS_USERNAME"'", "password": "'"$OS_PASSWORD"'"} } }, "scope": { "project": { "domain": { "name": "'"$OS_PROJECT_DOMAIN_NAME"'" }, "name": "'"$OS_PROJECT_NAME"'" } } }}' -D - | awk '/X-Subject-Token/ { print "/^export OS_AUTH_TOKEN=/s/=.*/=" $2 "/" }' | sed -i -f - ~/.bashrc
加载环境变量
source ~/.bashrc
glance测试
[root@spf-azkaban-4 data]# glance image-list
+--------------------------------------+-----------------------------------------+
| ID | Name |
+--------------------------------------+-----------------------------------------+
| a9dcc446-36f2-4a88-bcfd-75fce71ef65f | CentOS-7-x86_64-DVD-2009-iso |
| 795984c4-0984-4dba-a889-5abeb05c7036 | CentOS-7.9.2009-minimal |
| 7b85585a-20a1-460e-ad2e-ab46763b920d | CentOS-Stream-8-minimal |
+--------------------------------------+-----------------------------------------+
作者: 咕咚!
出处: https://www.cnblogs.com/linga/
关于作者:专注虚拟化,运维开发,RPA,Rust,Go,Python!
本文版权归作者和博客园共有,禁止*.csdn.net转载,禁止以盈利为目的的转载,转载文章,但未经作者同意必须保留此段声明,且在文章页面明显位置给出, 原文链接 如有问题, 可邮件(oldsixa@163.com)咨询.