xenserver: Fixes related to creating config DB in RPM spec file
authorJustin Pettit <jpettit@nicira.com>
Thu, 10 Dec 2009 23:28:49 +0000 (15:28 -0800)
committerJustin Pettit <jpettit@nicira.com>
Fri, 11 Dec 2009 01:08:40 +0000 (17:08 -0800)
Some programs require a "Open_vSwitch" table to exist in the
configuration DB.  This change adds that table when a new DB is created.

Also, don't try to create the DB unless it doesn't exist.

xenserver/vswitch-xen.spec

index 313f1b633912c19f44c367f8a2d6923a84e30f04..ba78a4db084e5940355bb59a890f0bd91d55cfce 100644 (file)
@@ -188,9 +188,16 @@ net.ipv4.conf.all.arp_filter = 1
 EOF
 fi
 
-# Create ovs-vswitchd config database
-ovsdb-tool create /etc/ovs-vswitchd.conf.db \
-        /usr/share/vswitch/vswitch-idl.ovsschema
+if test ! -e /etc/ovs-vswitchd.conf.db; then
+    # Create ovs-vswitchd config database
+    ovsdb-tool create /etc/ovs-vswitchd.conf.db \
+            /usr/share/vswitch/vswitch-idl.ovsschema
+
+    # Create initial table in config database
+    ovsdb-tool transact /etc/ovs-vswitchd.conf.db \
+            '[{"op": "insert", "table": "Open_vSwitch", "row": {}}]' \
+            > /dev/null
+fi
 
 # Create default or update existing /etc/sysconfig/vswitch.
 SYSCONFIG=/etc/sysconfig/vswitch