Allow specifying a listen IP
Fixes: Bug #1183314 - Update api options in ceilometer/api - Create 'api' option group - Read options in bin/ceilometer-api - Update sample config - Updated tests Change-Id: Ic76d95f262ac9b0675cf37698c9bcdf65aff9821
This commit is contained in:
parent
2fcd26397a
commit
dc939cec5c
@ -40,7 +40,7 @@ if __name__ == '__main__':
|
||||
root = app.VersionSelectorApplication()
|
||||
|
||||
# Create the WSGI server and start it
|
||||
host, port = '0.0.0.0', int(cfg.CONF.metering_api_port)
|
||||
host, port = cfg.CONF.api.host, cfg.CONF.api.port
|
||||
srv = simple_server.make_server(host, port, root)
|
||||
|
||||
print 'Starting server in PID %s' % os.getpid()
|
||||
|
@ -20,9 +20,20 @@ from oslo.config import cfg
|
||||
|
||||
# Register options for the service
|
||||
API_SERVICE_OPTS = [
|
||||
cfg.IntOpt('metering_api_port',
|
||||
cfg.IntOpt('port',
|
||||
default=8777,
|
||||
deprecated_name='metering_api_port',
|
||||
deprecated_group='DEFAULT',
|
||||
help='The port for the ceilometer API server',
|
||||
),
|
||||
cfg.StrOpt('host',
|
||||
default='0.0.0.0',
|
||||
help='The listen IP for the ceilometer API server',
|
||||
),
|
||||
]
|
||||
cfg.CONF.register_opts(API_SERVICE_OPTS)
|
||||
|
||||
CONF = cfg.CONF
|
||||
opt_group = cfg.OptGroup(name='api',
|
||||
title='Options for the ceilometer-api service')
|
||||
CONF.register_group(opt_group)
|
||||
CONF.register_opts(API_SERVICE_OPTS, opt_group)
|
||||
|
@ -48,14 +48,6 @@
|
||||
#os_auth_url=http://localhost:5000/v2.0
|
||||
|
||||
|
||||
#
|
||||
# Options defined in ceilometer.api
|
||||
#
|
||||
|
||||
# The port for the ceilometer API server (integer value)
|
||||
#metering_api_port=8777
|
||||
|
||||
|
||||
#
|
||||
# Options defined in ceilometer.api.app
|
||||
#
|
||||
@ -515,6 +507,19 @@
|
||||
#cinder_control_exchange=cinder
|
||||
|
||||
|
||||
[api]
|
||||
|
||||
#
|
||||
# Options defined in ceilometer.api
|
||||
#
|
||||
|
||||
# The port for the ceilometer API server (integer value)
|
||||
#port=8777
|
||||
|
||||
# The listen IP for the ceilometer API server (string value)
|
||||
#host=0.0.0.0
|
||||
|
||||
|
||||
[publisher_udp]
|
||||
|
||||
#
|
||||
|
@ -72,8 +72,6 @@ class BinApiTestCase(base.TestCase):
|
||||
policy_file = self.path_get('tests/policy.json')
|
||||
with open(self.tempfile, 'w') as tmp:
|
||||
tmp.write("[DEFAULT]\n")
|
||||
tmp.write(
|
||||
"metering_api_port=%s\n" % self.api_port)
|
||||
tmp.write(
|
||||
"rpc_backend=ceilometer.openstack.common.rpc.impl_fake\n")
|
||||
tmp.write("database_connection=log://localhost\n")
|
||||
@ -85,6 +83,9 @@ class BinApiTestCase(base.TestCase):
|
||||
"pipeline_cfg_file=%s\n" % pipeline_cfg_file)
|
||||
tmp.write(
|
||||
"policy_file=%s\n" % policy_file)
|
||||
tmp.write("[api]\n")
|
||||
tmp.write(
|
||||
"port=%s\n" % self.api_port)
|
||||
self.subp = subprocess.Popen([self.path_get('bin/ceilometer-api'),
|
||||
"--config-file=%s" % self.tempfile])
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user