From patchwork Wed Sep 9 07:19:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Numan Siddique X-Patchwork-Id: 1441555 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dh7D56ckHz9sRf for ; Thu, 18 Feb 2021 19:29:25 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id DE9D5605E3 for ; Thu, 18 Feb 2021 08:29:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Bzvqcg92mamk for ; Thu, 18 Feb 2021 08:29:22 +0000 (UTC) Received: by smtp3.osuosl.org (Postfix, from userid 1001) id 35B3B605E8; Thu, 18 Feb 2021 08:29:22 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTP id F0E6960591; Thu, 18 Feb 2021 08:29:15 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id CB4DEC000E; Thu, 18 Feb 2021 08:29:15 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 27D04C000D for ; Thu, 18 Feb 2021 08:29:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 16A7E80646 for ; Thu, 18 Feb 2021 08:29:15 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id O-J3a806KHGh for ; Thu, 18 Feb 2021 08:29:14 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from ti0189a330-0925.bb.online.no (ti0189a330-0925.bb.online.no [88.88.218.161]) by whitealder.osuosl.org (Postfix) with ESMTP id AC0D18647A for ; Thu, 18 Feb 2021 08:28:55 +0000 (UTC) X-Mailbox-Line: From 22037c2c5c25aef29e4fd0e3d3fb88bc371c0d55 Mon Sep 17 00:00:00 2001 Message-Id: <22037c2c5c25aef29e4fd0e3d3fb88bc371c0d55.1613635760.git.frode.nordahl@canonical.com> In-Reply-To: References: From: Numan Siddique To: dev@openvswitch.org Date: Wed, 9 Sep 2020 12:49:39 +0530 Subject: [ovs-dev] [PATCH ovn branch-20.06 01/15] ovn-ctl: Handle cluster db upgrades for run_(nb/sb)_ovsdb X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" 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 Acked-by: Mark Michelson Signed-off-by: Numan Siddique (cherry picked from commit 67e2f386cc838d0b0f9b4b5da7fe611e1113b70c) Signed-off-by: Frode Nordahl --- utilities/ovn-ctl | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/utilities/ovn-ctl b/utilities/ovn-ctl index 8afe68a0a..ad8e6bb04 100755 --- a/utilities/ovn-ctl +++ b/utilities/ovn-ctl @@ -288,7 +288,21 @@ $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. + # Note: We run only the ovsdb-server in backgroud which created the + # cluster (i.e cluster_remote_addr is not set.). + run_ovsdb_in_bg="yes" + "$@" $file & + process_id=$! + else + start_wrapped_daemon "$wrapper" ovsdb-$db "" "$@" "$file" + fi # 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" fi + + if test $run_ovsdb_in_bg = yes; then + wait $process_id + fi } start_nb_ovsdb() {