python openstack oslo_config使用_使用Python API创建OpenStack客户端实例时如何指定区域名...

我想在这里分享我的测试结果:

使用keystneauth会话API和Identity API v3:from novaclient import client as novaclient

from keystoneauth1.identity import v3

from keystoneauth1 import session

auth = v3.Password(URL,username="username",password="password", project_name="admin", user_domain_id="default", project_domain_id="default")

sess = session.Session(auth=auth)

nova_client = novaclient.Client(2, session=sess, region_name="RegionName")

很好。在

使用凭据和标识API v2:

从novaclient导入client作为novaclient

新星=novaclient.客户(版本、用户、密码、项目标识、身份验证URL_v2、region_name='RegionName')

很好。在

使用凭据和标识API v3:

^{pr2}$

它实际上不适用于错误消息:nova.hypervisors.list()

keystoneauth1.exceptions.http.BadRequest: Expecting to find domain in user - the server could not comply with the request since it is either malformed or otherwise incorrect. The client is assumed to be in error. (HTTP 400)

所以我的结论是novaclient不支持3)Identity API V3和凭证。我们可以使用1)Identity API v3与keystoneauth会话,2)使用带凭据的Identity API V2

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值