Add support for upstream default gateway

This commit is contained in:
Joshua Boniface 2019-03-17 00:36:19 -04:00
parent 12bc3acf85
commit 3aa8223504
2 changed files with 7 additions and 1 deletions

View File

@ -38,6 +38,8 @@ pvc:
network: "1.1.1.0/24" network: "1.1.1.0/24"
# floating_ip: Upstream floating IP address for the primary coordinator # floating_ip: Upstream floating IP address for the primary coordinator
floating_ip: "1.1.1.10/24" floating_ip: "1.1.1.10/24"
# gateway: Upstream static default gateway, if applicable
gateway: "1.1.1.1"
# cluster: Cluster internal network for node communication and client virtual networks # cluster: Cluster internal network for node communication and client virtual networks
cluster: cluster:
# domain: Cluster internal domain name # domain: Cluster internal domain name

View File

@ -170,6 +170,7 @@ def readConfig(pvcd_config_file, myhostname):
'upstream_domain': o_config['pvc']['cluster']['networks']['upstream']['domain'], 'upstream_domain': o_config['pvc']['cluster']['networks']['upstream']['domain'],
'upstream_floating_ip': o_config['pvc']['cluster']['networks']['upstream']['floating_ip'], 'upstream_floating_ip': o_config['pvc']['cluster']['networks']['upstream']['floating_ip'],
'upstream_network': o_config['pvc']['cluster']['networks']['upstream']['network'], 'upstream_network': o_config['pvc']['cluster']['networks']['upstream']['network'],
'upstream_gateway': o_config['pvc']['cluster']['gateways']['upstream']['gateway'],
'pdns_mysql_host': o_config['pvc']['coordinator']['dns']['database']['host'], 'pdns_mysql_host': o_config['pvc']['coordinator']['dns']['database']['host'],
'pdns_mysql_port': o_config['pvc']['coordinator']['dns']['database']['port'], 'pdns_mysql_port': o_config['pvc']['coordinator']['dns']['database']['port'],
'pdns_mysql_dbname': o_config['pvc']['coordinator']['dns']['database']['name'], 'pdns_mysql_dbname': o_config['pvc']['coordinator']['dns']['database']['name'],
@ -515,12 +516,15 @@ if enable_networking:
common.run_os_command('ip address add {} dev {}'.format(storage_dev_ip, storage_dev)) common.run_os_command('ip address add {} dev {}'.format(storage_dev_ip, storage_dev))
# Upstream configuration # Upstream configuration
if config['daemon_mode'] == 'coordinator': if config['upstream_dev']:
upstream_dev = config['upstream_dev'] upstream_dev = config['upstream_dev']
upstream_dev_ip = config['upstream_dev_ip'] upstream_dev_ip = config['upstream_dev_ip']
upstream_dev_gateway = config['upstream_gateway']
logger.out('Setting up Upstream network on interface {} with IP {}'.format(upstream_dev, upstream_dev_ip), state='i') logger.out('Setting up Upstream network on interface {} with IP {}'.format(upstream_dev, upstream_dev_ip), state='i')
common.run_os_command('ip link set {} up'.format(upstream_dev)) common.run_os_command('ip link set {} up'.format(upstream_dev))
common.run_os_command('ip address add {} dev {}'.format(upstream_dev_ip, upstream_dev)) common.run_os_command('ip address add {} dev {}'.format(upstream_dev_ip, upstream_dev))
if upstream_dev_dateway:
common.run_os_command('ip route add default via {} dev {}'.format(upstream_dev_gateway, upstream_dev))
############################################################################### ###############################################################################
# PHASE 7a - Ensure Libvirt is running on the local host # PHASE 7a - Ensure Libvirt is running on the local host