[ovs-dev] [PATCH] xen: Restore state files for VIF VLANs

Jesse Gross jesse at nicira.com
Tue Oct 20 04:13:40 UTC 2009


A change on master to use ovs-vsctl instead of state files for VLANs
was ported to the citrix branch, which does not have ovs-vsctl.  The
interface reconfigure portion, which does not store the state files
was ported but the vif-hotput script portion was not.  This restores
interface reconfigure to again save the state files.

Bug #2187
---
 xenserver/etc_xensource_scripts_vif                |    4 ++--
 .../opt_xensource_libexec_interface-reconfigure    |   13 ++++++++++++-
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/xenserver/etc_xensource_scripts_vif b/xenserver/etc_xensource_scripts_vif
index c3baba9..8217fb0 100755
--- a/xenserver/etc_xensource_scripts_vif
+++ b/xenserver/etc_xensource_scripts_vif
@@ -71,8 +71,8 @@ add_to_bridge()
     logger -t scripts-vif "Adding ${vif} to ${bridge} with address ${address}"
 
     vid=
-    if [ -e "/etc/openvswitch/br-$bridge" ]; then
-	. "/etc/openvswitch/br-$bridge"
+    if [ -e "/var/lib/openvswitch/br-$bridge" ]; then
+	. "/var/lib/openvswitch/br-$bridge"
 	if [ -n "$VLAN_SLAVE" -a -n "$VLAN_VID" ]; then
 	    bridge=$VLAN_SLAVE
 	    vid="--add=vlan.$vif.tag=$VLAN_VID"
diff --git a/xenserver/opt_xensource_libexec_interface-reconfigure b/xenserver/opt_xensource_libexec_interface-reconfigure
index 2b12218..82c3863 100755
--- a/xenserver/opt_xensource_libexec_interface-reconfigure
+++ b/xenserver/opt_xensource_libexec_interface-reconfigure
@@ -1473,7 +1473,18 @@ def action_up(pif):
         cfgmod_argv += ['--add=vlan.%s.tag=%s' % (ipdev, pifrec['VLAN'])]
         cfgmod_argv += ['--add=iface.%s.internal=true' % (ipdev)]
         cfgmod_argv += ['--add=iface.%s.fake-bridge=true' % (ipdev)]
-        
+        if not os.path.exists(vswitch_state_dir):
+            os.mkdir(vswitch_state_dir)
+        br = ConfigurationFile("br-%s" % ipdev, vswitch_state_dir)
+        br.write("VLAN_SLAVE=%s\n" % bridge)
+        br.write("VLAN_VID=%s\n" % pifrec['VLAN'])
+        br.close()
+        f.attach_child(br)
+    else:
+        br = ConfigurationFile("br-%s" % ipdev, vswitch_state_dir)
+        br.unlink()
+        f.attach_child(br)
+
     # Apply updated configuration.
     try:
         f.apply()
-- 
1.6.0.4





More information about the dev mailing list