diff mbox series

[ovs-dev,2.10,v2,2/2] ovn-nbctl: Don't parse table-formatting options in nbctl_client

Message ID 20190226142600.3542-3-mmichels@redhat.com
State Accepted
Commit 7b06e1db1f0f37239b709a18f540085e039d240b
Headers show
Series Fix ovn-nbctl daemon table printing issues. | expand

Commit Message

Mark Michelson Feb. 26, 2019, 2:26 p.m. UTC
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 <mmichels@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 ovn/utilities/ovn-nbctl.c | 1 -
 tests/ovn-nbctl.at        | 9 +++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

Comments

Numan Siddique Feb. 26, 2019, 3:44 p.m. UTC | #1
On Tue, Feb 26, 2019 at 8:07 PM Mark Michelson <mmichels@redhat.com> wrote:

> 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 <mmichels@redhat.com>
> Signed-off-by: Ben Pfaff <blp@ovn.org>
>

Acked-by: Numan Siddique <nusiddiq@redhat.com>


> ---
>  ovn/utilities/ovn-nbctl.c | 1 -
>  tests/ovn-nbctl.at        | 9 +++++++++
>  2 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
> index b5ee0a6e1..206f3b3eb 100644
> --- a/ovn/utilities/ovn-nbctl.c
> +++ b/ovn/utilities/ovn-nbctl.c
> @@ -5365,7 +5365,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 7d627cdc0..3f89874ba 100644
> --- a/tests/ovn-nbctl.at
> +++ b/tests/ovn-nbctl.at
> @@ -1530,3 +1530,12 @@ 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
> +])])
> --
> 2.14.5
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
diff mbox series

Patch

diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
index b5ee0a6e1..206f3b3eb 100644
--- a/ovn/utilities/ovn-nbctl.c
+++ b/ovn/utilities/ovn-nbctl.c
@@ -5365,7 +5365,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 7d627cdc0..3f89874ba 100644
--- a/tests/ovn-nbctl.at
+++ b/tests/ovn-nbctl.at
@@ -1530,3 +1530,12 @@  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
+])])