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. [1] https://lwn.net/Articles/703776/ for example Change-Id: I8a4891bb7ed44dc25ba3f79d2ace6927313c17b3 Related-Bug: #1801919
This commit is contained in:
parent
3134ffe712
commit
1f751b2d7d
|
@ -26,8 +26,8 @@ And then run OSKen-VRRP::
|
|||
# ip netns add gateway1
|
||||
# ip netns add gateway2
|
||||
|
||||
# brctl addbr vrrp-br0
|
||||
# brctl addbr vrrp-br1
|
||||
# ip link add dev vrrp-br0 type bridge
|
||||
# ip link add dev vrrp-br1 type bridge
|
||||
|
||||
# ip link add veth0 type veth peer name veth0-br0
|
||||
# ip link add veth1 type veth peer name veth1-br0
|
||||
|
@ -36,12 +36,12 @@ And then run OSKen-VRRP::
|
|||
# ip link add veth4 type veth peer name veth4-br1
|
||||
# ip link add veth5 type veth peer name veth5-br1
|
||||
|
||||
# brctl addif vrrp-br0 veth0-br0
|
||||
# brctl addif vrrp-br0 veth1-br0
|
||||
# brctl addif vrrp-br0 veth2-br0
|
||||
# brctl addif vrrp-br1 veth3-br1
|
||||
# brctl addif vrrp-br1 veth4-br1
|
||||
# brctl addif vrrp-br1 veth5-br1
|
||||
# ip link set dev veth0-br0 master vrrp-br0
|
||||
# ip link set dev veth1-br0 master vrrp-br0
|
||||
# ip link set dev veth2-br0 master vrrp-br0
|
||||
# ip link set dev veth3-br0 master vrrp-br1
|
||||
# ip link set dev veth4-br0 master vrrp-br1
|
||||
# ip link set dev veth5-br0 master vrrp-br1
|
||||
|
||||
# ip link set vrrp-br0 up
|
||||
# ip link set vrrp-br1 up
|
||||
|
|
|
@ -21,6 +21,7 @@ from __future__ import absolute_import
|
|||
import itertools
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
|
@ -319,11 +320,13 @@ class Bridge(object):
|
|||
return bridges
|
||||
|
||||
def get_bridges_brctl(self):
|
||||
out = self.execute('brctl show', retry=True)
|
||||
bridges = []
|
||||
for line in out.splitlines()[1:]:
|
||||
bridges.append(line.split()[0])
|
||||
return bridges
|
||||
br_list = []
|
||||
bridges = glob.glob('/sys/class/net/*/bridge/bridge_id')
|
||||
regex = re.compile(r"\/sys\/class\/net\/(.+)\/bridge\/bridge_id")
|
||||
for bridge in bridges:
|
||||
m = regex.match(bridge)
|
||||
br_list.append(m.group(1))
|
||||
return br_list
|
||||
|
||||
def get_bridges_ovs(self):
|
||||
out = self.execute('ovs-vsctl list-br', sudo=True, retry=True)
|
||||
|
|
|
@ -36,11 +36,10 @@ os_ken.app.rest is merely to prevent osken-manager from exiting.
|
|||
# ip link add veth1 type veth peer name veth1-br
|
||||
# ip link add veth2 type veth peer name veth2-br
|
||||
|
||||
# brctl addbr vrrpbr
|
||||
# brctl addif vrrpbr veth0-br
|
||||
# brctl addif vrrpbr veth1-br
|
||||
# brctl addif vrrpbr veth2-br
|
||||
|
||||
# ip link add vrrpbr type bridge
|
||||
# ip link set dev veth0-br master vrrpbr
|
||||
# ip link set dev veth1-br master vrrpbr
|
||||
# ip link set dev veth2-br master vrrpbr
|
||||
|
||||
# ip link set veth0 up
|
||||
# ip link set veth0-br up
|
||||
|
|
|
@ -20,10 +20,10 @@ ip link add veth0 type veth peer name veth0-br
|
|||
ip link add veth1 type veth peer name veth1-br
|
||||
ip link add veth2 type veth peer name veth2-br
|
||||
|
||||
brctl addbr vrrpbr
|
||||
brctl addif vrrpbr veth0-br
|
||||
brctl addif vrrpbr veth1-br
|
||||
brctl addif vrrpbr veth2-br
|
||||
ip link add vrrpbr type bridge
|
||||
ip link set dev veth0-br master vrrpbr
|
||||
ip link set dev veth1-br master vrrpbr
|
||||
ip link set dev veth2-br master vrrpbr
|
||||
|
||||
ip link set veth0 up
|
||||
ip link set veth0-br up
|
||||
|
|
|
@ -31,16 +31,18 @@ os_ken.services.protocols.vrrp.dumper is optional.
|
|||
|
||||
configure OVSs to connect os_ken
|
||||
example
|
||||
# brctl addbr b0
|
||||
# ip link add br0 type bridge
|
||||
# ip link add veth0-ovs type veth peer name veth0-br
|
||||
# ip link add veth1-ovs type veth peer name veth1-br
|
||||
# brctl addif b0 veth0-br
|
||||
# brctl addif b0 veth1-br
|
||||
# brctl show
|
||||
bridge name bridge id STP enabled interfaces
|
||||
b0 8000.6642e5822497 no veth0-br
|
||||
veth1-br
|
||||
ovs-system 0000.122038293b55 no
|
||||
# ip link set dev veth0-br master b0
|
||||
# ip link set dev veth1-br master b0
|
||||
# ip link show type bridge
|
||||
22: b0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
|
||||
link/ether d6:97:42:8a:55:0e brd ff:ff:ff:ff:ff:ff
|
||||
|
||||
# bridge link show
|
||||
23: veth0-br state DOWN @veth0-ovs: <BROADCAST,MULTICAST> mtu 1500 master b0 state disabled priority 32 cost 2
|
||||
24: veth1-br state DOWN @veth1-ovs: <BROADCAST,MULTICAST> mtu 1500 master b0 state disabled priority 32 cost 2
|
||||
|
||||
# ovs-vsctl add-br s0
|
||||
# ovs-vsctl add-port s0 veth0-ovs
|
||||
|
|
Loading…
Reference in New Issue