diff mbox series

[ovs-dev] ovn-ctl: Handle cluster db upgrades for run_(nb/sb)_ovsdb

Message ID 20200903130400.1971690-1-numans@ovn.org
State Superseded
Headers show
Series [ovs-dev] ovn-ctl: Handle cluster db upgrades for run_(nb/sb)_ovsdb | expand

Commit Message

Numan Siddique Sept. 3, 2020, 1:04 p.m. UTC
From: Numan Siddique <numans@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.

Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1868392
Signed-off-by: Numan Siddique <numans@ovn.org>
---
 utilities/ovn-ctl | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

Comments

0-day Robot Sept. 3, 2020, 1:59 p.m. UTC | #1
Bleep bloop.  Greetings Numan Siddique, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
WARNING: Line is 91 characters long (recommended limit is 79)
#32 FILE: utilities/ovn-ctl:293:
    if test X$detach = Xno && test $mode = cluster && test -z "$cluster_remote_addr" ; then

WARNING: Line is 88 characters long (recommended limit is 79)
#34 FILE: utilities/ovn-ctl:295:
        # we want to run ovsdb-server in background rather than running it in foreground

Lines checked: 59, Warnings: 2, Errors: 0


Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot
Mark Michelson Sept. 8, 2020, 9:01 p.m. UTC | #2
This needs a rebase because commit
413cf9864024c4ef253ea177435161af198d5784 changed the way that the ovsdb 
server is started.


On 9/3/20 9:04 AM, numans@ovn.org wrote:
> From: Numan Siddique <numans@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.
> 
> Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1868392
> Signed-off-by: Numan Siddique <numans@ovn.org>
> ---
>   utilities/ovn-ctl | 18 +++++++++++++++++-
>   1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/utilities/ovn-ctl b/utilities/ovn-ctl
> index 8afe68a0ad..dee58d9a36 100755
> --- a/utilities/ovn-ctl
> +++ b/utilities/ovn-ctl
> @@ -288,7 +288,19 @@ $cluster_remote_port
>           set "$@" --sync-from=`cat $active_conf_file`
>       fi
>   
> -    "$@" "$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.
> +        run_ovsdb_in_bg="yes"
> +        "$@" $file &
> +        process_id=$!
> +    else
> +        "$@" $file
> +    fi
>   
>       # Initialize the database if it's NOT joining a cluster.
>       if test -z "$cluster_remote_addr"; then
> @@ -298,6 +310,10 @@ $cluster_remote_port
>       if test $mode = cluster; then
>           upgrade_cluster "$schema" "unix:$sock"
>       fi
> +
> +    if test $run_ovsdb_in_bg = yes; then
> +        wait $process_id
> +    fi
>   }
>   
>   start_nb_ovsdb() {
>
Numan Siddique Sept. 9, 2020, 7:20 a.m. UTC | #3
On Wed, Sep 9, 2020 at 2:31 AM Mark Michelson <mmichels@redhat.com> wrote:
>
> This needs a rebase because commit
> 413cf9864024c4ef253ea177435161af198d5784 changed the way that the ovsdb
> server is started.

Thanks for the review. I submitted v2 -
https://patchwork.ozlabs.org/project/ovn/patch/20200909071939.5095-1-numans@ovn.org/

Numan

>
>
> On 9/3/20 9:04 AM, numans@ovn.org wrote:
> > From: Numan Siddique <numans@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.
> >
> > Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1868392
> > Signed-off-by: Numan Siddique <numans@ovn.org>
> > ---
> >   utilities/ovn-ctl | 18 +++++++++++++++++-
> >   1 file changed, 17 insertions(+), 1 deletion(-)
> >
> > diff --git a/utilities/ovn-ctl b/utilities/ovn-ctl
> > index 8afe68a0ad..dee58d9a36 100755
> > --- a/utilities/ovn-ctl
> > +++ b/utilities/ovn-ctl
> > @@ -288,7 +288,19 @@ $cluster_remote_port
> >           set "$@" --sync-from=`cat $active_conf_file`
> >       fi
> >
> > -    "$@" "$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.
> > +        run_ovsdb_in_bg="yes"
> > +        "$@" $file &
> > +        process_id=$!
> > +    else
> > +        "$@" $file
> > +    fi
> >
> >       # Initialize the database if it's NOT joining a cluster.
> >       if test -z "$cluster_remote_addr"; then
> > @@ -298,6 +310,10 @@ $cluster_remote_port
> >       if test $mode = cluster; then
> >           upgrade_cluster "$schema" "unix:$sock"
> >       fi
> > +
> > +    if test $run_ovsdb_in_bg = yes; then
> > +        wait $process_id
> > +    fi
> >   }
> >
> >   start_nb_ovsdb() {
> >
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
diff mbox series

Patch

diff --git a/utilities/ovn-ctl b/utilities/ovn-ctl
index 8afe68a0ad..dee58d9a36 100755
--- a/utilities/ovn-ctl
+++ b/utilities/ovn-ctl
@@ -288,7 +288,19 @@  $cluster_remote_port
         set "$@" --sync-from=`cat $active_conf_file`
     fi
 
-    "$@" "$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.
+        run_ovsdb_in_bg="yes"
+        "$@" $file &
+        process_id=$!
+    else
+        "$@" $file
+    fi
 
     # Initialize the database if it's NOT joining a cluster.
     if test -z "$cluster_remote_addr"; then
@@ -298,6 +310,10 @@  $cluster_remote_port
     if test $mode = cluster; then
         upgrade_cluster "$schema" "unix:$sock"
     fi
+
+    if test $run_ovsdb_in_bg = yes; then
+        wait $process_id
+    fi
 }
 
 start_nb_ovsdb() {