Register API options under the 'api' group
Register the API options under the 'api' group and change the name of the options to be less redundant. This patch also regenerates the sample config file. Change-Id: I55ec0b977275a394fef059a6318540bb5186ddc0 Closes-Bug: #1244742
This commit is contained in:
parent
6f45831b42
commit
808536e24e
|
@ -11,21 +11,6 @@
|
|||
#use_ipv6=false
|
||||
|
||||
|
||||
#
|
||||
# Options defined in ironic.api
|
||||
#
|
||||
|
||||
# IP for the Ironic API server to bind to (string value)
|
||||
#ironic_api_bind_ip=0.0.0.0
|
||||
|
||||
# The port for the Ironic API server (integer value)
|
||||
#ironic_api_port=6385
|
||||
|
||||
# the maximum number of items returned in a single response
|
||||
# from a collection resource (integer value)
|
||||
#api_limit_max=1000
|
||||
|
||||
|
||||
#
|
||||
# Options defined in ironic.api.app
|
||||
#
|
||||
|
@ -418,6 +403,17 @@
|
|||
#matchmaker_heartbeat_ttl=600
|
||||
|
||||
|
||||
[conductor]
|
||||
|
||||
#
|
||||
# Options defined in ironic.conductor.rpcapi
|
||||
#
|
||||
|
||||
# Maximum time, in seconds, since the last check-in of a
|
||||
# conductor (integer value)
|
||||
#max_time_interval=120
|
||||
|
||||
|
||||
[database]
|
||||
|
||||
#
|
||||
|
@ -481,17 +477,6 @@
|
|||
#connection_trace=false
|
||||
|
||||
|
||||
[ipmi]
|
||||
|
||||
#
|
||||
# Options defined in ironic.drivers.modules.ipminative
|
||||
#
|
||||
|
||||
# Maximum time in seconds to retry IPMI operations (integer
|
||||
# value)
|
||||
#retry_timeout=10
|
||||
|
||||
|
||||
[rpc_notifier2]
|
||||
|
||||
#
|
||||
|
@ -502,6 +487,23 @@
|
|||
#topics=notifications
|
||||
|
||||
|
||||
[api]
|
||||
|
||||
#
|
||||
# Options defined in ironic.api
|
||||
#
|
||||
|
||||
# The listen IP for the Ironic API server (string value)
|
||||
#host_ip=0.0.0.0
|
||||
|
||||
# The port for the Ironic API server (integer value)
|
||||
#port=6385
|
||||
|
||||
# The maximum number of items returned in a single response
|
||||
# from a collection resource (integer value)
|
||||
#max_limit=1000
|
||||
|
||||
|
||||
[matchmaker_redis]
|
||||
|
||||
#
|
||||
|
|
|
@ -19,22 +19,20 @@ from oslo.config import cfg
|
|||
|
||||
|
||||
API_SERVICE_OPTS = [
|
||||
cfg.StrOpt('ironic_api_bind_ip',
|
||||
default='0.0.0.0',
|
||||
help='IP for the Ironic API server to bind to',
|
||||
),
|
||||
cfg.IntOpt('ironic_api_port',
|
||||
default=6385,
|
||||
help='The port for the Ironic API server',
|
||||
),
|
||||
cfg.IntOpt('api_limit_max',
|
||||
cfg.StrOpt('host_ip',
|
||||
default='0.0.0.0',
|
||||
help='The listen IP for the Ironic API server'),
|
||||
cfg.IntOpt('port',
|
||||
default=6385,
|
||||
help='The port for the Ironic API server'),
|
||||
cfg.IntOpt('max_limit',
|
||||
default=1000,
|
||||
help='the maximum number of items returned in a single '
|
||||
help='The maximum number of items returned in a single '
|
||||
'response from a collection resource'),
|
||||
]
|
||||
]
|
||||
|
||||
CONF = cfg.CONF
|
||||
opt_group = cfg.OptGroup(name='api',
|
||||
title='Options for the ironic-api service')
|
||||
CONF.register_group(opt_group)
|
||||
CONF.register_opts(API_SERVICE_OPTS)
|
||||
CONF.register_opts(API_SERVICE_OPTS, opt_group)
|
||||
|
|
|
@ -28,7 +28,7 @@ def validate_limit(limit):
|
|||
if limit and limit < 0:
|
||||
raise wsme.exc.ClientSideError(_("Limit must be positive"))
|
||||
|
||||
return min(CONF.api_limit_max, limit) or CONF.api_limit_max
|
||||
return min(CONF.api.max_limit, limit) or CONF.api.max_limit
|
||||
|
||||
|
||||
def validate_sort_dir(sort_dir):
|
||||
|
|
|
@ -38,8 +38,8 @@ def main():
|
|||
ironic_service.prepare_service(sys.argv)
|
||||
|
||||
# Build and start the WSGI app
|
||||
host = CONF.ironic_api_bind_ip
|
||||
port = CONF.ironic_api_port
|
||||
host = CONF.api.host_ip
|
||||
port = CONF.api.port
|
||||
wsgi = simple_server.make_server(
|
||||
host, port,
|
||||
app.VersionSelectorApplication())
|
||||
|
|
|
@ -35,7 +35,7 @@ class TestApiUtils(base.FunctionalTest):
|
|||
|
||||
# max limit
|
||||
limit = utils.validate_limit(999999999)
|
||||
self.assertEqual(limit, CONF.api_limit_max)
|
||||
self.assertEqual(CONF.api.max_limit, limit)
|
||||
|
||||
# negative
|
||||
self.assertRaises(wsme.exc.ClientSideError, utils.validate_limit, -1)
|
||||
|
|
Loading…
Reference in New Issue