From patchwork Wed Jun 3 12:43:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michele Baldessari X-Patchwork-Id: 1302973 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.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=acksyn.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=acksyn.org header.i=@acksyn.org header.a=rsa-sha256 header.s=2020041301 header.b=A1twRqCC; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49cT9n5Jwbz9sSF for ; Wed, 3 Jun 2020 22:43:57 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 3F5E286BB0; Wed, 3 Jun 2020 12:43:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id G_SbqQCN_Wh4; Wed, 3 Jun 2020 12:43:55 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 5ADFD86B24; Wed, 3 Jun 2020 12:43:55 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3B4B5C0178; Wed, 3 Jun 2020 12:43:55 +0000 (UTC) X-Original-To: ovs-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 3C3FCC016E for ; Wed, 3 Jun 2020 12:43:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 2ABE7884BF for ; Wed, 3 Jun 2020 12:43:54 +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 CoeV04yz-XH8 for ; Wed, 3 Jun 2020 12:43:53 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from post.acksyn.org (post.acksyn.org [95.216.23.136]) by hemlock.osuosl.org (Postfix) with ESMTP id 73FCF884A7 for ; Wed, 3 Jun 2020 12:43:53 +0000 (UTC) Received: from localhost (unknown [92.243.145.107]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: michele@acksyn.org) by post.acksyn.org (Postfix) with ESMTPSA id 91806169; Wed, 3 Jun 2020 12:43:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acksyn.org; s=2020041301; t=1591188231; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=VOen9IGgzTF9Vi+0fNOXq2Dg/OCWTjZLmtV0skEGtFw=; b=A1twRqCCbAwoc+ZA99ynbj9GAmXL5CHRRsIHJaCSqd6U4JsKrAS3nmuW8k/BsZ86hFxbc5 HiVEJkb+f8kbdiJg7nS5lsmMpBYHuMJUAsWMKZo8CZplhIZeQ9lLTdLVPBELtAa6qVW3j9 rI6KEOLTMpzxyiTW8LN/18xrK5Lm0oI= From: Michele Baldessari To: ovs-dev@openvswitch.org Date: Wed, 3 Jun 2020 14:43:47 +0200 Message-Id: <20200603124347.37761-1-michele@acksyn.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Cc: michele@acksyn.org Subject: [ovs-dev] [PATCH ovn v2] Make the notify() calls work with IPv6 in the OCF resource-agent 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" When the VIP is an IPv6 address we get the following error in the resource agent: ovndb_servers_notify_0:355:stderr [ + ovn-sbctl -- --id=@conn_uuid create Connection 'target=ptcp\:6642\:[fd00:fd00:fd00:2000::a2]' inactivity_probe=180000 -- set SB_Global . connections=@conn_uuid ] ovndb_servers_notify_0:355:stderr [ ovn-sbctl: ptcp\:6642\:[fd00:fd00:fd00:2000::a2]: unexpected "[" parsing string ] This is because MASTER_IP is an IPv6 address and is being passed to ovn-[ns]bctl without being escaped and the command errors out with unexpected parsing string errors. The rest of the create Connection command was already escaping the columns, we are just missing the ip address bits in case of IPv6. Let's make sure we escape the '[]:' characters and avoid this problem. Tested this on an OpenStack environment on both IPv6 and IPv4. Signed-off-by: Michele Baldessari --- utilities/ovndb-servers.ocf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utilities/ovndb-servers.ocf b/utilities/ovndb-servers.ocf index 56c2bc3227c3..354818a78d4d 100755 --- a/utilities/ovndb-servers.ocf +++ b/utilities/ovndb-servers.ocf @@ -249,7 +249,9 @@ ovsdb_server_notify() { if [ "x${LISTEN_ON_MASTER_IP_ONLY}" = xno ]; then LISTEN_ON_IP="0.0.0.0" else - LISTEN_ON_IP=${MASTER_IP} + # ovn-[sn]bctl want ':[]' characters to be escaped. We do so in order + # to make this work when MASTER_IP is an IPv6 address + LISTEN_ON_IP=$(sed -e 's/\(\[\|\]\|:\)/\\\1/g' <<< ${MASTER_IP}) fi conn=`ovn-nbctl get NB_global . connections` if [ "$conn" == "[]" ]