Only set ipv6 sysctl settings if ipv6 is enabled on the system.

Change-Id: If022867a28154019bc97cbd4ec6495ec60470d6d
Closes-Bug: #1675917
This commit is contained in:
Harald Jensas 2017-06-09 01:10:53 +02:00
parent 65b6027526
commit 11169db69b
3 changed files with 29 additions and 8 deletions

View File

@ -9,11 +9,7 @@ controller_admin_host: {{UNDERCLOUD_ADMIN_HOST}}
controller_public_host: {{UNDERCLOUD_PUBLIC_HOST}}
ntp::servers: {{UNDERCLOUD_NTP_SERVERS}}
sysctl_settings:
net.ipv4.ip_nonlocal_bind:
value: 1
net.ipv6.ip_nonlocal_bind:
value: 1
sysctl_settings: {{SYSCTL_SETTINGS}}
# SSL
tripleo::haproxy::service_certificate: {{UNDERCLOUD_SERVICE_CERTIFICATE}}

View File

@ -646,14 +646,23 @@ def _check_memory():
raise RuntimeError('Insufficient memory available')
def _check_ipv6_enabled():
"""Test if IPv6 is enabled
If /proc/net/if_inet6 exist ipv6 sysctl settings are available.
"""
return os.path.isfile('/proc/net/if_inet6')
def _check_sysctl():
"""Check sysctl option availability
The undercloud will not install properly if some of the expected sysctl
values are not available to be set.
"""
options = ['net.ipv4.ip_forward', 'net.ipv4.ip_nonlocal_bind',
'net.ipv6.ip_nonlocal_bind']
options = ['net.ipv4.ip_forward', 'net.ipv4.ip_nonlocal_bind']
if _check_ipv6_enabled():
options.append('net.ipv6.ip_nonlocal_bind')
not_available = []
for option in options:
@ -1002,7 +1011,7 @@ class InstackEnvironment(dict):
'TRIPLEO_INSTALL_USER', 'TRIPLEO_UNDERCLOUD_CONF_FILE',
'TRIPLEO_UNDERCLOUD_PASSWORD_FILE',
'ENABLED_POWER_INTERFACES',
'ENABLED_MANAGEMENT_INTERFACES'}
'ENABLED_MANAGEMENT_INTERFACES', 'SYSCTL_SETTINGS'}
"""The variables we calculate in _generate_environment call."""
PUPPET_KEYS = DYNAMIC_KEYS | {opt.name.upper() for _, group in list_opts()
@ -1027,6 +1036,14 @@ def _make_list(values):
return '[%s]' % ', '.join('"%s"' % item for item in values)
def _generate_sysctl_settings():
sysctl_settings = {}
sysctl_settings.update({"net.ipv4.ip_nonlocal_bind": {"value": 1}})
if _check_ipv6_enabled():
sysctl_settings.update({"net.ipv6.ip_nonlocal_bind": {"value": 1}})
return json.dumps(sysctl_settings)
def _generate_environment(instack_root):
"""Generate an environment dict for instack
@ -1133,6 +1150,8 @@ def _generate_environment(instack_root):
instack_env['ENABLED_POWER_INTERFACES'] = enabled_interfaces
instack_env['ENABLED_MANAGEMENT_INTERFACES'] = enabled_interfaces
instack_env['SYSCTL_SETTINGS'] = _generate_sysctl_settings()
if CONF.docker_registry_mirror:
instack_env['DOCKER_REGISTRY_MIRROR'] = CONF.docker_registry_mirror

View File

@ -0,0 +1,6 @@
---
fixes:
- The undercloud installer now checks if IPv6 is enabled before applying IPv6
specific sysctl settings that is only available when IPv6 is not disabled.
(Fixes `bug 1675917 <https://bugs.launchpad.net/tripleo/+bug/1675917>`__)