summaryrefslogtreecommitdiff
path: root/ovn/utilities
diff options
context:
space:
mode:
Diffstat (limited to 'ovn/utilities')
-rwxr-xr-xovn/utilities/ovn-ctl37
1 files changed, 17 insertions, 20 deletions
diff --git a/ovn/utilities/ovn-ctl b/ovn/utilities/ovn-ctl
index 9f1602195..3e2ccf9a6 100755
--- a/ovn/utilities/ovn-ctl
+++ b/ovn/utilities/ovn-ctl
@@ -30,31 +30,28 @@ done
## start ##
## ----- ##
-check_ovn_dbs () {
- if test ! -e "$DB_NB_FILE"; then
- create_db "$DB_NB_FILE" "$DB_NB_SCHEMA"
- fi
-
- if test ! -e "$DB_SB_FILE"; then
- create_db "$DB_SB_FILE" "$DB_SB_SCHEMA"
- fi
-
- running_ovn_dbs=$(ovs-appctl -t ovsdb-server ovsdb-server/list-dbs | grep OVN | wc -l)
- if [ "$running_ovn_dbs" != "2" ] ; then
- ovs-appctl -t ovsdb-server ovsdb-server/add-db $DB_NB_FILE
- ovs-appctl -t ovsdb-server ovsdb-server/add-db $DB_SB_FILE
- running_ovn_dbs=$(ovs-appctl -t ovsdb-server ovsdb-server/list-dbs | grep OVN | wc -l)
- if [ "$running_ovn_dbs" != "2" ] ; then
- echo >&2 "$0: Failed to add OVN dbs to ovsdb-server"
- exit 1
- fi
- fi
+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
}
start_northd () {
# We expect ovn-northd to be co-located with ovsdb-server handling both the
# OVN_Northbound and OVN_Southbound dbs.
- check_ovn_dbs
+ upgrade_ovn_dbs
set ovn-northd
set "$@" -vconsole:emer -vsyslog:err -vfile:info