[ovs-dev,v2,OVN] ovn-ctl: Fix stucked while do cluster db init
diff mbox series

Message ID 20200317031610.5621-1-taoyunxiang@cmss.chinamobile.com
State New
Headers show
Series
  • [ovs-dev,v2,OVN] ovn-ctl: Fix stucked while do cluster db init
Related show

Commit Message

Tao YunXiang March 17, 2020, 3:16 a.m. UTC
For cluster mode, only the first server, which is the leader, in a cluster
should do init. But, sometimes, the role of the first server would transfer
leadership, so we should add --no-leader-only in case the ovn-northd stucked.


v1: ovn-ctl: Add "--no-leader-only" while cluster db init

Author: Tao YunXiang <taoyunxiang@cmss.chinamobile.com>
Co-authored-by: Liu Chang <liuchang@cmss.chinamobile.com>
Co-authored-by: Rong Yin <rongyin@cmss.chinamobile.com>
Signed-off-by: Tao YunXiang <taoyunxiang@cmss.chinamobile.com>
Signed-off-by: Liu Chang <liuchang@cmss.chinamobile.com>
Signed-off-by: Rong Yin <rongyin@cmss.chinamobile.com>

---
 utilities/ovn-ctl | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Han Zhou March 17, 2020, 6:35 a.m. UTC | #1
On Mon, Mar 16, 2020 at 8:16 PM Tao YunXiang <
taoyunxiang@cmss.chinamobile.com> wrote:
>
> For cluster mode, only the first server, which is the leader, in a cluster
> should do init. But, sometimes, the role of the first server would
transfer
> leadership, so we should add --no-leader-only in case the ovn-northd
stucked.
>
>
> v1: ovn-ctl: Add "--no-leader-only" while cluster db init
>
> Author: Tao YunXiang <taoyunxiang@cmss.chinamobile.com>
> Co-authored-by: Liu Chang <liuchang@cmss.chinamobile.com>
> Co-authored-by: Rong Yin <rongyin@cmss.chinamobile.com>
> Signed-off-by: Tao YunXiang <taoyunxiang@cmss.chinamobile.com>
> Signed-off-by: Liu Chang <liuchang@cmss.chinamobile.com>
> Signed-off-by: Rong Yin <rongyin@cmss.chinamobile.com>
>
> ---
>  utilities/ovn-ctl | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/utilities/ovn-ctl b/utilities/ovn-ctl
> index 2a337ae27..8afe68a0a 100755
> --- a/utilities/ovn-ctl
> +++ b/utilities/ovn-ctl
> @@ -290,10 +290,9 @@ $cluster_remote_port
>
>      "$@" "$file"
>
> -    # Initialize the database if it's running standalone,
> -    # active-passive, or is the first server in a cluster.
> +    # Initialize the database if it's NOT joining a cluster.
>      if test -z "$cluster_remote_addr"; then
> -        $(echo ovn-${db}ctl | tr _ -) init
> +        $(echo ovn-${db}ctl | tr _ -) --no-leader-only init
>      fi
>
>      if test $mode = cluster; then
> --
> 2.17.1
>
>
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Thanks for the revision. I applied to master after removing the below line
in commit message:

v1: ovn-ctl: Add "--no-leader-only" while cluster db init

(Usually, notes about different versions of patches are added after the
line "---" in the patch, so that it will be ignored by git automatically.)

Patch
diff mbox series

diff --git a/utilities/ovn-ctl b/utilities/ovn-ctl
index 2a337ae27..8afe68a0a 100755
--- a/utilities/ovn-ctl
+++ b/utilities/ovn-ctl
@@ -290,10 +290,9 @@  $cluster_remote_port
 
     "$@" "$file"
 
-    # Initialize the database if it's running standalone,
-    # active-passive, or is the first server in a cluster.
+    # Initialize the database if it's NOT joining a cluster.
     if test -z "$cluster_remote_addr"; then
-        $(echo ovn-${db}ctl | tr _ -) init
+        $(echo ovn-${db}ctl | tr _ -) --no-leader-only init
     fi
 
     if test $mode = cluster; then