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: 1360360 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.133; helo=hemlock.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BmYLk0Sntz9sSJ for ; Wed, 9 Sep 2020 17:19:57 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id DAA5C874F7; Wed, 9 Sep 2020 07:19:55 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LoeVUrOVjhqO; Wed, 9 Sep 2020 07:19:55 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 5DA75874F2; Wed, 9 Sep 2020 07:19:55 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 423F6C0859; Wed, 9 Sep 2020 07:19:55 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8B3F3C0051 for ; Wed, 9 Sep 2020 07:19:53 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 6E6E4874F2 for ; Wed, 9 Sep 2020 07:19:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Jwx30Ilp1BQV for ; Wed, 9 Sep 2020 07:19:49 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by hemlock.osuosl.org (Postfix) with ESMTPS id 99A99874EE for ; Wed, 9 Sep 2020 07:19:49 +0000 (UTC) X-Originating-IP: 27.7.129.187 Received: from nusiddiq.home.org.com (unknown [27.7.129.187]) (Authenticated sender: numans@ovn.org) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 2322A1BF205; Wed, 9 Sep 2020 07:19:46 +0000 (UTC) From: numans@ovn.org To: dev@openvswitch.org Date: Wed, 9 Sep 2020 12:49:39 +0530 Message-Id: <20200909071939.5095-1-numans@ovn.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Subject: [ovs-dev] [PATCH ovn v2] 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: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Numan Siddique 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 Acked-by: Mark Michelson --- v1 -> v2 ----- * Rebased to resovle the conflicts. utilities/ovn-ctl | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/utilities/ovn-ctl b/utilities/ovn-ctl index af095ea1bd..c44201ccfb 100755 --- a/utilities/ovn-ctl +++ b/utilities/ovn-ctl @@ -288,7 +288,21 @@ $cluster_remote_port set "$@" --sync-from=`cat $active_conf_file` fi - start_wrapped_daemon "$wrapper" ovsdb-$db "" "$@" "$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() {