From 14888212244dd2040c9b3ccf1f86ab67aebbe9b2 Mon Sep 17 00:00:00 2001 From: Lorenzo Bianconi Date: Tue, 6 Aug 2019 16:35:47 +0200 Subject: [PATCH] OVN: fix default L4 default proto reported by ovn-nbctl If no protcol is specified defining a load balancing rule TCP is selected as default but ovn-nbctl lb-list reports 'tcp/udp' in this case. Fix it reporting tcp in this case Fixes: e2bfcad6cbb0 ("ovn-nbctl: Add LB commands") Acked-by: Dumitru Ceara Signed-off-by: Lorenzo Bianconi Signed-off-by: Justin Pettit (cherry picked from ovn repo commit 04e10d14529732dd4b94ce7f5c6a07bfdd8da3c2) --- ovn/utilities/ovn-nbctl.c | 2 +- tests/ovn-nbctl.at | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c index 98a8faa0b15..7a38b2bf7d7 100644 --- a/ovn/utilities/ovn-nbctl.c +++ b/ovn/utilities/ovn-nbctl.c @@ -2864,7 +2864,7 @@ lb_info_add_smap(const struct nbrec_load_balancer *lb, continue; } - char *protocol = ss_get_port(&ss) ? lb->protocol : "tcp/udp"; + char *protocol = ss_get_port(&ss) ? lb->protocol : "tcp"; i == 0 ? ds_put_format(&val, UUID_FMT " %-20.16s%-11.7s%-*.*s%s", UUID_ARGS(&lb->header_.uuid), diff --git a/tests/ovn-nbctl.at b/tests/ovn-nbctl.at index 18c5c1d42d2..e87242c039f 100644 --- a/tests/ovn-nbctl.at +++ b/tests/ovn-nbctl.at @@ -657,8 +657,8 @@ AT_CHECK([ovn-nbctl lb-list | uuidfilt], [0], [dnl UUID LB PROTO VIP IPs <0> lb0 tcp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 <1> lb1 udp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:8080 -<2> lb2 tcp/udp 30.0.0.30 192.168.10.10 -<3> lb3 tcp/udp 30.0.0.30 192.168.10.10 +<2> lb2 tcp 30.0.0.30 192.168.10.10 +<3> lb3 tcp 30.0.0.30 192.168.10.10 ]) AT_CHECK([ovn-nbctl lb-del lb2 30.0.0.30]) AT_CHECK([ovn-nbctl lb-del lb3 30.0.0.30]) @@ -710,14 +710,14 @@ AT_CHECK([ovn-nbctl ls-lb-list ls0 | uuidfilt], [0], [dnl UUID LB PROTO VIP IPs <0> lb0 tcp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 <1> lb1 udp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 -<2> lb3 tcp/udp 30.0.0.10 192.168.10.10,192.168.10.20 +<2> lb3 tcp 30.0.0.10 192.168.10.10,192.168.10.20 ]) AT_CHECK([ovn-nbctl ls-lb-del ls0 lb0]) AT_CHECK([ovn-nbctl ls-lb-list ls0 | uuidfilt], [0], [dnl UUID LB PROTO VIP IPs <0> lb1 udp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 -<1> lb3 tcp/udp 30.0.0.10 192.168.10.10,192.168.10.20 +<1> lb3 tcp 30.0.0.10 192.168.10.10,192.168.10.20 ]) AT_CHECK([ovn-nbctl ls-lb-del ls0 lb1]) @@ -746,14 +746,14 @@ AT_CHECK([ovn-nbctl lr-lb-list lr0 | uuidfilt], [0], [dnl UUID LB PROTO VIP IPs <0> lb0 tcp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 <1> lb1 udp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 -<2> lb3 tcp/udp 30.0.0.10 192.168.10.10,192.168.10.20 +<2> lb3 tcp 30.0.0.10 192.168.10.10,192.168.10.20 ]) AT_CHECK([ovn-nbctl lr-lb-del lr0 lb0]) AT_CHECK([ovn-nbctl lr-lb-list lr0 | uuidfilt], [0], [dnl UUID LB PROTO VIP IPs <0> lb1 udp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 -<1> lb3 tcp/udp 30.0.0.10 192.168.10.10,192.168.10.20 +<1> lb3 tcp 30.0.0.10 192.168.10.10,192.168.10.20 ]) AT_CHECK([ovn-nbctl lr-lb-del lr0 lb1]) @@ -924,8 +924,8 @@ AT_CHECK([ovn-nbctl lb-list | uuidfilt], [0], [dnl UUID LB PROTO VIP IPs <0> lb0 tcp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:80 <1> lb1 udp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:8080 -<2> lb2 tcp/udp ae0f::30 fd0f::10 -<3> lb3 tcp/udp ae0f::30 fd0f::10 +<2> lb2 tcp ae0f::30 fd0f::10 +<3> lb3 tcp ae0f::30 fd0f::10 ]) AT_CHECK([ovn-nbctl lb-del lb2 ae0f::30]) AT_CHECK([ovn-nbctl lb-del lb3 ae0f::30]) @@ -977,14 +977,14 @@ AT_CHECK([ovn-nbctl ls-lb-list ls0 | uuidfilt], [0], [dnl UUID LB PROTO VIP IPs <0> lb0 tcp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:80 <1> lb1 udp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:80 -<2> lb3 tcp/udp ae0f::10 fd0f::10,fd0f::20 +<2> lb3 tcp ae0f::10 fd0f::10,fd0f::20 ]) AT_CHECK([ovn-nbctl ls-lb-del ls0 lb0]) AT_CHECK([ovn-nbctl ls-lb-list ls0 | uuidfilt], [0], [dnl UUID LB PROTO VIP IPs <0> lb1 udp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:80 -<1> lb3 tcp/udp ae0f::10 fd0f::10,fd0f::20 +<1> lb3 tcp ae0f::10 fd0f::10,fd0f::20 ]) AT_CHECK([ovn-nbctl ls-lb-del ls0 lb1]) @@ -1013,14 +1013,14 @@ AT_CHECK([ovn-nbctl lr-lb-list lr0 | uuidfilt], [0], [dnl UUID LB PROTO VIP IPs <0> lb0 tcp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:80 <1> lb1 udp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:80 -<2> lb3 tcp/udp ae0f::10 fd0f::10,fd0f::20 +<2> lb3 tcp ae0f::10 fd0f::10,fd0f::20 ]) AT_CHECK([ovn-nbctl lr-lb-del lr0 lb0]) AT_CHECK([ovn-nbctl lr-lb-list lr0 | uuidfilt], [0], [dnl UUID LB PROTO VIP IPs <0> lb1 udp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:80 -<1> lb3 tcp/udp ae0f::10 fd0f::10,fd0f::20 +<1> lb3 tcp ae0f::10 fd0f::10,fd0f::20 ]) AT_CHECK([ovn-nbctl lr-lb-del lr0 lb1])