[ovs-dev] ovs-save: Parse geneve tlv map correctly.

Message ID 1538974395-9691-1-git-send-email-guru@ovn.org
State New
Headers show
Series
  • [ovs-dev] ovs-save: Parse geneve tlv map correctly.
Related show

Commit Message

Guru Shetty Oct. 8, 2018, 4:53 a.m.
We now have an extra space in the o/p of `ovs-ofctl dump-tlv-map`.

Fixes: 5a0e4aec1af (treewide: Convert leading tabs to spaces.)
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
---
 utilities/ovs-save | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ben Pfaff Oct. 8, 2018, 6:12 p.m. | #1
On Sun, Oct 07, 2018 at 09:53:15PM -0700, Gurucharan Shetty wrote:
> We now have an extra space in the o/p of `ovs-ofctl dump-tlv-map`.
> 
> Fixes: 5a0e4aec1af (treewide: Convert leading tabs to spaces.)
> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
> ---
>  utilities/ovs-save | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/utilities/ovs-save b/utilities/ovs-save
> index 5c046bb..f85d97a 100755
> --- a/utilities/ovs-save
> +++ b/utilities/ovs-save
> @@ -117,7 +117,7 @@ save_flows () {
>  
>          printf "%s" "ovs-ofctl add-tlv-map ${bridge} '"
>          ovs-ofctl dump-tlv-map ${bridge} | \
> -        awk '/^ 0x/ {if (cnt != 0) printf ","; \
> +        awk '/^  0x/ {if (cnt != 0) printf ","; \

It might be better to use /^  *0x/, because that will handle either
form.  ovs-save is used during upgrades so there's some ambiguity about
which version of ovs-ofctl is going to be used, and in general accepting
more flexible input is good.

Acked-by: Ben Pfaff <blp@ovn.org>

Thanks,

Ben.
Guru Shetty Oct. 8, 2018, 6:29 p.m. | #2
On Mon, 8 Oct 2018 at 11:12, Ben Pfaff <blp@ovn.org> wrote:

> On Sun, Oct 07, 2018 at 09:53:15PM -0700, Gurucharan Shetty wrote:
> > We now have an extra space in the o/p of `ovs-ofctl dump-tlv-map`.
> >
> > Fixes: 5a0e4aec1af (treewide: Convert leading tabs to spaces.)
> > Signed-off-by: Gurucharan Shetty <guru@ovn.org>
> > ---
> >  utilities/ovs-save | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/utilities/ovs-save b/utilities/ovs-save
> > index 5c046bb..f85d97a 100755
> > --- a/utilities/ovs-save
> > +++ b/utilities/ovs-save
> > @@ -117,7 +117,7 @@ save_flows () {
> >
> >          printf "%s" "ovs-ofctl add-tlv-map ${bridge} '"
> >          ovs-ofctl dump-tlv-map ${bridge} | \
> > -        awk '/^ 0x/ {if (cnt != 0) printf ","; \
> > +        awk '/^  0x/ {if (cnt != 0) printf ","; \
>
> It might be better to use /^  *0x/, because that will handle either
> form.  ovs-save is used during upgrades so there's some ambiguity about
> which version of ovs-ofctl is going to be used, and in general accepting
> more flexible input is good.
>
> Acked-by: Ben Pfaff <blp@ovn.org>
>
You are right. I will use your suggestion and merge to master and 2.10


>
> Thanks,
>
> Ben.
>

Patch

diff --git a/utilities/ovs-save b/utilities/ovs-save
index 5c046bb..f85d97a 100755
--- a/utilities/ovs-save
+++ b/utilities/ovs-save
@@ -117,7 +117,7 @@  save_flows () {
 
         printf "%s" "ovs-ofctl add-tlv-map ${bridge} '"
         ovs-ofctl dump-tlv-map ${bridge} | \
-        awk '/^ 0x/ {if (cnt != 0) printf ","; \
+        awk '/^  0x/ {if (cnt != 0) printf ","; \
              cnt++;printf "{class="$1",type="$2",len="$3"}->"$4}'
         echo "'"