]>
Commit | Line | Data |
---|---|---|
7aa3a5e6 AD |
1 | From 39b395b1fd41e5ac4066c5afd19b6ab9c17b8b14 Mon Sep 17 00:00:00 2001 |
2 | From: alexandre derumier <aderumier@odiso.com> | |
3 | Date: Thu, 1 Sep 2022 19:18:21 +0200 | |
4 | Subject: [PATCH] addons: openvswitch : add support for fakebridge. | |
5 | ||
6 | Fake bridge are are ovsbridge child of a parent bridge with a specific vlan tag. | |
7 | ||
8 | ``` | |
9 | auto br-parent | |
10 | iface br-parent inet manual | |
11 | ovs_type OVSBridge | |
12 | ||
13 | auto br-fakev10 | |
14 | iface br-fakev10 inet manual | |
15 | ovs_type OVSBridge | |
16 | ovs_bridge br-parent | |
17 | ovs_options br-parent 10 | |
18 | ||
19 | ``` | |
20 | --- | |
21 | ifupdown2/addons/openvswitch.py | 10 +++++++++- | |
22 | 1 file changed, 9 insertions(+), 1 deletion(-) | |
23 | ||
24 | diff --git a/ifupdown2/addons/openvswitch.py b/ifupdown2/addons/openvswitch.py | |
25 | index 2c9a76f7..0a124ba2 100644 | |
26 | --- a/ifupdown2/addons/openvswitch.py | |
27 | +++ b/ifupdown2/addons/openvswitch.py | |
28 | @@ -74,6 +74,10 @@ class openvswitch(Addon, moduleBase): | |
29 | "required": False, | |
30 | "example": ["ovs-ports-condone-regex ^[a-zA-Z0-9]+_v[0-9]{1,4}$"] | |
31 | }, | |
32 | + 'ovs-bridge': { | |
33 | + 'help': 'Optional parent bridge for fake bridges', | |
34 | + 'required': False, | |
35 | + }, | |
36 | } | |
37 | } | |
38 | ||
39 | @@ -147,13 +151,17 @@ def _addbridge (self, ifaceobj): | |
40 | ovsextra = ifaceobj.get_attr_value('ovs-extra') | |
41 | ovsmtu = ifaceobj.get_attr_value_first ('ovs-mtu') | |
42 | ovsportscondoneregex = self._get_ovs_port_condone_regex(ifaceobj) | |
43 | + ovsparent = ifaceobj.get_attr_value_first ('ovs-bridge') | |
44 | ||
45 | cmd_list = [] | |
46 | ||
47 | cmd = "--may-exist add-br %s"%(iface) | |
48 | + if ovsparent is not None and ovsoptions: | |
49 | + cmd = cmd + " %s" %(ovsoptions) | |
50 | + | |
51 | cmd_list.append(cmd) | |
52 | ||
53 | - if ovsoptions: | |
54 | + if ovsparent is None and ovsoptions: | |
55 | cmd = "set bridge %s %s" %(iface, ovsoptions) | |
56 | cmd_list.append(cmd) | |
57 |