From 02146a81d6b11408c4171005cba774dfcf49325d Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sat, 10 Apr 2021 09:14:12 +0200 Subject: [PATCH] bundles/systemd-networkd: fix vlan support for bridges and bonds --- bundles/systemd-networkd/files/template-bond.network | 4 ++++ bundles/systemd-networkd/files/template-bridge.network | 4 ++++ bundles/systemd-networkd/items.py | 2 ++ 3 files changed, 10 insertions(+) diff --git a/bundles/systemd-networkd/files/template-bond.network b/bundles/systemd-networkd/files/template-bond.network index e7849fa..2d10582 100644 --- a/bundles/systemd-networkd/files/template-bond.network +++ b/bundles/systemd-networkd/files/template-bond.network @@ -3,3 +3,7 @@ Name=${' '.join(sorted(match))} [Network] Bond=${bond} + +% for vlan in sorted(vlans): +VLAN=${bond}.${vlan} +% endfor diff --git a/bundles/systemd-networkd/files/template-bridge.network b/bundles/systemd-networkd/files/template-bridge.network index 0487f79..c6108d1 100644 --- a/bundles/systemd-networkd/files/template-bridge.network +++ b/bundles/systemd-networkd/files/template-bridge.network @@ -3,3 +3,7 @@ Name=${' '.join(sorted(match))} [Network] Bridge=${bridge} + +% for vlan in sorted(vlans): +VLAN=${bridge}.${vlan} +% endfor diff --git a/bundles/systemd-networkd/items.py b/bundles/systemd-networkd/items.py index 72123d6..14565b7 100644 --- a/bundles/systemd-networkd/items.py +++ b/bundles/systemd-networkd/items.py @@ -89,6 +89,7 @@ for bond, config in node.metadata.get('systemd-networkd/bonds', {}).items(): 'context': { 'bond': bond, 'match': config['match'], + 'vlans': node.metadata.get(f'interfaces/{bond}/vlans', set()), }, 'needed_by': { 'svc_systemd:systemd-networkd', @@ -118,6 +119,7 @@ for brname, config in node.metadata.get('systemd-networkd/bridges', {}).items(): 'context': { 'bridge': brname, 'match': config['match'], + 'vlans': node.metadata.get(f'interfaces/{brname}/vlans', set()), }, 'needed_by': { 'svc_systemd:systemd-networkd',