2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 01:51:26 +00:00

ovs-sandbox: add initial support for ovn

This patch adds initial support for OVN to ovs-sandbox.  If you pass
"-o/--ovn" to ovs-sandbox, it will create a db from the ovn and ovn-nb
schemas and tell ovsdb-server to use them.  It also adds ovn/ to $PATH
so that as ovn executables are added, they will be available in the
sandbox.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Russell Bryant 2015-03-12 16:57:18 -04:00 committed by Ben Pfaff
parent 1b629ef9bb
commit ff358c710c

View File

@ -49,6 +49,9 @@ srcdir=
schema=
installed=false
built=false
ovn=false
ovnschema=
ovnnbschema=
for option; do
# This option-parsing mechanism borrowed from a Autoconf-generated
@ -90,6 +93,7 @@ These options force ovs-sandbox to use an installed Open vSwitch:
-g, --gdb-vswitchd run ovs-vswitchd under gdb
-d, --gdb-ovsdb run ovsdb-server under gdb
-S, --schema=FILE use FILE as vswitch.ovsschema
-o, --ovn enable OVN
Other options:
-h, --help Print this usage message.
@ -130,6 +134,9 @@ EOF
-d|--gdb-o*)
gdb_ovsdb=true
;;
-o|--ovn)
ovn=true
;;
-*)
echo "unrecognized option $option (use --help for help)" >&2
exit 1
@ -180,6 +187,18 @@ if $built; then
echo >&2 'source directory not found, please use --srcdir'
exit 1
fi
if $ovn; then
ovnschema=$srcdir/ovn/ovn.ovsschema
if test ! -e "$ovnschema"; then
echo >&2 'source directory not found, please use --srcdir'
exit 1
fi
ovnnbschema=$srcdir/ovn/ovn-nb.ovsschema
if test ! -e "$ovnnbschema"; then
echo >&2 'source directory not found, please use --srcdir'
exit 1
fi
fi
# Put built tools early in $PATH.
if test ! -e $builddir/vswitchd/ovs-vswitchd; then
@ -187,6 +206,9 @@ if $built; then
exit 1
fi
PATH=$builddir/ovsdb:$builddir/vswitchd:$builddir/utilities:$PATH
if $ovn; then
PATH=$builddir/ovn:$PATH
fi
export PATH
else
case $schema in
@ -207,6 +229,10 @@ else
echo "can't find vswitch.ovsschema, please specify --schema" >&2
exit 1
fi
if $ovn; then
echo "running with ovn is only supported from the build dir." >&2
exit 1
fi
fi
# Create sandbox.
@ -232,8 +258,16 @@ trap 'kill `cat "$sandbox"/*.pid`' 0 1 2 3 13 14 15
# Create database and start ovsdb-server.
touch "$sandbox"/.conf.db.~lock~
run ovsdb-tool create conf.db "$schema"
ovsdb_server_args=
if $ovn; then
touch "$sandbox"/.ovn.db.~lock~
touch "$sandbox"/.ovnnb.db.~lock~
run ovsdb-tool create ovn.db "$ovnschema"
run ovsdb-tool create ovnnb.db "$ovnnbschema"
ovsdb_server_args="ovn.db ovnnb.db conf.db"
fi
rungdb $gdb_ovsdb ovsdb-server --detach --no-chdir --pidfile -vconsole:off --log-file \
--remote=punix:"$sandbox"/db.sock
--remote=punix:"$sandbox"/db.sock $ovsdb_server_args
# Start ovs-vswitchd.
rungdb $gdb_vswitchd ovs-vswitchd --detach --no-chdir --pidfile -vconsole:off --log-file \