Merge "Support standalone ironic"

This commit is contained in:
Jenkins 2015-06-05 13:35:05 +00:00 committed by Gerrit Code Review
commit 11ae20fbcc
3 changed files with 27 additions and 4 deletions

View File

@ -116,6 +116,15 @@
# Deprecated group/name - [discoverd]/ironic_retry_period
#ironic_retry_period = 5
# Method to use for authentication: noauth or keystone. (string value)
# Allowed values: keystone, noauth
#auth_strategy = keystone
# Ironic API URL, used to set Ironic API URL when auth_strategy option
# is noauth to work with standalone Ironic without keystone. (string
# value)
#ironic_url = http://localhost:6385/
[processing]

View File

@ -50,6 +50,15 @@ IRONIC_OPTS = [
help='Amount of time between attempts to connect to Ironic '
'on start up.',
deprecated_group='discoverd'),
cfg.StrOpt('auth_strategy',
default='keystone',
choices=('keystone', 'noauth'),
help='Method to use for authentication: noauth or keystone.'),
cfg.StrOpt('ironic_url',
default='http://localhost:6385/',
help='Ironic API URL, used to set Ironic API URL when '
'auth_strategy option is noauth to work with standalone '
'Ironic without keystone.'),
]

View File

@ -55,10 +55,15 @@ def spawn_n(*args, **kwargs):
def get_client(): # pragma: no cover
"""Get Ironic client instance."""
args = dict({'os_password': CONF.ironic.os_password,
'os_username': CONF.ironic.os_username,
'os_auth_url': CONF.ironic.os_auth_url,
'os_tenant_name': CONF.ironic.os_tenant_name})
# NOTE: To support standalone ironic without keystone
if CONF.ironic.auth_strategy == 'noauth':
args = dict({'os_auth_token': 'noauth',
'ironic_url': CONF.ironic.ironic_url})
else:
args = dict({'os_password': CONF.ironic.os_password,
'os_username': CONF.ironic.os_username,
'os_auth_url': CONF.ironic.os_auth_url,
'os_tenant_name': CONF.ironic.os_tenant_name})
return client.get_client(1, **args)