From patchwork Tue Feb 26 13:51:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Michelson X-Patchwork-Id: 1048367 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 4480lW34vWz9s70 for ; Wed, 27 Feb 2019 00:58:31 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 6D1B47865; Tue, 26 Feb 2019 13:57:56 +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 C121A712D for ; Tue, 26 Feb 2019 13:51:52 +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 46AA4826 for ; Tue, 26 Feb 2019 13:51:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C195881F35 for ; Tue, 26 Feb 2019 13:51:51 +0000 (UTC) Received: from monae.redhat.com (ovpn-121-115.rdu2.redhat.com [10.10.121.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 743F9611B0 for ; Tue, 26 Feb 2019 13:51:51 +0000 (UTC) From: Mark Michelson To: dev@openvswitch.org Date: Tue, 26 Feb 2019 08:51:50 -0500 Message-Id: <20190226135150.29736-1-mmichels@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 26 Feb 2019 13:51:51 +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 2.10] ovn-nbctl: Don't parse table-formatting options in nbctl_client 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 This is a backport to 2.10 of a feature already in 2.11. This is necessary for ovn-kubernetes to function properly when using 2.10. The original commit message is below. When ovn-nbctl is running in daemon mode, nbctl_client attempts to parse table formatting options. The problem is that this then removes the table formatting options from the array of options passed to the server loop. The server loop resets the table formatting options to the defaults and then attempts again to parse table formatting options. Unfortunately, they aren't present any longer. The result is that tables are always formatted with the default style. This patch solves the issue by not parsing the table formatting options in nbctl_client. Instead, the table formatting options are passed to the server loop and parsed there instead. Signed-off-by: Mark Michelson Signed-off-by: Ben Pfaff --- ovn/utilities/ovn-nbctl.c | 1 - tests/ovn-nbctl.at | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c index 09bbcf76a..a78c0008b 100644 --- a/ovn/utilities/ovn-nbctl.c +++ b/ovn/utilities/ovn-nbctl.c @@ -5364,7 +5364,6 @@ nbctl_client(const char *socket_name, break; VLOG_OPTION_HANDLERS - TABLE_OPTION_HANDLERS(&table_style) case OPT_LOCAL: default: diff --git a/tests/ovn-nbctl.at b/tests/ovn-nbctl.at index a599b1bf7..353eff610 100644 --- a/tests/ovn-nbctl.at +++ b/tests/ovn-nbctl.at @@ -1517,3 +1517,24 @@ AT_CHECK([ovn-nbctl create Port_Group name=pg0], [0], [ignore]) AT_CHECK([ovn-nbctl get Port_Group pg0 name], [0], [dnl "pg0" ])]) + +OVN_NBCTL_TEST([ovn_nbctl_extra_newlines], [extra newlines], [ +dnl This test addresses a specific issue seen when running ovn-nbctl in +dnl daemon mode. All we have to do is ensure that each time we list database +dnl information, there is not an extra newline at the beginning of the output. +AT_CHECK([ovn-nbctl ls-add sw1], [0], [ignore]) +AT_CHECK([ovn-nbctl --columns=name list logical_switch sw1], [0], [dnl +name : "sw1" +]) +AT_CHECK([ovn-nbctl --columns=name list logical_switch sw1], [0], [dnl +name : "sw1" +])]) + +OVN_NBCTL_TEST([ovn_nbctl_table_formatting], [table formatting], [ +dnl This test addresses a specific issue seen when running ovn-nbctl in +dnl daemon mode. We need to ensure that table formatting options are honored +dnl when listing database information. +AT_CHECK([ovn-nbctl ls-add sw1], [0], [ignore]) +AT_CHECK([ovn-nbctl --bare --columns=name list logical_switch sw1], [0], [dnl +sw1 +])])