openstack kilo 命令行

把下面内容放到.bashrc中,或者直接执行也行。

export OS_USERNAME=admin
export OS_PASSWORD=admin              #根据实际密码来设   
export OS_PROJECT_NAME=admin
export OS_AUTH_URL=http://localhost:35357/v2.0
export OS_IDENTITY_API_VERSION=2
export OS_TENANT_ID=06bb27f1c72d46b38fabd62cb1ee6d5c   #这个获取方法见下文

 

通过查询数据库可获得auth_url 与 tenant_id

mysql -u root
show databases;
use keystone;
show tables;
select * from endpoint;

会看到http://10.0.3.41:35357/v2.0

select * from token;

会看到tenant,找到id, 这里是06bb27f1c72d46b38fabd62cb1ee6d5c

 

另外一个方法获取admin tenant id:

-> # keystone tenant-list
+----------------------------------+----------+---------+
|                id                |   name   | enabled |
+----------------------------------+----------+---------+
| 74288c12eb5f47aeab9c5df2c1faf57e |  admin   |   True  |
| 4fd7c32848254b34be0b977e1bd1c2cc | services |   True  |
+----------------------------------+----------+---------+

如果上面命令执行不了,先执行:

export OS_SERVICE_TOKEN=165a1766c12a497b8fbb18867c212aaa    //见/etc/keystone/keystone中的admin_token

export OS_SERVICE_ENDPOINT=http://10.0.2.245:35357/v2.0

 

问题:

如果在导出时导出了

export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default

执行nova命令会出现下面错误:

ERROR (DiscoveryFailure): Could not determine a suitable URL for the plugin

详细解释及参考链接:https://ask.openstack.org/en/question/80400/using-nova-client-in-windows-error-discoveryfailure-could-not-determine-a-suitable-url-for-the-plugin/

This error is related to the version of Keystone API you're using. As noted in https://bugs.launchpad.net/python-openstackclient/+bug/1447704 (this open bug report), it does not work when using an OS_AUTH_URL ending in "v2.0" and the variables OS_PROJECT_DOMAIN_ID and OS_USER_DOMAIN_ID are set.

The workaround is to remove the variables OS_PROJECT_DOMAIN_ID and OS_USER_DOMAIN_ID if you wish to use v2 of the Keystone API.

posted @ 2019-04-24 17:15  kissrule  阅读(314)  评论(0编辑  收藏  举报