Use sysctl to enable net.ipv4.ip_forward separately

Use sysctl to enable net.ipv4.ip_forward separately instead of
reloading the whole sysctl.conf.

Change-Id: Ia334793972a5357edfe29d7dba2d448273a72c75
This commit is contained in:
jianghua wang 2017-03-07 18:47:45 +08:00
parent beae63e184
commit fdf8795844
1 changed files with 5 additions and 2 deletions

View File

@ -143,9 +143,12 @@ def install_suppack(himn, username, package, xcp_version):
def forward_from_himn(eth):
"""Forward packets from HIMN to storage/mgmt network. """
utils.execute('sed', '-i', 's/#net.ipv4.ip_forward/net.ipv4.ip_forward/g',
# make change to be persistent
utils.execute('sed', '-i',
's/.*net\.ipv4\.ip_forward.*=.*/net.ipv4.ip_forward=1/g',
'/etc/sysctl.conf')
utils.execute('sysctl', '-p', '/etc/sysctl.conf')
# make it to take effective now.
utils.execute('sysctl', 'net.ipv4.ip_forward=1')
endpoint_names = ['br-storage', 'br-mgmt']
for endpoint_name in endpoint_names: