Support standalone ironic

Add two options in this patch to support standalone ironic without
keystone services.

*auth_strategy
*ironic_url

Change-Id: Iffa50a40971264aacc97f7210aa227a6655eaf42
Closes-bug: 1459471
This commit is contained in:
Haomeng, Wang
2015-06-03 06:34:16 +00:00
parent be9d533280
commit e6fb7bc385
3 changed files with 27 additions and 4 deletions

View File

@@ -113,6 +113,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

@@ -46,10 +46,15 @@ class Error(Exception):
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)