Drop bind_host/port
The bind_host option is used only for osprofiler. It is used to identify the host where the api service runs and can be replaced the `host` option. Also the port option is used only for logging. Change-Id: Ia55b269207987c419f30a4bfc0cebcf75d8fcb4a Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
This commit is contained in:
@@ -36,7 +36,6 @@ GITREPO["python-heatclient"]=${HEATCLIENT_REPO:-${GIT_BASE}/openstack/python-hea
|
||||
GITBRANCH["python-heatclient"]=${HEATCLIENT_BRANCH:-master}
|
||||
|
||||
HEAT_DIR=$DEST/heat
|
||||
HEAT_HTTPD_VHOST_FILES_DIR=$HEAT_DIR/etc/heat/httpd
|
||||
|
||||
HEAT_STANDALONE=$(trueorfalse False HEAT_STANDALONE)
|
||||
HEAT_ENABLE_ADOPT_ABANDON=$(trueorfalse False HEAT_ENABLE_ADOPT_ABANDON)
|
||||
@@ -45,9 +44,7 @@ HEAT_CONF=$HEAT_CONF_DIR/heat.conf
|
||||
HEAT_ENV_DIR=$HEAT_CONF_DIR/environment.d
|
||||
HEAT_TEMPLATES_DIR=$HEAT_CONF_DIR/templates
|
||||
HEAT_API_HOST=${HEAT_API_HOST:-$SERVICE_HOST}
|
||||
HEAT_API_PORT=${HEAT_API_PORT:-8004}
|
||||
HEAT_API_CFN_HOST=${HEAT_API_CFN_HOST:-$SERVICE_HOST}
|
||||
HEAT_API_CFN_PORT=${HEAT_API_CFN_PORT:-8000}
|
||||
HEAT_SERVICE_USER=${HEAT_SERVICE_USER:-heat}
|
||||
HEAT_TRUSTEE_USER=${HEAT_TRUSTEE_USER:-$HEAT_SERVICE_USER}
|
||||
HEAT_TRUSTEE_PASSWORD=${HEAT_TRUSTEE_PASSWORD:-$SERVICE_PASSWORD}
|
||||
@@ -150,7 +147,7 @@ function configure_heat {
|
||||
|
||||
if [[ "$HEAT_STANDALONE" = "True" ]]; then
|
||||
iniset $HEAT_CONF paste_deploy flavor standalone
|
||||
iniset $HEAT_CONF clients_heat url "http://$HEAT_API_HOST:$HEAT_API_PORT/v1/%(tenant_id)s"
|
||||
iniset $HEAT_CONF clients_heat url "$SERVICE_PROTOCOL://$HEAT_API_HOST/heat-api/v1/%(tenant_id)s"
|
||||
else
|
||||
configure_keystone_authtoken_middleware $HEAT_CONF heat
|
||||
fi
|
||||
@@ -168,12 +165,6 @@ function configure_heat {
|
||||
# clients_keystone
|
||||
iniset $HEAT_CONF clients_keystone auth_uri $KEYSTONE_AUTH_URI
|
||||
|
||||
# OpenStack API
|
||||
iniset $HEAT_CONF heat_api bind_port $HEAT_API_PORT
|
||||
iniset $HEAT_CONF heat_api workers "$API_WORKERS"
|
||||
# Cloudformation API
|
||||
iniset $HEAT_CONF heat_api_cfn bind_port $HEAT_API_CFN_PORT
|
||||
|
||||
if is_service_enabled tls-proxy; then
|
||||
iniset $HEAT_CONF clients_keystone ca_file $SSL_BUNDLE_FILE
|
||||
iniset $HEAT_CONF clients_nova ca_file $SSL_BUNDLE_FILE
|
||||
|
@@ -111,23 +111,15 @@ new REST and CFN API services, you must run:
|
||||
python bin/heat-api --config-file=/etc/heat/heat.conf
|
||||
python bin/heat-api-cfn --config-file=/etc/heat/heat.conf
|
||||
|
||||
Each API service must have a unique address to listen. This address have to be
|
||||
defined in the configuration file. For REST and CFN APIs, modify the
|
||||
*[heat_api]* and *[heat_api_cfn]* blocks, respectively.
|
||||
Each API service must have a unique address to listen. Also the host value
|
||||
should be unique.
|
||||
::
|
||||
|
||||
[heat_api]
|
||||
bind_port = {API_PORT}
|
||||
bind_host = {API_HOST}
|
||||
|
||||
...
|
||||
|
||||
[heat_api_cfn]
|
||||
bind_port = {API_CFN_PORT}
|
||||
bind_host = {API_CFN_HOST}
|
||||
[DEFAULT]
|
||||
host = {host}
|
||||
|
||||
If you wish to run multiple API processes on the same machine, you must create
|
||||
multiple copies of the heat.conf file, each containing a unique port number.
|
||||
multiple copies of the heat.conf file, each containing a unique host string.
|
||||
|
||||
In addition, if you want to run some API services in different machines than
|
||||
the devstack server, you have to update the loopback addresses found at the
|
||||
@@ -164,13 +156,6 @@ This way, there is no need to update, on the CLI, the addresses where it should
|
||||
look for the APIs. In this case, when it makes a call to any API, it will find
|
||||
the proxy, acting on their behalf.
|
||||
|
||||
Note that the addresses that the HAProxy will be listening to are the pairs
|
||||
*API_HOST:API-PORT* and *API_CFN_HOST:API_CFN_PORT*, found at the *[heat_api]*
|
||||
and *[heat_api_cfn]* blocks on the devstack server's configuration file. In
|
||||
addition, the original *heat-api* and *heat-api-cfn* processes running in these
|
||||
ports have to be killed, because these addresses must be free to be used by the
|
||||
proxy.
|
||||
|
||||
To deploy the HAProxy server on the devstack server, run
|
||||
*haproxy -f apis-proxy.conf*, where this configuration file looks like:
|
||||
::
|
||||
@@ -288,14 +273,8 @@ The original file from A looks like:
|
||||
...
|
||||
sql_connection = mysql+pymysql://root:admin@127.0.0.1/heat?charset=utf8
|
||||
rabbit_host = localhost
|
||||
host = localhost
|
||||
...
|
||||
[heat_api]
|
||||
bind_port = 8004
|
||||
bind_host = 10.0.0.1
|
||||
...
|
||||
[heat_api_cfn]
|
||||
bind_port = 8000
|
||||
bind_host = 10.0.0.1
|
||||
|
||||
After the changes for B, it looks like:
|
||||
::
|
||||
@@ -304,14 +283,8 @@ After the changes for B, it looks like:
|
||||
...
|
||||
sql_connection = mysql+pymysql://root:admin@10.0.0.1/heat?charset=utf8
|
||||
rabbit_host = 10.0.0.1
|
||||
host = 10.0.0.2
|
||||
...
|
||||
[heat_api]
|
||||
bind_port = 8004
|
||||
bind_host = 10.0.0.2
|
||||
...
|
||||
[heat_api_cfn]
|
||||
bind_port = 8000
|
||||
bind_host = 10.0.0.2
|
||||
|
||||
Setting Up HAProxy
|
||||
------------------
|
||||
|
@@ -42,14 +42,9 @@ def init_application():
|
||||
version=version.version_info.version_string())
|
||||
logging.setup(CONF, CONF.prog)
|
||||
logging.set_defaults()
|
||||
LOG = logging.getLogger(CONF.prog)
|
||||
config.set_config_defaults()
|
||||
messaging.setup()
|
||||
|
||||
port = CONF.heat_api_cfn.bind_port
|
||||
host = CONF.heat_api_cfn.bind_host
|
||||
LOG.info('Starting Heat API on %(host)s:%(port)s',
|
||||
{'host': host, 'port': port})
|
||||
profiler.setup(CONF.prog, host)
|
||||
profiler.setup(CONF.prog, CONF.host)
|
||||
|
||||
return config.load_paste_app()
|
||||
|
@@ -40,13 +40,8 @@ def init_application():
|
||||
version = hversion.version_info.version_string()
|
||||
CONF(project='heat', prog='heat-api', version=version)
|
||||
logging.setup(CONF, CONF.prog)
|
||||
LOG = logging.getLogger(CONF.prog)
|
||||
config.set_config_defaults()
|
||||
messaging.setup()
|
||||
|
||||
port = CONF.heat_api.bind_port
|
||||
host = CONF.heat_api.bind_host
|
||||
profiler.setup(CONF.prog, host)
|
||||
LOG.info('Starting Heat REST API on %(host)s:%(port)s',
|
||||
{'host': host, 'port': port})
|
||||
profiler.setup(CONF.prog, CONF.host)
|
||||
return config.load_paste_app()
|
||||
|
@@ -40,34 +40,6 @@ from heat.common import serializers
|
||||
LOG = logging.getLogger(__name__)
|
||||
URL_LENGTH_LIMIT = 50000
|
||||
|
||||
api_opts = [
|
||||
cfg.IPOpt('bind_host', default='0.0.0.0',
|
||||
help=_('Address to bind the server. Useful when '
|
||||
'selecting a particular network interface.'),
|
||||
deprecated_group='DEFAULT'),
|
||||
cfg.PortOpt('bind_port', default=8004,
|
||||
help=_('The port on which the server will listen.'),
|
||||
deprecated_group='DEFAULT'),
|
||||
]
|
||||
api_group = cfg.OptGroup('heat_api')
|
||||
cfg.CONF.register_group(api_group)
|
||||
cfg.CONF.register_opts(api_opts,
|
||||
group=api_group)
|
||||
|
||||
api_cfn_opts = [
|
||||
cfg.IPOpt('bind_host', default='0.0.0.0',
|
||||
help=_('Address to bind the server. Useful when '
|
||||
'selecting a particular network interface.'),
|
||||
deprecated_group='DEFAULT'),
|
||||
cfg.PortOpt('bind_port', default=8000,
|
||||
help=_('The port on which the server will listen.'),
|
||||
deprecated_group='DEFAULT'),
|
||||
]
|
||||
api_cfn_group = cfg.OptGroup('heat_api_cfn')
|
||||
cfg.CONF.register_group(api_cfn_group)
|
||||
cfg.CONF.register_opts(api_cfn_opts,
|
||||
group=api_cfn_group)
|
||||
|
||||
json_size_opt = cfg.IntOpt('max_json_body_size',
|
||||
default=1048576,
|
||||
help=_('Maximum raw byte size of JSON request body.'
|
||||
@@ -77,13 +49,6 @@ cfg.CONF.register_opt(json_size_opt)
|
||||
|
||||
def list_opts():
|
||||
yield None, [json_size_opt]
|
||||
yield 'heat_api', api_opts
|
||||
yield 'heat_api_cfn', api_cfn_opts
|
||||
|
||||
|
||||
def get_bind_addr(conf, default_port=None):
|
||||
"""Return the host and port to bind to."""
|
||||
return (conf.bind_host, conf.bind_port or default_port)
|
||||
|
||||
|
||||
class Middleware(object):
|
||||
|
Reference in New Issue
Block a user