[ovs-dev] ovn-nbctl: Split parent and tag in "show" output.
diff mbox

Message ID 1444011290-22165-1-git-send-email-rbryant@redhat.com
State Superseded
Headers show

Commit Message

Russell Bryant Oct. 5, 2015, 2:14 a.m. UTC
As of 779e72cc57a106251cc9e6696e8c9aabb56d30b5, localnet ports may have
the tag column set.  This case does not make use of the parent column,
so output these fields independently of each other.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
---
 ovn/utilities/ovn-nbctl.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Ben Pfaff Oct. 5, 2015, 10:37 p.m. UTC | #1
On Sun, Oct 04, 2015 at 10:14:50PM -0400, Russell Bryant wrote:
> As of 779e72cc57a106251cc9e6696e8c9aabb56d30b5, localnet ports may have
> the tag column set.  This case does not make use of the parent column,
> so output these fields independently of each other.
> 
> Signed-off-by: Russell Bryant <rbryant@redhat.com>
> ---
>  ovn/utilities/ovn-nbctl.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
> index 2d2a5ee..45fc7d0 100644
> --- a/ovn/utilities/ovn-nbctl.c
> +++ b/ovn/utilities/ovn-nbctl.c
> @@ -404,9 +404,11 @@ print_lswitch(const struct nbrec_logical_switch *lswitch, struct ds *s)
>          const struct nbrec_logical_port *lport = lswitch->ports[i];
>  
>          ds_put_format(s, "        lport %s\n", lport->name);
> -        if (lport->parent_name && lport->n_tag) {
> -            ds_put_format(s, "            parent: %s, tag:%"PRIu64"\n",
> -                          lport->parent_name, lport->tag[0]);
> +        if (lport->parent_name) {
> +            ds_put_format(s, "            parent: %s\n", lport->parent_name);
> +        }
> +        if (lport->n_tag) {
> +            ds_put_format(s, "            tag:%"PRIu64"\n", lport->tag[0]);
>          }

Any reason why "parent: " gets a space but "tag:" doesn't?
Russell Bryant Oct. 6, 2015, 3:48 a.m. UTC | #2
> On Oct 5, 2015, at 11:37 PM, Ben Pfaff <blp@nicira.com> wrote:
> 
>> On Sun, Oct 04, 2015 at 10:14:50PM -0400, Russell Bryant wrote:
>> As of 779e72cc57a106251cc9e6696e8c9aabb56d30b5, localnet ports may have
>> the tag column set.  This case does not make use of the parent column,
>> so output these fields independently of each other.
>> 
>> Signed-off-by: Russell Bryant <rbryant@redhat.com>
>> ---
>> ovn/utilities/ovn-nbctl.c | 8 +++++---
>> 1 file changed, 5 insertions(+), 3 deletions(-)
>> 
>> diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
>> index 2d2a5ee..45fc7d0 100644
>> --- a/ovn/utilities/ovn-nbctl.c
>> +++ b/ovn/utilities/ovn-nbctl.c
>> @@ -404,9 +404,11 @@ print_lswitch(const struct nbrec_logical_switch *lswitch, struct ds *s)
>>         const struct nbrec_logical_port *lport = lswitch->ports[i];
>> 
>>         ds_put_format(s, "        lport %s\n", lport->name);
>> -        if (lport->parent_name && lport->n_tag) {
>> -            ds_put_format(s, "            parent: %s, tag:%"PRIu64"\n",
>> -                          lport->parent_name, lport->tag[0]);
>> +        if (lport->parent_name) {
>> +            ds_put_format(s, "            parent: %s\n", lport->parent_name);
>> +        }
>> +        if (lport->n_tag) {
>> +            ds_put_format(s, "            tag:%"PRIu64"\n", lport->tag[0]);
>>         }
> 
> Any reason why "parent: " gets a space but "tag:" doesn't?

Not a good one. I just copied how it was before but I think it's just a typo. I'll send a v2 with the space. 

--
Russell

Patch
diff mbox

diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
index 2d2a5ee..45fc7d0 100644
--- a/ovn/utilities/ovn-nbctl.c
+++ b/ovn/utilities/ovn-nbctl.c
@@ -404,9 +404,11 @@  print_lswitch(const struct nbrec_logical_switch *lswitch, struct ds *s)
         const struct nbrec_logical_port *lport = lswitch->ports[i];
 
         ds_put_format(s, "        lport %s\n", lport->name);
-        if (lport->parent_name && lport->n_tag) {
-            ds_put_format(s, "            parent: %s, tag:%"PRIu64"\n",
-                          lport->parent_name, lport->tag[0]);
+        if (lport->parent_name) {
+            ds_put_format(s, "            parent: %s\n", lport->parent_name);
+        }
+        if (lport->n_tag) {
+            ds_put_format(s, "            tag:%"PRIu64"\n", lport->tag[0]);
         }
         if (lport->n_macs) {
             ds_put_cstr(s, "            macs:");