Move vswitch state files to /var/lib.
authorIan Campbell <ian.campbell@citrix.com>
Wed, 9 Sep 2009 17:09:00 +0000 (18:09 +0100)
committerBen Pfaff <blp@nicira.com>
Wed, 9 Sep 2009 17:41:38 +0000 (10:41 -0700)
I believe this is the correct location for files of this type.

xenserver/etc_xensource_scripts_vif
xenserver/opt_xensource_libexec_interface-reconfigure

index c3baba9e0d0c8eb7614b68642b7034e065f4024a..8217fb00cb49daa143fe363b806366c8fee8577e 100755 (executable)
@@ -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"
index 61027c5fc886268868e3fdfc03813a431a6cde6f..f4afc9f31f277427eb07d7de3424c27c9aa45dd4 100755 (executable)
@@ -71,8 +71,8 @@ output_directory = None
 db = None
 management_pif = None
 
-dbcache_file = "/etc/ovs-vswitch.dbcache"
-vswitch_config_dir = "/etc/openvswitch"
+vswitch_state_dir = "/var/lib/openvswitch/"
+dbcache_file = vswitch_state_dir + "dbcache"
 
 class Usage(Exception):
     def __init__(self, msg):
@@ -1131,9 +1131,9 @@ def action_up(pif):
 
     # /etc/xensource/scripts/vif needs to know where to add VIFs.
     if vlan_slave:
-        if not os.path.exists(vswitch_config_dir):
-            os.mkdir(vswitch_config_dir)
-        br = ConfigurationFile("br-%s" % bridge, vswitch_config_dir)
+        if not os.path.exists(vswitch_state_dir):
+            os.mkdir(vswitch_state_dir)
+        br = ConfigurationFile("br-%s" % bridge, vswitch_state_dir)
         br.write("VLAN_SLAVE=%s\n" % datapath)
         br.write("VLAN_VID=%s\n" % pifrec['VLAN'])
         br.close()
@@ -1233,7 +1233,7 @@ def action_up(pif):
         argv += ['--add=iface.%s.fake-bridge=true' % (ipdev)]
     else:
         try:
-            os.unlink("%s/br-%s" % (vswitch_config_dir, bridge))
+            os.unlink("%s/br-%s" % (vswitch_state_dir, bridge))
         except OSError:
             pass
     argv += ['--del-match=bridge.%s.xs-network-uuids=*' % datapath]