Browse code

Replace deprecated brctl with ip commands

The bridge-utils package has been deprecated for some time now [1] and
'brctl' does not exist on some more recent distros like Fedora 28.
Replace references to brctl with the proper ip commands.

Calls to "brctl show" are not being replaced with calls to "bridge link"
because the output format is very different and in testing some bridges
were not listed. So the simpler method of consulting /sys/class/net is
used.

In worlddump.py we try running both because failures are handled
gracefully by _dump_cmd(), as well as "ip link show type bridge" for
additional info.

[1] https://lwn.net/Articles/703776/ for example

Change-Id: Ie4c8ad6ce4a09c38023c9e4ec7834c249403145f
Partial-Bug: #1801919

Nate Johnston authored on 2018/11/13 01:17:07
Showing 3 changed files
... ...
@@ -369,17 +369,6 @@ To pull glance, OpenStack Image service, from an experimental fork:
369 369
 Notes stuff you might need to know
370 370
 ==================================
371 371
 
372
-Reset the Bridge
373
-
374
-How to reset the bridge configuration:
375
-
376
-::
377
-
378
-    sudo brctl delif br100 eth0.926
379
-    sudo ip link set dev br100 down
380
-    sudo brctl delbr br100
381
-
382 372
 Set MySQL Password
383 373
 ------------------
384 374
 
... ...
@@ -8,21 +8,23 @@ _XTRACE_NEUTRON_LB=$(set +o | grep xtrace)
8 8
 set +o xtrace
9 9
 
10 10
 function neutron_lb_cleanup {
11
-    sudo ip link set $PUBLIC_BRIDGE down
12
-    sudo brctl delbr $PUBLIC_BRIDGE
11
+    sudo ip link delete $PUBLIC_BRIDGE
13 12
 
13
+    bridge_list=`ls /sys/class/net/*/bridge/bridge_id 2>/dev/null | cut -f5 -d/`
14
+    if [[ -z "$bridge_list" ]]; then
15
+        return
16
+    fi
14 17
     if [[ "$Q_ML2_TENANT_NETWORK_TYPE" = "vxlan" ]]; then
15
-        for port in $(sudo brctl show | grep -o -e [a-zA-Z\-]*tap[0-9a-f\-]* -e vxlan-[0-9a-f\-]*); do
18
+        for port in $(echo $bridge_list | grep -o -e [a-zA-Z\-]*tap[0-9a-f\-]* -e vxlan-[0-9a-f\-]*); do
16 19
             sudo ip link delete $port
17 20
         done
18 21
     elif [[ "$Q_ML2_TENANT_NETWORK_TYPE" = "vlan" ]]; then
19
-        for port in $(sudo brctl show | grep -o -e [a-zA-Z\-]*tap[0-9a-f\-]* -e ${LB_PHYSICAL_INTERFACE}\.[0-9a-f\-]*); do
22
+        for port in $(echo $bridge_list | grep -o -e [a-zA-Z\-]*tap[0-9a-f\-]* -e ${LB_PHYSICAL_INTERFACE}\.[0-9a-f\-]*); do
20 23
             sudo ip link delete $port
21 24
         done
22 25
     fi
23
-    for bridge in $(sudo brctl show |grep -o -e brq[0-9a-f\-]*); do
24
-        sudo ip link set $bridge down
25
-        sudo brctl delbr $bridge
26
+    for bridge in $(echo $bridge_list |grep -o -e brq[0-9a-f\-]*); do
27
+        sudo ip link delete $bridge
26 28
     done
27 29
 }
28 30
 
... ...
@@ -163,7 +163,9 @@ def _netns_list():
163 163
 def network_dump():
164 164
     _header("Network Dump")
165 165
 
166
+    _dump_cmd("bridge link")
166 167
     _dump_cmd("brctl show")
168
+    _dump_cmd("ip link show type bridge")
167 169
     ip_cmds = ["neigh", "addr", "link", "route"]
168 170
     for cmd in ip_cmds + ['netns']:
169 171
         _dump_cmd("ip %s" % cmd)