Consolidate IP address configuration

There are several IP address / hostname related configs (i.e. api.host_ip,
docker.docker_remote_api_host, websocket_proxy.wsproxy_host) that required
manual configuration by operators. Normally, these configs are default as
local IP / hostname. It is undesirable for operators to tune all these configs
repeatedly. Let's consolidate all these configurations into two defaults:

* [DEFAULT] my_ip: The IP address which the host is using to connect to the
* management network.
* [DEFAULT] host: Hostname, FQDN or IP address of this host.

Change-Id: Ie26578c4208a79e4306b1006c6b316a41c2b3540
Closes-Bug: #1723515
This commit is contained in:
Kien Nguyen 2017-10-16 13:31:00 +07:00
parent 761d1318b4
commit b64fdd331e
7 changed files with 34 additions and 35 deletions

View File

@ -18,8 +18,10 @@ api_service_opts = [
default=9517,
help='The port for the zun API server.'),
cfg.IPOpt('host_ip',
default='127.0.0.1',
help='The listen IP for the zun API server.'),
default='$my_ip',
help="The listen IP for the zun API server. "
"The default is ``$my_ip``, "
"the IP address of this host."),
cfg.BoolOpt('enable_ssl_api',
default=False,
help="Enable the integrated stand-alone API to service "

View File

@ -31,9 +31,10 @@ sql_opts = [
etcd_opts = [
cfg.HostAddressOpt('etcd_host',
default='127.0.0.1',
default='$my_ip',
help="Host IP address on which etcd service "
"running."),
"running. The default is ``$my_ip``, "
"the IP address of this host."),
cfg.PortOpt('etcd_port',
default=2379,
help="Port on which etcd listen client request.")

View File

@ -11,8 +11,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import socket
from oslo_config import cfg
docker_group = cfg.OptGroup(name='docker',
@ -46,8 +44,7 @@ docker_opts = [
help='Location of TLS private key file for '
'securing docker api requests (tlskey).'),
cfg.StrOpt('docker_remote_api_host',
default=socket.gethostname(),
sample_default='localhost',
default='$my_ip',
help='Defines the remote api host for the docker daemon.'),
cfg.StrOpt('docker_remote_api_port',
default='2375',

View File

@ -11,13 +11,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import socket
from oslo_config import cfg
from oslo_utils import netutils
netconf_opts = [
cfg.StrOpt("my_ip",
cfg.StrOpt('my_ip',
default=netutils.get_my_ipv4(),
sample_default='<host_ipv4>',
help="""
The IP address which the host is using to connect to the management network.
@ -27,30 +30,40 @@ Possible values:
Related options:
* docker_remote_api_host
* etcd_host
* wsproxy_host
* host_ip
* my_block_storage_ip
"""),
cfg.StrOpt('host',
default=socket.gethostname(),
sample_default='<current_hostname>',
help="""
Hostname, FQDN or IP address of this host. This can be an opaque identifier.
It is not necessarily a hostname, FQDN, or IP address. However, the node name
must be valid within an AMQP key, and if using ZeroMQ, a valid hostname,
FQDN, or IP address.
Possible values:
* String with hostname, FQDN or IP address. Default is hostname of this host.
"""),
cfg.StrOpt("my_block_storage_ip",
default="$my_ip",
help="""
The IP address which is used to connect to the block storage network.
Possible values:
* String with valid IP address. Default is IP address of this host.
Related options:
* my_ip - if my_block_storage_ip is not set, then my_ip value is used.
"""),
]
ALL_OPTS = (netconf_opts)
def register_opts(conf):
conf.register_opts(ALL_OPTS)
conf.register_opts(netconf_opts)
def list_opts():
return {"DEFAULT": ALL_OPTS}
return {'DEFAULT': netconf_opts}

View File

@ -14,23 +14,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import socket
from oslo_config import cfg
service_opts = [
cfg.HostAddressOpt('host',
default=socket.gethostname(),
sample_default='localhost',
help='Name of this node. This can be an '
'opaque identifier. It is not necessarily '
'a hostname, FQDN, or IP address. '
'However, the node name must be valid '
'within an AMQP key, and if using ZeroMQ, '
'a valid hostname, FQDN, or IP address.'),
]
periodic_opts = [
cfg.IntOpt('periodic_interval_max',
default=60,
@ -42,7 +28,7 @@ periodic_opts = [
'seconds.'),
]
ALL_OPTS = (service_opts + periodic_opts)
ALL_OPTS = (periodic_opts)
def register_opts(conf):

View File

@ -38,7 +38,7 @@ Related options:
* The port must be the same as ``wsproxy_port``in this section.
"""),
cfg.StrOpt('wsproxy_host',
default='127.0.0.1',
default='$my_ip',
help="""
The IP address which is used by the ``zun-wsproxy`` service to listen
for incoming requests.

View File

@ -20,7 +20,7 @@ from oslo_config import cfg
from zun.common import config
CONF = cfg.CONF
CONF.import_opt('host', 'zun.common.service')
CONF.import_opt('host', 'zun.conf')
CONF.import_opt('connection', 'oslo_db.options', group='database')
CONF.import_opt('sqlite_synchronous', 'oslo_db.options', group='database')