diff mbox series

[ovs-dev,3/3] ovn-trace: Fix warnings when port is found but not in current datapath.

Message ID 1533609842-104523-4-git-send-email-hzhou8@ebay.com
State Accepted
Headers show
Series Port group related enhancements. | expand

Commit Message

Han Zhou Aug. 7, 2018, 2:44 a.m. UTC
When port group is used, ovn-trace may print warnings like this:

$ ovn-trace ls1 'inport == "lp111" && eth.src == f0:00:00:00:01:11 && eth.dst == f0:00:00:00:01:12  && ip4.src == 192.168.11.1 && ip4.dst == 192.168.11.2 && ip.ttl == 10'
2018-08-02T01:43:23Z|00001|ovntrace|WARN|lp211: not in datapath ls1
2018-08-02T01:43:23Z|00002|ovntrace|WARN|lp211: unknown logical port
2018-08-02T01:43:23Z|00003|ovntrace|WARN|lp221: not in datapath ls1
2018-08-02T01:43:23Z|00004|ovntrace|WARN|lp221: unknown logical port
2018-08-02T01:43:23Z|00005|ovntrace|WARN|lp231: not in datapath ls1
2018-08-02T01:43:23Z|00006|ovntrace|WARN|lp231: unknown logical port

There are 2 warnings:

For the first one, it might be reasonable
before port group is supported, but now since ports in a port group
can span across multiple datapaths, this situation is normal, and
warning should not be printed.

For the second one, it is misleading, and it should not be printed
in this situation even before port group is supported. It should be
printed only if the port is not found at all.

This patch fixes both.

Signed-off-by: Han Zhou <hzhou8@ebay.com>
---
 ovn/utilities/ovn-trace.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Mark Michelson Aug. 7, 2018, 8:50 p.m. UTC | #1
Acked-by: Mark Michelson <mmichels@redhat.com>

With a patch like this, I like to look at it and ask myself "What will 
this break?" In this case, I believe nothing will actually be broken.

On 08/06/2018 10:44 PM, Han Zhou wrote:
> When port group is used, ovn-trace may print warnings like this:
> 
> $ ovn-trace ls1 'inport == "lp111" && eth.src == f0:00:00:00:01:11 && eth.dst == f0:00:00:00:01:12  && ip4.src == 192.168.11.1 && ip4.dst == 192.168.11.2 && ip.ttl == 10'
> 2018-08-02T01:43:23Z|00001|ovntrace|WARN|lp211: not in datapath ls1
> 2018-08-02T01:43:23Z|00002|ovntrace|WARN|lp211: unknown logical port
> 2018-08-02T01:43:23Z|00003|ovntrace|WARN|lp221: not in datapath ls1
> 2018-08-02T01:43:23Z|00004|ovntrace|WARN|lp221: unknown logical port
> 2018-08-02T01:43:23Z|00005|ovntrace|WARN|lp231: not in datapath ls1
> 2018-08-02T01:43:23Z|00006|ovntrace|WARN|lp231: unknown logical port
> 
> There are 2 warnings:
> 
> For the first one, it might be reasonable
> before port group is supported, but now since ports in a port group
> can span across multiple datapaths, this situation is normal, and
> warning should not be printed.
> 
> For the second one, it is misleading, and it should not be printed
> in this situation even before port group is supported. It should be
> printed only if the port is not found at all.
> 
> This patch fixes both.
> 
> Signed-off-by: Han Zhou <hzhou8@ebay.com>
> ---
>   ovn/utilities/ovn-trace.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/ovn/utilities/ovn-trace.c b/ovn/utilities/ovn-trace.c
> index 1fd48f2..7ca3d97 100644
> --- a/ovn/utilities/ovn-trace.c
> +++ b/ovn/utilities/ovn-trace.c
> @@ -1020,7 +1020,9 @@ ovntrace_lookup_port(const void *dp_, const char *port_name,
>               *portp = port->tunnel_key;
>               return true;
>           }
> -        VLOG_WARN("%s: not in datapath %s", port_name, dp->name);
> +        /* The port is found but not in this datapath. It happens when port
> +         * group is used in match conditions. */
> +        return false;
>       }
>   
>       const struct ovntrace_mcgroup *mcgroup = ovntrace_mcgroup_find_by_name(dp, port_name);
>
diff mbox series

Patch

diff --git a/ovn/utilities/ovn-trace.c b/ovn/utilities/ovn-trace.c
index 1fd48f2..7ca3d97 100644
--- a/ovn/utilities/ovn-trace.c
+++ b/ovn/utilities/ovn-trace.c
@@ -1020,7 +1020,9 @@  ovntrace_lookup_port(const void *dp_, const char *port_name,
             *portp = port->tunnel_key;
             return true;
         }
-        VLOG_WARN("%s: not in datapath %s", port_name, dp->name);
+        /* The port is found but not in this datapath. It happens when port
+         * group is used in match conditions. */
+        return false;
     }
 
     const struct ovntrace_mcgroup *mcgroup = ovntrace_mcgroup_find_by_name(dp, port_name);