diff mbox series

[ovs-dev] ofproto: delete buckets when lb_output is false

Message ID 20200626115116.795656-1-amorenoz@redhat.com
State New
Headers show
Series [ovs-dev] ofproto: delete buckets when lb_output is false | expand

Commit Message

Adrian Moreno June 26, 2020, 11:51 a.m. UTC
When lb-output-action is toggled back to "false" buckets are not being
deleted. Delete them as they will no longer be used.

Add unit test to verify buckets are correctly deleted.

Cc: Vishal Deep Ajmera <vishal.deep.ajmera@ericsson.com>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>

---
 ofproto/bond.c        | 3 +++
 tests/ofproto-dpif.at | 4 ++++
 2 files changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/ofproto/bond.c b/ofproto/bond.c
index 9947e7531..2466c4d02 100644
--- a/ofproto/bond.c
+++ b/ofproto/bond.c
@@ -490,6 +490,9 @@  bond_reconfigure(struct bond *bond, const struct bond_settings *s)
                       "disabled.", bond->name);
         } else {
             bond->use_lb_output_action = s->use_lb_output_action;
+            if (!bond->use_lb_output_action) {
+                bond_del_lb_output_buckets(bond);
+            }
             revalidate = true;
         }
     }
diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
index e3402e7b8..c1455d8aa 100644
--- a/tests/ofproto-dpif.at
+++ b/tests/ofproto-dpif.at
@@ -193,6 +193,10 @@  AT_CHECK([test $(grep -c in_port.5 br1_flows.txt) -gt 24])
 AT_CHECK([test $(grep -c in_port.6 br1_flows.txt) -gt 24])
 AT_CHECK([grep -q lb_output br0_flows.txt])
 
+AT_CHECK([test $(ovs-appctl dpif-netdev/bond-show | grep -c bucket) -eq 256])
+AT_CHECK([ovs-vsctl set Port bond0 other_config:lb-output-action=false])
+OVS_WAIT_UNTIL([test -z "$(ovs-appctl dpif-netdev/bond-show)"])
+
 OVS_VSWITCHD_STOP()
 AT_CLEANUP