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
# OPTIONAL if enable_networking: False
networking:
# devices: Interface devices configuration
devices:
# upstream: Upstream physical interface device
upstream:
# name: Upstream interface name
name: ens4
# mtu: Upstream interface MTU; use 9000 for jumbo frames (requires switch support)
mtu: 1500
# cluster: Cluster (VNIC) physical interface device
cluster:
# name: Cluster (VNIC) interface name
name: ens4
# mtu: Cluster (VNIC) interface MTU; use 9000 for jumbo frames (requires switch support)
mtu: 1500
# storage: Storage (Ceph OSD) physical interface device
storage:
# name: Storace (Ceph OSD) interface name
name: ens4
# mtu: Storage (Ceph OSD) interface MTU; use 9000 for jumbo frames (requires switch support)
mtu: 1500
# addresses: Special network addresses; by-id denotes "address octet equals host number", e.g. .3 for host3
addresses:
# upstream: Network address for upstream network, options: None, by-id, <static>/<mask>
upstream: None
# 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
# upstream: Upstream physical interface device
upstream:
# name: Upstream interface name
name: ens4
# mtu: Upstream interface MTU; use 9000 for jumbo frames (requires switch support)
mtu: 1500
# address: Network address for upstream network, options: None, by-id, <static>/<mask>
address: None
# cluster: Cluster (VNIC) physical interface device
cluster:
# name: Cluster (VNIC) interface name
name: ens4
# mtu: Cluster (VNIC) interface MTU; use 9000 for jumbo frames (requires switch support)
mtu: 1500
# address: Network address for cluster network, options: by-id, <static>/<mask>
address: by-id
# storage: Storage (Ceph OSD) physical interface device
storage:
# name: Storace (Ceph OSD) interface name
name: ens4
# mtu: Storage (Ceph OSD) interface MTU; use 9000 for jumbo frames (requires switch support)
mtu: 1500
# address: Network address for storage network, options: by-id, <static>/<mask>
address: 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_user': o_config['pvc']['coordinator']['dns']['database']['user'],
'pdns_postgresql_password': o_config['pvc']['coordinator']['dns']['database']['pass'],
'vni_dev': o_config['pvc']['system']['configuration']['networking']['devices']['cluster']['name'],
'vni_mtu': o_config['pvc']['system']['configuration']['networking']['devices']['cluster']['mtu'],
'vni_dev_ip': o_config['pvc']['system']['configuration']['networking']['addresses']['cluster'],
'storage_dev': o_config['pvc']['system']['configuration']['networking']['devices']['storage']['name'],
'storage_mtu': o_config['pvc']['system']['configuration']['networking']['devices']['storage']['mtu'],
'storage_dev_ip': o_config['pvc']['system']['configuration']['networking']['addresses']['storage'],
'upstream_dev': o_config['pvc']['system']['configuration']['networking']['devices']['upstream']['name'],
'upstream_mtu': o_config['pvc']['system']['configuration']['networking']['devices']['upstream']['mtu'],
'upstream_dev_ip': o_config['pvc']['system']['configuration']['networking']['addresses']['upstream'],
'vni_dev': o_config['pvc']['system']['configuration']['networking']['cluster']['name'],
'vni_mtu': o_config['pvc']['system']['configuration']['networking']['cluster']['mtu'],
'vni_dev_ip': o_config['pvc']['system']['configuration']['networking']['cluster']['address'],
'storage_dev': o_config['pvc']['system']['configuration']['networking']['storage']['name'],
'storage_mtu': o_config['pvc']['system']['configuration']['networking']['storage']['mtu'],
'storage_dev_ip': o_config['pvc']['system']['configuration']['networking']['storage']['address'],
'upstream_dev': o_config['pvc']['system']['configuration']['networking']['upstream']['name'],
'upstream_mtu': o_config['pvc']['system']['configuration']['networking']['upstream']['mtu'],
'upstream_dev_ip': o_config['pvc']['system']['configuration']['networking']['upstream']['address'],
}
except Exception as e:
print('ERROR: {}!'.format(e))