From patchwork Tue Oct 9 07:17:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Numan Siddique X-Patchwork-Id: 981066 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42TpTK3F67z9s55 for ; Tue, 9 Oct 2018 18:17:25 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 60A33FFC; Tue, 9 Oct 2018 07:17:22 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id F28D6868 for ; Tue, 9 Oct 2018 07:17:20 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id A33E9D0 for ; Tue, 9 Oct 2018 07:17:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3900088E4F for ; Tue, 9 Oct 2018 07:17:20 +0000 (UTC) Received: from nusiddiq.redhat (ovpn-117-32.sin2.redhat.com [10.67.117.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id E52811054FBA; Tue, 9 Oct 2018 07:17:18 +0000 (UTC) From: nusiddiq@redhat.com To: dev@openvswitch.org Date: Tue, 9 Oct 2018 12:47:11 +0530 Message-Id: <20181009071711.28911-1-nusiddiq@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 09 Oct 2018 07:17:20 +0000 (UTC) X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH] ovn-ctl: Fix the wrong pidfile argument passed to ovsdb-servers X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Numan Siddique When OVN db servers are started usinb ovn-ctl, if the pid files (/var/run/openvswitch/ovnnb_db.pid for example) are already present, then ovn-ctl passes "--pidfile=123" if the pid file has '123' stored in it. Later on when OVN pacemaker RA script calls status_ovnnb/status_ovnsb() functions, these returns "not running". The shell function 'pidfile_is_running()' stores the contents of the pid file as "pid=`cat "$pidfile"`". If the caller also uses the same variable "pid" to store the file name, it gets overriden. This patch fixes this issue by renaming the local variable "pid" in the "start_ovsdb__()" shell function to "db_file_name". Signed-off-by: Numan Siddique --- ovn/utilities/ovn-ctl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ovn/utilities/ovn-ctl b/ovn/utilities/ovn-ctl index 3ff0df68e..950467c4e 100755 --- a/ovn/utilities/ovn-ctl +++ b/ovn/utilities/ovn-ctl @@ -95,7 +95,7 @@ promote_ovnsb() { start_ovsdb__() { local DB=$1 db=$2 schema_name=$3 table_name=$4 - local pid + local db_pid_file local cluster_local_addr local cluster_local_port local cluster_local_proto @@ -116,7 +116,7 @@ start_ovsdb__() { local addr local active_conf_file local use_remote_in_db - eval pid=\$DB_${DB}_PID + eval db_pid_file=\$DB_${DB}_PID eval cluster_local_addr=\$DB_${DB}_CLUSTER_LOCAL_ADDR eval cluster_local_port=\$DB_${DB}_CLUSTER_LOCAL_PORT eval cluster_local_proto=\$DB_${DB}_CLUSTER_LOCAL_PROTO @@ -139,7 +139,7 @@ start_ovsdb__() { eval use_remote_in_db=\$DB_${DB}_USE_REMOTE_IN_DB # Check and eventually start ovsdb-server for DB - if pidfile_is_running $pid; then + if pidfile_is_running $db_pid_file; then return fi @@ -169,7 +169,7 @@ $cluster_remote_port set ovsdb-server set "$@" $log --log-file=$logfile - set "$@" --remote=punix:$sock --pidfile=$pid + set "$@" --remote=punix:$sock --pidfile=$db_pid_file set "$@" --unixctl=ovn${db}_db.ctl [ "$OVS_USER" != "" ] && set "$@" --user "$OVS_USER"