Merge "Add missing domain name to novaclient"

This commit is contained in:
Jenkins 2017-08-16 07:11:18 +00:00 committed by Gerrit Code Review
commit f9d67962e7
4 changed files with 29 additions and 8 deletions

View File

@ -107,10 +107,13 @@ def novaclient(context, timeout=None):
# project_name, let's build a Keystone session.
loader = keystoneauth1.loading.get_plugin_loader(
CONF.keystone_authtoken.auth_type)
auth = loader.load_from_options(auth_url=url,
username=context.user_id,
password=context.auth_token,
project_name=context.project_name)
auth = loader.load_from_options(
auth_url=url,
username=context.user_id,
password=context.auth_token,
project_name=context.project_name,
user_domain_name=CONF.os_user_domain_name,
project_domain_name=CONF.os_project_domain_name)
keystone_session = keystoneauth1.session.Session(auth=auth)
client_obj = nova_client.Client(

View File

@ -45,6 +45,14 @@ nova_opts = [
cfg.URIOpt('os_privileged_user_auth_url',
help='Auth URL associated with the OpenStack privileged '
'account.'),
cfg.StrOpt('os_user_domain_name',
default="default",
help='User domain name associated with the OpenStack '
'privileged account.'),
cfg.StrOpt('os_project_domain_name',
default="default",
help='Project domain name associated with the OpenStack '
'privileged account.'),
]

View File

@ -51,7 +51,8 @@ class NovaClientTestCase(test.TestCase):
nova.novaclient(self.ctx)
p_plugin_loader.return_value.load_from_options.assert_called_once_with(
auth_url='http://keystonehost/identity',
password='strongpassword', project_name=None, username='adminuser'
password='strongpassword', project_domain_name='default',
project_name=None, user_domain_name='default', username='adminuser'
)
p_client.assert_called_once_with(
p_api_version(nova.NOVA_API_VERSION),
@ -69,7 +70,8 @@ class NovaClientTestCase(test.TestCase):
nova.novaclient(self.ctx)
p_plugin_loader.return_value.load_from_options.assert_called_once_with(
auth_url='http://keystonehost/identity',
password='strongpassword', project_name=None, username='adminuser'
password='strongpassword', project_domain_name='default',
project_name=None, user_domain_name='default', username='adminuser'
)
p_client.assert_called_once_with(
p_api_version(nova.NOVA_API_VERSION),
@ -89,7 +91,8 @@ class NovaClientTestCase(test.TestCase):
nova.novaclient(self.ctx)
p_plugin_loader.return_value.load_from_options.assert_called_once_with(
auth_url='http://keystonehost/identity',
password='strongpassword', project_name=None, username='adminuser'
password='strongpassword', project_domain_name='default',
project_name=None, user_domain_name='default', username='adminuser'
)
p_client.assert_called_once_with(
p_api_version(nova.NOVA_API_VERSION),
@ -108,7 +111,8 @@ class NovaClientTestCase(test.TestCase):
nova.novaclient(self.ctx)
p_plugin_loader.return_value.load_from_options.assert_called_once_with(
auth_url='http://keystonehost/identity',
password='strongpassword', project_name=None, username='adminuser'
password='strongpassword', project_domain_name='default',
project_name=None, user_domain_name='default', username='adminuser'
)
p_client.assert_called_once_with(
p_api_version(nova.NOVA_API_VERSION),

View File

@ -0,0 +1,6 @@
---
prelude: >
Domain name is needed when using keystone v3 to create keystone session,
if not provided, InvalidInput exception will be raised. Two new options
"os_user_domain_name" and "os_project_domain_name" with default value
"default" are added to fix the issue.