[ovs-dev] [PATCH 1/2] debian: Create the config database if it doesn't exist on startup

Justin Pettit jpettit at nicira.com
Tue Jan 12 01:00:09 UTC 2010


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 |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/debian/openvswitch-switch.init b/debian/openvswitch-switch.init
index de8f295..e114598 100755
--- a/debian/openvswitch-switch.init
+++ b/debian/openvswitch-switch.init
@@ -201,6 +201,20 @@ 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
+
+            # Initialize configuration database.
+            ovsdb-tool -vANY:console:emer \
+                transact /etc/openvswitch-switch/conf \
+                '[{"op": "insert", "table": "Open_vSwitch", "row": {}}]' \
+                > /dev/null
+        fi
+
         # Start ovsdb-server.
         set --
         set -- "$@" --verbose=ANY:console:emer --verbose=ANY:syslog:err
-- 
1.6.5.5





More information about the dev mailing list