[ovs-dev] [PATCH ovn branch-20.06 v2 2/2] ovn-ctl: Handle cluster db upgrades for run_(nb/sb)_ovsdb
frode.nordahl at canonical.com
Thu Mar 11 15:49:26 UTC 2021
From: Numan Siddique <numans at ovn.org>
when ovn-ctl run_(nb_sb)_ovsdb is called, the ovsdb-server is started without
passing --detach and --monoitor and the process is exec'd.
For cluster mode, upgrade_cluster is never called and hence the dbs are not upraded
to new schema. CMS has to handle the db upgrade separately.
This patch handles the db upgrade by starting ovsdb-server in background and then
waits on ovsdb-server to complete.
Acked-by: Mark Michelson <mmichels at redhat.com>
Signed-off-by: Numan Siddique <numans at ovn.org>
(cherry picked from commit 67e2f386cc838d0b0f9b4b5da7fe611e1113b70c)
(adapted to not use `start_wrapped_daemon` which does not exist in branch-20.06)
Signed-off-by: Frode Nordahl <frode.nordahl at canonical.com>
utilities/ovn-ctl | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/utilities/ovn-ctl b/utilities/ovn-ctl
index 8afe68a0a..5665afad3 100755
@@ -288,7 +288,21 @@ $cluster_remote_port
set "$@" --sync-from=`cat $active_conf_file`
- "$@" "$file"
+ local run_ovsdb_in_bg="no"
+ local process_id=
+ if test X$detach = Xno && test $mode = cluster && test -z "$cluster_remote_addr" ; then
+ # When detach is no (for run_nb_ovsdb/run_sb_ovsdb commands)
+ # we want to run ovsdb-server in background rather than running it in
+ # foreground so that the OVN dbs are upgraded for the cluster mode.
+ # Otherwise, CMS has to take the responsibility of upgrading the dbs.
+ # Note: We run only the ovsdb-server in backgroud which created the
+ # cluster (i.e cluster_remote_addr is not set.).
+ "$@" $file &
+ "$@" "$file"
# Initialize the database if it's NOT joining a cluster.
if test -z "$cluster_remote_addr"; then
@@ -298,6 +312,10 @@ $cluster_remote_port
if test $mode = cluster; then
upgrade_cluster "$schema" "unix:$sock"
+ if test $run_ovsdb_in_bg = yes; then
+ wait $process_id
More information about the dev