[ovs-dev] [PATCH] ovn-controller: Only add comment in binding_cleanup() in case of changes.

Ben Pfaff blp at ovn.org
Thu Jun 14 19:36:47 UTC 2018


This makes the comment more meaningful.

Signed-off-by: Ben Pfaff <blp at ovn.org>
---
 ovn/controller/binding.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/ovn/controller/binding.c b/ovn/controller/binding.c
index 2b27f3cbd9ad..021ecddcff77 100644
--- a/ovn/controller/binding.c
+++ b/ovn/controller/binding.c
@@ -628,11 +628,6 @@ binding_cleanup(struct ovsdb_idl_txn *ovnsb_idl_txn,
         return true;
     }
 
-    ovsdb_idl_txn_add_comment(
-        ovnsb_idl_txn,
-        "ovn-controller: removing all port bindings for '%s'",
-        chassis_rec->name);
-
     const struct sbrec_port_binding *binding_rec;
     bool any_changes = false;
     SBREC_PORT_BINDING_TABLE_FOR_EACH (binding_rec, port_binding_table) {
@@ -641,5 +636,13 @@ binding_cleanup(struct ovsdb_idl_txn *ovnsb_idl_txn,
             any_changes = true;
         }
     }
+
+    if (any_changes) {
+        ovsdb_idl_txn_add_comment(
+            ovnsb_idl_txn,
+            "ovn-controller: removing all port bindings for '%s'",
+            chassis_rec->name);
+    }
+
     return !any_changes;
 }
-- 
2.16.1



More information about the dev mailing list