Metadata: Add bind_host to the config

This needs to be set to the nova interface to work.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
This commit is contained in:
Angus Salkeld 2012-05-07 18:25:03 +10:00
parent fa55a69842
commit 7a28922d1e
2 changed files with 7 additions and 7 deletions

View File

@ -39,13 +39,11 @@ from heat.common import config
from heat.common import wsgi
from heat import context
from paste import httpserver
from socket import gethostbyname, gethostname
LOG = logging.getLogger('heat.metadata')
def send_address_to_engine(port):
host = gethostbyname(gethostname())
def send_address_to_engine(host, port):
con = context.get_admin_context()
resp = rpc.call(con, 'engine',
{'method': 'metadata_register_address',
@ -63,8 +61,9 @@ if __name__ == '__main__':
app = config.load_paste_app(conf)
port = conf.bind_port
send_address_to_engine(port)
LOG.info(('Starting Heat Metadata on port %s') % port)
httpserver.serve(app, port=port)
host = conf.bind_host
send_address_to_engine(host, port)
LOG.info(('Starting Heat Metadata on %s:%s') % (host, port))
httpserver.serve(app, host=host, port=port)
except RuntimeError, e:
sys.exit("ERROR: %s" % e)

View File

@ -148,7 +148,8 @@ class HeatMetadataConfigOpts(cfg.CommonConfigOpts):
version='%%prog %s' % version.version_string(),
default_config_files=default_config_files,
**kwargs)
opts = [cfg.IntOpt('bind_port', default=8000)]
opts = [cfg.IntOpt('bind_port', default=8000),
cfg.StrOpt('bind_host', default='127.0.0.1')]
opts.extend(rpc_opts)
self.register_cli_opts(opts)