Unify network devices and addresses in config

The old way of doing this was a little cumbersome, with an upper YAML
tree split between "devices" (name and MTU) and addresses. This commit
unifies these under the root "networking" section to make this section
clearer.
This commit is contained in:
Joshua Boniface 2019-06-17 23:41:07 -04:00
parent e70255dbd6
commit 1d3f868206
2 changed files with 33 additions and 37 deletions

View File

@ -124,31 +124,27 @@ pvc:
# networking: PVC networking configuration # networking: PVC networking configuration
# OPTIONAL if enable_networking: False # OPTIONAL if enable_networking: False
networking: networking:
# devices: Interface devices configuration # upstream: Upstream physical interface device
devices: upstream:
# upstream: Upstream physical interface device # name: Upstream interface name
upstream: name: ens4
# name: Upstream interface name # mtu: Upstream interface MTU; use 9000 for jumbo frames (requires switch support)
name: ens4 mtu: 1500
# mtu: Upstream interface MTU; use 9000 for jumbo frames (requires switch support) # address: Network address for upstream network, options: None, by-id, <static>/<mask>
mtu: 1500 address: None
# cluster: Cluster (VNIC) physical interface device # cluster: Cluster (VNIC) physical interface device
cluster: cluster:
# name: Cluster (VNIC) interface name # name: Cluster (VNIC) interface name
name: ens4 name: ens4
# mtu: Cluster (VNIC) interface MTU; use 9000 for jumbo frames (requires switch support) # mtu: Cluster (VNIC) interface MTU; use 9000 for jumbo frames (requires switch support)
mtu: 1500 mtu: 1500
# storage: Storage (Ceph OSD) physical interface device # address: Network address for cluster network, options: by-id, <static>/<mask>
storage: address: by-id
# name: Storace (Ceph OSD) interface name # storage: Storage (Ceph OSD) physical interface device
name: ens4 storage:
# mtu: Storage (Ceph OSD) interface MTU; use 9000 for jumbo frames (requires switch support) # name: Storace (Ceph OSD) interface name
mtu: 1500 name: ens4
# addresses: Special network addresses; by-id denotes "address octet equals host number", e.g. .3 for host3 # mtu: Storage (Ceph OSD) interface MTU; use 9000 for jumbo frames (requires switch support)
addresses: mtu: 1500
# upstream: Network address for upstream network, options: None, by-id, <static>/<mask> # address: Network address for storage network, options: by-id, <static>/<mask>
upstream: None address: by-id
# cluster: Network address for cluster network, options: by-id, <static>/<mask>
cluster: by-id
# storage: Network address for storage network, options: by-id, <static>/<mask>
storage: by-id

View File

@ -179,15 +179,15 @@ def readConfig(pvcd_config_file, myhostname):
'pdns_postgresql_dbname': o_config['pvc']['coordinator']['dns']['database']['name'], 'pdns_postgresql_dbname': o_config['pvc']['coordinator']['dns']['database']['name'],
'pdns_postgresql_user': o_config['pvc']['coordinator']['dns']['database']['user'], 'pdns_postgresql_user': o_config['pvc']['coordinator']['dns']['database']['user'],
'pdns_postgresql_password': o_config['pvc']['coordinator']['dns']['database']['pass'], 'pdns_postgresql_password': o_config['pvc']['coordinator']['dns']['database']['pass'],
'vni_dev': o_config['pvc']['system']['configuration']['networking']['devices']['cluster']['name'], 'vni_dev': o_config['pvc']['system']['configuration']['networking']['cluster']['name'],
'vni_mtu': o_config['pvc']['system']['configuration']['networking']['devices']['cluster']['mtu'], 'vni_mtu': o_config['pvc']['system']['configuration']['networking']['cluster']['mtu'],
'vni_dev_ip': o_config['pvc']['system']['configuration']['networking']['addresses']['cluster'], 'vni_dev_ip': o_config['pvc']['system']['configuration']['networking']['cluster']['address'],
'storage_dev': o_config['pvc']['system']['configuration']['networking']['devices']['storage']['name'], 'storage_dev': o_config['pvc']['system']['configuration']['networking']['storage']['name'],
'storage_mtu': o_config['pvc']['system']['configuration']['networking']['devices']['storage']['mtu'], 'storage_mtu': o_config['pvc']['system']['configuration']['networking']['storage']['mtu'],
'storage_dev_ip': o_config['pvc']['system']['configuration']['networking']['addresses']['storage'], 'storage_dev_ip': o_config['pvc']['system']['configuration']['networking']['storage']['address'],
'upstream_dev': o_config['pvc']['system']['configuration']['networking']['devices']['upstream']['name'], 'upstream_dev': o_config['pvc']['system']['configuration']['networking']['upstream']['name'],
'upstream_mtu': o_config['pvc']['system']['configuration']['networking']['devices']['upstream']['mtu'], 'upstream_mtu': o_config['pvc']['system']['configuration']['networking']['upstream']['mtu'],
'upstream_dev_ip': o_config['pvc']['system']['configuration']['networking']['addresses']['upstream'], 'upstream_dev_ip': o_config['pvc']['system']['configuration']['networking']['upstream']['address'],
} }
except Exception as e: except Exception as e:
print('ERROR: {}!'.format(e)) print('ERROR: {}!'.format(e))