Skip to content

Commit 9ae747e

Browse files
committed
Imported two patches from xen-api.git
commit fa5d8321c27725fad175a2c4d259726e9b63d0ac Author: Kevin Tower <[email protected]> Date: Mon Apr 29 14:10:44 2013 -0700 Altering get_bridge_name_vswitch() to work correctly with VLANs. VLAN-tagged networks/ports are connected to a "fake bridge" device. Most ovs-* commands will not work with a fake bridge device, so this function needs to return the true parent bridge device name, not the fake bridge. Otherwise, subsequent calls in this script to configure port locking via ovs-ofctl will (silently) fail, and port locking will not activate. Signed-off-by: Kevin Tower <[email protected]> commit 06c2d0fedc7031c27ad9215a751c404fde1ebb70 Author: George Shuklin <[email protected]> Date: Thu Dec 20 17:41:46 2012 +0400 Fix bridge name selection for vswitch mode in scripts/setup-vif-rules - bridge_name = "xenbr%s" % devid + bridge_name = get_bridge_name_vswitch(vif_name) Devid is device number for domU (f.e. vif1.15; 15 - devid) and is definitely NOT a xenbr number (xenbr0, xenbr1, etc). Signed-off-by: George Shuklin <[email protected]> Committed-by: Rob Hoes <[email protected]>
1 parent 422ff06 commit 9ae747e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

scripts/setup-vif-rules

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,18 @@ def create_vswitch_rules(bridge_name, port, config):
194194
# Drop everything else.
195195
add_flow(bridge_name, "in_port=%s,priority=4000,idle_timeout=0,action=drop" % port)
196196

197+
def get_bridge_name_vswitch(vif_name):
198+
'''return bridge vif belong to'''
199+
(rc, stdout, stderr) = doexec([vsctl, "iface-to-br", vif_name ])
200+
temp_bridge_name = stdout.readline().strip()
201+
'''get bridge parent, in case we were given a fake bridge device'''
202+
'''will return same name if it is already a real bridge'''
203+
(rc, stdout, stderr) = doexec([vsctl, "br-to-parent", temp_bridge_name ])
204+
return stdout.readline().strip()
205+
197206
def handle_vswitch(vif_name, domuuid, devid, action):
198207
if (action == "clear") or (action == "filter"):
199-
bridge_name = "xenbr%s" % devid
208+
bridge_name = get_bridge_name_vswitch(vif_name)
200209
ip_link_set(vif_name, "down")
201210
port = get_vswitch_port(vif_name)
202211
clear_vswitch_rules(bridge_name, port)

0 commit comments

Comments
 (0)