Message ID | 1452787395-2383-2-git-send-email-russell@ovn.org |
---|---|
State | Superseded |
Headers | show |
On Thu, Jan 14, 2016 at 11:03:15AM -0500, Russell Bryant wrote: > This patch updates the formatting for the Logical_Port addresses column > in the show command output. Previously, output would look like: > > addresses: 00:00:00:00:00:01 192.168.1.1 00:00:00:00:00:01 192.168.1.2 > > Now it looks like: > > addresses: ["00:00:00:00:00:01 192.168.1.1", "00:00:00:00:00:01 192.168.1.2"] > > The grouping of addresses is important, so it should be reflected in the > output. > > Signed-off-by: Russell Bryant <russell@ovn.org> Hmm, I think just adding commas would be good enough, but the extra syntax doesn't hurt I guess. Acked-by: Ben Pfaff <blp@ovn.org>
diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c index 7c715b9..9e87109 100644 --- a/ovn/utilities/ovn-nbctl.c +++ b/ovn/utilities/ovn-nbctl.c @@ -407,11 +407,13 @@ print_lswitch(const struct nbrec_logical_switch *lswitch, struct ds *s) ds_put_format(s, " tag: %"PRIu64"\n", lport->tag[0]); } if (lport->n_addresses) { - ds_put_cstr(s, " addresses:"); + ds_put_cstr(s, " addresses: ["); for (size_t j = 0; j < lport->n_addresses; j++) { - ds_put_format(s, " %s", lport->addresses[j]); + ds_put_format(s, "%s\"%s\"", + j == 0 ? "" : ", ", + lport->addresses[j]); } - ds_put_char(s, '\n'); + ds_put_cstr(s, "]\n"); } } }
This patch updates the formatting for the Logical_Port addresses column in the show command output. Previously, output would look like: addresses: 00:00:00:00:00:01 192.168.1.1 00:00:00:00:00:01 192.168.1.2 Now it looks like: addresses: ["00:00:00:00:00:01 192.168.1.1", "00:00:00:00:00:01 192.168.1.2"] The grouping of addresses is important, so it should be reflected in the output. Signed-off-by: Russell Bryant <russell@ovn.org> --- ovn/utilities/ovn-nbctl.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)