From 7b3e267f7ab168f78dfe0ffec32bd7b38699d1b5 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Mon, 6 Jan 2020 14:44:56 -0500 Subject: [PATCH] Implement bridge_device for bridged VNIs Required due to #64. Bridged networks were being created on top of a vLAN if the Cluster network was a vLAN device, rather than being created on the underlying device. This came from a previous revision of the cluster architecture guidelines where Cluster was supposed to be a raw device rather than a vLAN. This fixed the problem by implementing a configuration field for a "bridge_device", a NIC device that can then have the bridged vLANs created on top of it. Fixes #64 --- node-daemon/pvcd.sample.yaml | 2 ++ node-daemon/pvcd/Daemon.py | 1 + node-daemon/pvcd/VXNetworkInstance.py | 8 +++++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/node-daemon/pvcd.sample.yaml b/node-daemon/pvcd.sample.yaml index ed6dc887..cab166f9 100644 --- a/node-daemon/pvcd.sample.yaml +++ b/node-daemon/pvcd.sample.yaml @@ -153,6 +153,8 @@ pvc: # networking: PVC networking configuration # OPTIONAL if enable_networking: False networking: + # bridge_device: Underlying device to use for bridged vLAN networks; usually the device underlying + bridge_device: ens4 # upstream: Upstream physical interface device upstream: # device: Upstream interface device name diff --git a/node-daemon/pvcd/Daemon.py b/node-daemon/pvcd/Daemon.py index 779ac40f..72ccedac 100644 --- a/node-daemon/pvcd/Daemon.py +++ b/node-daemon/pvcd/Daemon.py @@ -200,6 +200,7 @@ def readConfig(pvcd_config_file, myhostname): 'metadata_postgresql_dbname': o_config['pvc']['coordinator']['metadata']['database']['name'], 'metadata_postgresql_user': o_config['pvc']['coordinator']['metadata']['database']['user'], 'metadata_postgresql_password': o_config['pvc']['coordinator']['metadata']['database']['pass'], + 'bridge_dev': o_config['pvc']['system']['configuration']['networking']['bridge_device'], 'vni_dev': o_config['pvc']['system']['configuration']['networking']['cluster']['device'], 'vni_mtu': o_config['pvc']['system']['configuration']['networking']['cluster']['mtu'], 'vni_dev_ip': o_config['pvc']['system']['configuration']['networking']['cluster']['address'], diff --git a/node-daemon/pvcd/VXNetworkInstance.py b/node-daemon/pvcd/VXNetworkInstance.py index 678e582c..4a8f80c5 100644 --- a/node-daemon/pvcd/VXNetworkInstance.py +++ b/node-daemon/pvcd/VXNetworkInstance.py @@ -40,6 +40,7 @@ class VXNetworkInstance(object): self.dns_aggregator = dns_aggregator self.vni_dev = config['vni_dev'] self.vni_mtu = config['vni_mtu'] + self.bridge_dev = config['bridge_dev'] self.nettype = zkhandler.readdata(self.zk_conn, '/networks/{}/nettype'.format(self.vni)) if self.nettype == 'bridged': @@ -465,8 +466,9 @@ add rule inet filter forward ip6 saddr {netaddr6} counter jump {vxlannic}-out # Create bridged network configuration def createNetworkBridged(self): self.logger.out( - 'Creating VLAN device on interface {}'.format( - self.vni_dev + 'Creating bridged vLAN device {} on interface {}'.format( + self.vlan_nic, + self.bridge_dev ), prefix='VNI {}'.format(self.vni), state='o' @@ -475,7 +477,7 @@ add rule inet filter forward ip6 saddr {netaddr6} counter jump {vxlannic}-out # Create vLAN interface common.run_os_command( 'ip link add link {} name {} type vlan id {}'.format( - self.vni_dev, + self.bridge_dev, self.vlan_nic, self.vni )