For devstack, we need a few more things: 1) the ability to start and stop the ovsdb processes separate from ovn-northd, so this patch needs to break them out as separate commands. 2) the logfile settings for vconsole and vfile need to use environment variables so that we can control their level at start up
Ryan Moats IRC handle: regXboi "dev" <[email protected]> wrote on 02/08/2016 09:41:25 AM: > From: Michael <[email protected]> > To: [email protected] > Date: 02/08/2016 09:41 AM > Subject: [ovs-dev] [PATCH 1/1] ovn/utilities: Separating OVN NB and > SB databases. Run dbs in separate > Sent by: "dev" <[email protected]> > > OVN NB & SB DB's should be separated and should run with ovn-ctl > start_northd / stop_northd > > From 351cb81298c5b5393427958d1663cf1d3ddb370b Mon Sep 17 00:00:00 2001 > From: Michael Arnaldi <[email protected]> > Date: Mon, 8 Feb 2016 16:29:26 +0100 > Subject: [PATCH 1/1] ovn/utilities: Separating OVN NB and SB > databases. Run dbs in separate > processes on ovn-northd start. > > Signed-off-by: Michael Arnaldi <[email protected]> > --- > ovn/utilities/ovn-ctl | 59 +++++++++++++++++++++++++++++++ > +--------------- > ovn/utilities/ovn-nbctl.c | 2 +- > ovn/utilities/ovn-sbctl.c | 3 ++- > 3 files changed, 43 insertions(+), 21 deletions(-) > > diff --git a/ovn/utilities/ovn-ctl b/ovn/utilities/ovn-ctl > index b171934..85c4199 100755 > --- a/ovn/utilities/ovn-ctl > +++ b/ovn/utilities/ovn-ctl > @@ -31,30 +31,38 @@ done > ## ----- ## > > upgrade_ovn_dbs () { > - ovn_dbs=$(ovs-appctl -t ovsdb-server ovsdb-server/list-dbs 2>/dev/null) > - for db in $ovn_dbs; do > - case $db in > - OVN*) > - action "Removing $db from ovsdb-server" \ > - ovs-appctl -t ovsdb-server ovsdb-server/remove-db $db > - ;; > - esac > - done > - upgrade_db "$DB_NB_FILE" "$DB_NB_SCHEMA" > - upgrade_db "$DB_SB_FILE" "$DB_SB_SCHEMA" > - for db in $DB_NB_FILE $DB_SB_FILE; do > - action "Adding $db to ovsdb-server" \ > - ovs-appctl -t ovsdb-server ovsdb-server/add-db $db || exit 1 > - done > + upgrade_db "$DB_NB_FILE" "$DB_NB_SCHEMA" 1>/dev/null 2>/dev/null > + upgrade_db "$DB_SB_FILE" "$DB_SB_SCHEMA" 1>/dev/null 2>/dev/null > +} > + > +stop_ovsdb_ovn () { > + if [ -f $DB_NB_PID ]; then > + kill -9 $(cat $DB_NB_PID) 1>/dev/null 2>/dev/null > + rm -f $DB_NB_PID 1>/dev/null 2>/dev/null > + fi > + if [ -f $DB_SB_PID ]; then > + kill -9 $(cat $DB_SB_PID) 1>/dev/null 2>/dev/null > + rm -f $DB_SB_PID 1>/dev/null 2>/dev/null > + fi > +} > + > +start_ovsdb_ovn () { > + mkdir -p $OVN_DB_DIR > + mkdir -p $OVN_DB_DIR/run > + > + ovsdb-server --detach -vconsole:off --remote=punix:$DB_NB_SOCK > --remote=ptcp:$DB_NB_PORT --pidfile=$DB_NB_PID $DB_NB_FILE > + ovsdb-server --detach -vconsole:off --remote=punix:$DB_SB_SOCK > --remote=ptcp:$DB_SB_PORT --pidfile=$DB_SB_PID $DB_SB_FILE > } > > start_northd () { > # We expect ovn-northd to be co-located with ovsdb-server > handling both the > # OVN_Northbound and OVN_Southbound dbs. > + stop_ovsdb_ovn > upgrade_ovn_dbs > + start_ovsdb_ovn > > set ovn-northd > - set "$@" -vconsole:emer -vsyslog:err -vfile:info > + set "$@" -vconsole:emer -vsyslog:err -vfile:info --ovnnb- > db=unix:$DB_NB_SOCK --ovnsb-db=unix:$DB_SB_SOCK > OVS_RUNDIR=${OVN_RUNDIR} start_daemon "$OVN_NORTHD_PRIORITY" > "$OVN_NORTHD_WRAPPER" "$@" > } > > @@ -70,6 +78,7 @@ start_controller () { > > stop_northd () { > OVS_RUNDIR=${OVN_RUNDIR} stop_daemon ovn-northd > + stop_ovsdb_ovn > } > > stop_controller () { > @@ -95,12 +104,24 @@ restart_controller () { > ## ---- ## > > set_defaults () { > - DB_SOCK=$rundir/db.sock > - DB_NB_FILE=$dbdir/ovnnb.db > - DB_SB_FILE=$dbdir/ovnsb.db > + OVN_DB_DIR=$rundir/ovn > + > + DB_NB_SOCK=$OVN_DB_DIR/run/db_nb.sock > + DB_NB_PID=$OVN_DB_DIR/run/db_nb.pid > + DB_NB_PORT=6651 > + > + DB_SB_SOCK=$OVN_DB_DIR/run/db_sb.sock > + DB_SB_PID=$OVN_DB_DIR/run/db_sb.pid > + DB_SB_PORT=6652 > + > + DB_NB_FILE=$OVN_DB_DIR/db/ovnnb.db > + DB_SB_FILE=$OVN_DB_DIR/db/ovnsb.db > + > DB_NB_SCHEMA=$datadir/ovn-nb.ovsschema > DB_SB_SCHEMA=$datadir/ovn-sb.ovsschema > > + DB_SOCK=$rundir/db.sock > + > OVN_NORTHD_PRIORITY=-10 > OVN_NORTHD_WRAPPER= > OVN_CONTROLLER_PRIORITY=-10 > diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c > index 324a0a4..62adfba 100644 > --- a/ovn/utilities/ovn-nbctl.c > +++ b/ovn/utilities/ovn-nbctl.c > @@ -142,7 +142,7 @@ nbctl_default_db(void) > if (!def) { > def = getenv("OVN_NB_DB"); > if (!def) { > - def = ctl_default_db(); > + def = xasprintf("unix:%s/ovn/run/db_nb.sock", ovs_rundir()); > } > } > return def; > diff --git a/ovn/utilities/ovn-sbctl.c b/ovn/utilities/ovn-sbctl.c > index b428a35..15b3ea3 100644 > --- a/ovn/utilities/ovn-sbctl.c > +++ b/ovn/utilities/ovn-sbctl.c > @@ -28,6 +28,7 @@ > #include <unistd.h> > > #include "db-ctl-base.h" > +#include "dirs.h" > > #include "command-line.h" > #include "compiler.h" > @@ -154,7 +155,7 @@ sbctl_default_db(void) > if (!def) { > def = getenv("OVN_SB_DB"); > if (!def) { > - def = ctl_default_db(); > + def = xasprintf("unix:%s/ovn/run/db_sb.sock", ovs_rundir()); > } > } > return def; > -- > 2.4.9 (Apple Git-60) > > > Michael Arnaldi - Chief Technology Officer (CTO) > > MyMoneyEx Limited > c/o Buzzacott LLP > 130 Wood Street > London EC2V 6DL - United Kingdom > > Mail: [email protected] > Web: https://www.mymoneyex.com > -------------------------------------------------------------------------------------------- > This message is private and confidential. > If you have received this message in error, please notify us and > remove it from your system. > _______________________________________________ > dev mailing list > [email protected] > http://openvswitch.org/mailman/listinfo/dev _______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
