Add missing domain name to novaclient
Domain name is needed when using keystone v3 to create keystoneauth session[1], otherwise the following error will be raised: InvalidInput: Invalid input received: Expecting to find domain in project - the server could not comply with the request since it is either malformed or otherwise incorrect [1]: https://docs.openstack.org/keystoneauth/latest/authentication-plugins.html#v3-identity-plugins Change-Id: I557a7107b51ae4ffab15d045a4be6e3ed1940bd8 Closes-bug: #1710570
This commit is contained in:
parent
237bee37f8
commit
6139da28da
@ -107,10 +107,13 @@ def novaclient(context, timeout=None):
|
|||||||
# project_name, let's build a Keystone session.
|
# project_name, let's build a Keystone session.
|
||||||
loader = keystoneauth1.loading.get_plugin_loader(
|
loader = keystoneauth1.loading.get_plugin_loader(
|
||||||
CONF.keystone_authtoken.auth_type)
|
CONF.keystone_authtoken.auth_type)
|
||||||
auth = loader.load_from_options(auth_url=url,
|
auth = loader.load_from_options(
|
||||||
username=context.user_id,
|
auth_url=url,
|
||||||
password=context.auth_token,
|
username=context.user_id,
|
||||||
project_name=context.project_name)
|
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)
|
keystone_session = keystoneauth1.session.Session(auth=auth)
|
||||||
|
|
||||||
client_obj = nova_client.Client(
|
client_obj = nova_client.Client(
|
||||||
|
@ -45,6 +45,14 @@ nova_opts = [
|
|||||||
cfg.URIOpt('os_privileged_user_auth_url',
|
cfg.URIOpt('os_privileged_user_auth_url',
|
||||||
help='Auth URL associated with the OpenStack privileged '
|
help='Auth URL associated with the OpenStack privileged '
|
||||||
'account.'),
|
'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.'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,7 +51,8 @@ class NovaClientTestCase(test.TestCase):
|
|||||||
nova.novaclient(self.ctx)
|
nova.novaclient(self.ctx)
|
||||||
p_plugin_loader.return_value.load_from_options.assert_called_once_with(
|
p_plugin_loader.return_value.load_from_options.assert_called_once_with(
|
||||||
auth_url='http://keystonehost/identity',
|
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_client.assert_called_once_with(
|
||||||
p_api_version(nova.NOVA_API_VERSION),
|
p_api_version(nova.NOVA_API_VERSION),
|
||||||
@ -69,7 +70,8 @@ class NovaClientTestCase(test.TestCase):
|
|||||||
nova.novaclient(self.ctx)
|
nova.novaclient(self.ctx)
|
||||||
p_plugin_loader.return_value.load_from_options.assert_called_once_with(
|
p_plugin_loader.return_value.load_from_options.assert_called_once_with(
|
||||||
auth_url='http://keystonehost/identity',
|
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_client.assert_called_once_with(
|
||||||
p_api_version(nova.NOVA_API_VERSION),
|
p_api_version(nova.NOVA_API_VERSION),
|
||||||
@ -89,7 +91,8 @@ class NovaClientTestCase(test.TestCase):
|
|||||||
nova.novaclient(self.ctx)
|
nova.novaclient(self.ctx)
|
||||||
p_plugin_loader.return_value.load_from_options.assert_called_once_with(
|
p_plugin_loader.return_value.load_from_options.assert_called_once_with(
|
||||||
auth_url='http://keystonehost/identity',
|
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_client.assert_called_once_with(
|
||||||
p_api_version(nova.NOVA_API_VERSION),
|
p_api_version(nova.NOVA_API_VERSION),
|
||||||
@ -108,7 +111,8 @@ class NovaClientTestCase(test.TestCase):
|
|||||||
nova.novaclient(self.ctx)
|
nova.novaclient(self.ctx)
|
||||||
p_plugin_loader.return_value.load_from_options.assert_called_once_with(
|
p_plugin_loader.return_value.load_from_options.assert_called_once_with(
|
||||||
auth_url='http://keystonehost/identity',
|
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_client.assert_called_once_with(
|
||||||
p_api_version(nova.NOVA_API_VERSION),
|
p_api_version(nova.NOVA_API_VERSION),
|
||||||
|
@ -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.
|
Loading…
Reference in New Issue
Block a user