Remove meters created through set_meter() action if the related entry in
the NB QoS table has been deleted.

Fixes: 885655e16 ("controller: reconfigure ovs meters for ovn meters")
Signed-off-by: Lorenzo Bianconi <[email protected]>
---
 controller/ofctrl.c | 7 +++++++
 tests/ovn.at        | 4 ++++
 2 files changed, 11 insertions(+)

diff --git a/controller/ofctrl.c b/controller/ofctrl.c
index a7c2d2011..2d8a8ec9c 100644
--- a/controller/ofctrl.c
+++ b/controller/ofctrl.c
@@ -2665,6 +2665,13 @@ ofctrl_put(struct ovn_desired_flow_table *lflow_table,
     EXTEND_TABLE_FOR_EACH_INSTALLED (m_installed, next_meter, meters) {
         /* Delete the meter. */
         ofctrl_meter_bands_erase(m_installed, &msgs);
+        if (!strncmp(m_installed->name, "__string: ", 10)) {
+            struct ofputil_meter_mod mm = {
+                .command = OFPMC13_DELETE,
+                .meter = { .meter_id = m_installed->table_id },
+            };
+            add_meter_mod(&mm, &msgs);
+        }
         ovn_extend_table_remove_existing(meters, m_installed);
     }
 
diff --git a/tests/ovn.at b/tests/ovn.at
index 0c2fe9f97..078a6276b 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -9512,6 +9512,10 @@ check ovn-nbctl --wait=hv qos-add lsw0 to-lport 1002 
'inport=="lp2" && is_chassi
 AT_CHECK([as hv ovs-ofctl dump-meters br-int -O OpenFlow13 | grep meter | wc 
-l], [0], [4
 ])
 
+check ovn-nbctl qos-del lsw0
+AT_CHECK([as hv ovs-ofctl dump-meters br-int -O OpenFlow13 | grep meter | wc 
-l], [0], [0
+])
+
 OVN_CLEANUP([hv])
 AT_CLEANUP
 ])
-- 
2.35.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to