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

Ben Pfaff blp at nicira.com
Mon Jan 11 23:50:24 UTC 2010


On Mon, Jan 11, 2010 at 03:32:19PM -0800, Justin Pettit wrote:
> On startup, create an empty config database if it doesn't already exist.  This
> is the behavior of the XenServer init scripts.

Thank you.  One comment below:

> 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

This part looks good.

> +            # Initialize configuration database.
> +            ovsdb-tool -vANY:console:emer \
> +                transact /etc/openvswitch-switch/conf \
> +                '[{"op": "insert", "table": "Open_vSwitch", "row": {}}]' \
> +                > /dev/null

I'd rather avoid hard-coding this initialization here, instead adding a
call to "ovs-vsctl --no-wait init" after we start the ovsdb-server.
(That's how it's done in xenserver/etc_init.d/vswitch.)  Then if we
later change the minimal configuration of the database, we only have to
change ovs-vsctl, not multiple places.

> +        fi
> +




More information about the dev mailing list