]>
Commit | Line | Data |
---|---|---|
be992b4b AD |
1 | From 8eef7f26c0489a582f8d8dd8fe8da8e573454d42 Mon Sep 17 00:00:00 2001 |
2 | From: root <root@kvmformation1.odiso.net> | |
3 | Date: Wed, 16 May 2018 10:22:22 +0200 | |
4 | Subject: [PATCH] ifupdown.sh : add ifupdown2 workaround | |
5 | ||
6 | with ifupdown2, we can't call ifup for each ovs_ports in OvsBridge. | |
7 | But as we define also ovs_bridge for each interface, we can simply add | |
8 | the bridge here, to be sure that it's exist before adding the interface. | |
9 | ||
10 | for config, we simply need to replace allow-..., with auto. | |
11 | I have keeped ovs_ports to avoid config change, but it's not used. | |
12 | ||
13 | old config | |
14 | ---------- | |
15 | auto vmbr100 | |
16 | iface vmbr100 inet manual | |
17 | ovs_type OVSBridge | |
18 | ovs_ports bond0 ovsinternalport | |
19 | ||
20 | allow-vmbr100 ovsinternalport | |
21 | iface ovsinternalport inet static | |
22 | address 172.16.0.10 | |
23 | netmask 255.255.255.0 | |
24 | ovs_type OVSIntPort | |
25 | ovs_bridge vmbr100 | |
26 | ovs_options tag=30 | |
27 | ||
28 | allow-vmbr100 bond0 | |
29 | iface bond0 inet manual | |
30 | ovs_bonds eno3 eno4 | |
31 | ovs_type OVSBond | |
32 | ovs_bridge vmbr100 | |
33 | ovs_options bond_mode=balance-slb lacp=active | |
34 | ||
35 | new config | |
36 | ---------- | |
37 | auto vmbr100 | |
38 | iface vmbr100 inet manual | |
39 | ovs_type OVSBridge | |
40 | ovs_ports bond0 ovsinternalport | |
41 | ||
42 | auto ovsinternalport | |
43 | iface ovsinternalport inet static | |
44 | address 172.16.0.10 | |
45 | netmask 255.255.255.0 | |
46 | ovs_type OVSIntPort | |
47 | ovs_bridge vmbr100 | |
48 | ovs_options tag=30 | |
49 | ||
50 | auto bond0 | |
51 | iface bond0 inet manual | |
52 | ovs_bonds eno3 eno4 | |
53 | ovs_type OVSBond | |
54 | ovs_bridge vmbr100 | |
55 | ovs_options bond_mode=balance-slb lacp=active | |
56 | --- | |
57 | debian/ifupdown.sh | 44 ++++++++++++++++++++++++++++++++++++++++---- | |
58 | 1 file changed, 40 insertions(+), 4 deletions(-) | |
59 | ||
60 | diff --git a/debian/ifupdown.sh b/debian/ifupdown.sh | |
61 | index e21215a..098d913 100755 | |
62 | --- a/debian/ifupdown.sh | |
63 | +++ b/debian/ifupdown.sh | |
64 | @@ -44,11 +44,20 @@ if [ "${MODE}" = "start" ]; then | |
65 | ovs_vsctl -- --may-exist add-br "${IFACE}" ${IF_OVS_OPTIONS}\ | |
66 | ${OVS_EXTRA+-- $OVS_EXTRA} | |
67 | ||
68 | - if [ ! -z "${IF_OVS_PORTS}" ]; then | |
69 | - ifup --allow="${IFACE}" ${IF_OVS_PORTS} | |
70 | + if [ ! -f /usr/share/ifupdown2/ifupdown2 ]; then | |
71 | + if [ ! -z "${IF_OVS_PORTS}" ]; then | |
72 | + ifup --allow="${IFACE}" ${IF_OVS_PORTS} | |
73 | + fi | |
74 | fi | |
75 | + | |
76 | ;; | |
77 | OVSPort) | |
78 | + | |
79 | + if [ -f /usr/share/ifupdown2/ifupdown2 ]; then | |
80 | + ovs_vsctl -- --may-exist add-br "${IF_OVS_BRIDGE}" | |
81 | + ip link set "${IF_OVS_BRIDGE}" up | |
82 | + fi | |
83 | + | |
84 | ovs_vsctl -- --may-exist add-port "${IF_OVS_BRIDGE}"\ | |
85 | "${IFACE}" ${IF_OVS_OPTIONS} \ | |
86 | ${OVS_EXTRA+-- $OVS_EXTRA} | |
87 | @@ -56,6 +65,12 @@ if [ "${MODE}" = "start" ]; then | |
88 | ifconfig "${IFACE}" up | |
89 | ;; | |
90 | OVSIntPort) | |
91 | + | |
92 | + if [ -f /usr/share/ifupdown2/ifupdown2 ]; then | |
93 | + ovs_vsctl -- --may-exist add-br "${IF_OVS_BRIDGE}" | |
94 | + ip link set "${IF_OVS_BRIDGE}" up | |
95 | + fi | |
96 | + | |
97 | ovs_vsctl -- --may-exist add-port "${IF_OVS_BRIDGE}"\ | |
98 | "${IFACE}" ${IF_OVS_OPTIONS} -- set Interface "${IFACE}"\ | |
99 | type=internal ${OVS_EXTRA+-- $OVS_EXTRA} | |
100 | @@ -63,6 +78,12 @@ if [ "${MODE}" = "start" ]; then | |
101 | ifconfig "${IFACE}" up | |
102 | ;; | |
103 | OVSBond) | |
104 | + | |
105 | + if [ -f /usr/share/ifupdown2/ifupdown2 ]; then | |
106 | + ovs_vsctl -- --may-exist add-br "${IF_OVS_BRIDGE}" | |
107 | + ip link set "${IF_OVS_BRIDGE}" up | |
108 | + fi | |
109 | + | |
110 | ovs_vsctl -- --fake-iface add-bond "${IF_OVS_BRIDGE}"\ | |
111 | "${IFACE}" ${IF_OVS_BONDS} ${IF_OVS_OPTIONS} \ | |
112 | ${OVS_EXTRA+-- $OVS_EXTRA} | |
113 | @@ -74,12 +95,24 @@ if [ "${MODE}" = "start" ]; then | |
114 | done | |
115 | ;; | |
116 | OVSPatchPort) | |
117 | + | |
118 | + if [ -f /usr/share/ifupdown2/ifupdown2 ]; then | |
119 | + ovs_vsctl -- --may-exist add-br "${IF_OVS_BRIDGE}" | |
120 | + ip link set "${IF_OVS_BRIDGE}" up | |
121 | + fi | |
122 | + | |
123 | ovs_vsctl -- --may-exist add-port "${IF_OVS_BRIDGE}"\ | |
124 | "${IFACE}" ${IF_OVS_OPTIONS} -- set Interface "${IFACE}" \ | |
125 | type=patch options:peer="${IF_OVS_PATCH_PEER}" \ | |
126 | ${OVS_EXTRA+-- $OVS_EXTRA} | |
127 | ;; | |
128 | OVSTunnel) | |
129 | + | |
130 | + if [ -f /usr/share/ifupdown2/ifupdown2 ]; then | |
131 | + ovs_vsctl -- --may-exist add-br "${IF_OVS_BRIDGE}" | |
132 | + ip link set "${IF_OVS_BRIDGE}" up | |
133 | + fi | |
134 | + | |
135 | ovs_vsctl -- --may-exist add-port "${IF_OVS_BRIDGE}"\ | |
136 | "${IFACE}" ${IF_OVS_OPTIONS} -- set Interface "${IFACE}" \ | |
137 | type=${IF_OVS_TUNNEL_TYPE} ${IF_OVS_TUNNEL_OPTIONS} \ | |
138 | @@ -92,8 +125,11 @@ if [ "${MODE}" = "start" ]; then | |
139 | elif [ "${MODE}" = "stop" ]; then | |
140 | case "${IF_OVS_TYPE}" in | |
141 | OVSBridge) | |
142 | - if [ ! -z "${IF_OVS_PORTS}" ]; then | |
143 | - ifdown --allow="${IFACE}" ${IF_OVS_PORTS} | |
144 | + | |
145 | + if [ ! -f /usr/share/ifupdown2/ifupdown2 ]; then | |
146 | + if [ ! -z "${IF_OVS_PORTS}" ]; then | |
147 | + ifdown --allow="${IFACE}" ${IF_OVS_PORTS} | |
148 | + fi | |
149 | fi | |
150 | ||
151 | ovs_vsctl -- --if-exists del-br "${IFACE}" | |
152 | -- | |
153 | 2.11.0 | |
154 |