debian: Create the config database if it doesn't exist on startup
authorJustin Pettit <jpettit@nicira.com>
Mon, 11 Jan 2010 23:20:44 +0000 (15:20 -0800)
committerJustin Pettit <jpettit@nicira.com>
Tue, 12 Jan 2010 00:11:08 +0000 (16:11 -0800)
On startup, create an empty config database if it doesn't already exist.  This
is the behavior of the XenServer init scripts.

debian/openvswitch-switch.init
debian/openvswitch-switch.postinst

index de8f295d0822095e5ebf48b19628b06cef8b614d..bb2cb1bfec06801b17e07e36d86993c0fda40f70 100755 (executable)
@@ -201,6 +201,14 @@ case "$1" in
             check_op "Setting core limit to $CORE_LIMIT" ulimit -c "$CORE_LIMIT"
         fi
 
+        # Create an empty configuration database if it doesn't exist.
+        if test ! -e /etc/openvswitch-switch/conf; then
+            # Create configuration database.
+            ovsdb-tool -vANY:console:emer \
+                create /etc/openvswitch-switch/conf \
+                /usr/share/openvswitch/vswitch-idl.ovsschema
+        fi
+
         # Start ovsdb-server.
         set --
         set -- "$@" --verbose=ANY:console:emer --verbose=ANY:syslog:err
@@ -218,6 +226,8 @@ case "$1" in
             echo " ERROR."
         fi
 
+        ovs-vsctl --no-wait init
+
         # Start ovs-vswitchd.
         set --
         set -- "$@" --verbose=ANY:console:emer --verbose=ANY:syslog:err
index 39b2de4611ecd78974909c7c26c003ccef313cea..4be5a30c76c60ee27c5a4799b31e71f7b3364d18 100755 (executable)
@@ -41,19 +41,6 @@ case "$1" in
             running=false
         fi
 
-        if test ! -e /etc/openvswitch-switch/conf; then
-            # Create configuration database.
-            ovsdb-tool -vANY:console:emer \
-                create /etc/openvswitch-switch/conf \
-                /usr/share/openvswitch/vswitch-idl.ovsschema
-
-            # Initialize configuration database.
-            ovsdb-tool -vANY:console:emer \
-                transact /etc/openvswitch-switch/conf \
-                '[{"op": "insert", "table": "Open_vSwitch", "row": {}}]' \
-                > /dev/null
-        fi
-
         if $running; then
             /etc/init.d/openvswitch-switch start
         fi