这里我们就要检查全局环境变量了
查看创建的admin-openrc.sh文件
发现*$HOST_NAME没有写
[root@controller ~]# cat admin-openrc.sh
export OS_PROJECT_DOMAIN_NAME=demo
export OS_USER_DOMAIN_NAME=demo
export OS_PROJECT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=000000
**export OS_AUTH_URL=http://**$HOST_NAME**:5000/v3**
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
改为controller,这里需要填写主机名
[root@controller ~]# cat admin-openrc.sh
export OS_PROJECT_DOMAIN_NAME=demo
export OS_USER_DOMAIN_NAME=demo
export OS_PROJECT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=000000
export OS_AUTH_URL=http://controller:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
问题都是粗心和初学者容易犯的错误,得多加细心
在source一下使变量生效,在去创建用户成功!!
[root@controller ~]# source admin-openrc.sh
[root@controller ~]# openstack user create --domain demo --password 000000 glance
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | 7c0d6c92b2d64972a91e5fb925442c43 |
| enabled | True |
| id | 79b2a63d86294a54b810d932d4f6258b |
| name | glance |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+