Permalink
Browse files

Merge pull request #953 from selectel/master

Fix to setup-vif-rules
  • Loading branch information...
2 parents 93303b3 + 06c2d0f commit 47bc0e2c0e1dabdfd2bd6b813e5583ff25082c35 @robhoes robhoes committed Jan 31, 2013
Showing with 6 additions and 1 deletion.
  1. +6 −1 scripts/setup-vif-rules
View
@@ -229,10 +229,15 @@ def create_vswitch_rules(bridge_name, port, config):
# Drop everything else.
add_flow(bridge_name, "in_port=%s,priority=4000,idle_timeout=0,action=drop" % port)
+def get_bridge_name_vswitch(vif_name):
+ '''return bridge vif belong to'''
+ (rc, stdout, stderr) = doexec([vsctl, "iface-to-br", vif_name ])
+ return stdout.readline().strip()
+
def handle_vswitch(vif_type, domid, devid, action):
if (action == "clear") or (action == "filter"):
- bridge_name = "xenbr%s" % devid
vif_name = "%s%s.%s" % (vif_type, domid, devid)
+ bridge_name = get_bridge_name_vswitch(vif_name)
ip_link_set(vif_name, "down")
port = get_vswitch_port(vif_name)
clear_vswitch_rules(bridge_name, port)

0 comments on commit 47bc0e2

Please sign in to comment.