From patchwork Wed Jun 26 10:59:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Martins X-Patchwork-Id: 1122681 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 45Yg656Q4sz9sDn for ; Wed, 26 Jun 2019 20:59:57 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 470FAD7F; Wed, 26 Jun 2019 10:59:54 +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 3FBBEB88 for ; Wed, 26 Jun 2019 10:59:53 +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 E311382C for ; Wed, 26 Jun 2019 10:59:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 15A12307D90D; Wed, 26 Jun 2019 10:59:34 +0000 (UTC) Received: from lucas-t460s.redhat.com (unknown [10.36.118.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5E16B5D70D; Wed, 26 Jun 2019 10:59:32 +0000 (UTC) From: lmartins@redhat.com To: dev@openvswitch.org Date: Wed, 26 Jun 2019 11:59:30 +0100 Message-Id: <20190626105930.10018-1-lmartins@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 26 Jun 2019 10:59:39 +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 v2] OVN: Enhance ovndb-servers.ocf to handle inactive_probe_interval updates 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: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Lucas Alvares Gomes This patch is enhacing the ovndb-servers.ocf script to handle updates to the inactive_probe_interval via pacemaker. For example, one could run: $ sudo crm_resource --resource ovndb_servers --set-parameter inactive_probe_interval --parameter-value To set a new inactive probe interval in OVSDB. The patch also handles the case were multiple connection exists. Signed-off-by: Lucas Alvares Gomes Acked-by: Numan Siddique --- v1 -> v2 * Fix "line is > 79 characters" warnings ovn/utilities/ovndb-servers.ocf | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/ovn/utilities/ovndb-servers.ocf b/ovn/utilities/ovndb-servers.ocf index 10313304c..38f75d476 100755 --- a/ovn/utilities/ovndb-servers.ocf +++ b/ovn/utilities/ovndb-servers.ocf @@ -240,20 +240,42 @@ ovsdb_server_notify() { else LISTON_ON_IP=${MASTER_IP} fi - conn=`ovn-nbctl get NB_global . connections` - if [ "$conn" == "[]" ] + conn=$(ovn-nbctl get NB_global . connections | \ + awk -F'[][]' '{print $2}') + if [ -z "$conn" ] then ovn-nbctl -- --id=@conn_uuid create Connection \ target="p${NB_MASTER_PROTO}\:${NB_MASTER_PORT}\:${LISTON_ON_IP}" \ inactivity_probe=$INACTIVE_PROBE -- set NB_Global . connections=@conn_uuid + else + for c in ${conn/, // } + do + iprob=`ovn-nbctl get Connection $c inactivity_probe` + if [ $iprob != $INACTIVE_PROBE ] + then + ovn-nbctl set Connection $c \ + inactivity_probe=$INACTIVE_PROBE + fi + done fi - conn=`ovn-sbctl get SB_global . connections` - if [ "$conn" == "[]" ] + conn=$(ovn-sbctl get SB_global . connections | \ + awk -F'[][]' '{print $2}') + if [ -z "$conn" ] then ovn-sbctl -- --id=@conn_uuid create Connection \ target="p${SB_MASTER_PROTO}\:${SB_MASTER_PORT}\:${LISTON_ON_IP}" \ inactivity_probe=$INACTIVE_PROBE -- set SB_Global . connections=@conn_uuid + else + for c in ${conn/, // } + do + iprob=`ovn-sbctl get Connection $c inactivity_probe` + if [ $iprob != $INACTIVE_PROBE ] + then + ovn-sbctl set Connection $c \ + inactivity_probe=$INACTIVE_PROBE + fi + done fi else