The "cur_cfg" column in the database is supposed to reflect the latest
complete (re)configuration of the system.  For a long time, any call to
bridge_reconfigure() always ensured this.  However, commit c7e7bb21ff made
it possible that bridge_reconfigure() only does part of the necessary work,
but still made its caller always notify the client that reconfiguration was
complete.  This commit fixes the problem.

This commit also moves a little bit of code out of bridge_reconfigure()
into the caller.  This is not necessary, but it seemed logical to group
this together with updating "cur_cfg".

CC: Ethan Jackson <et...@nicira.com>
Reported-by: Pravin B Shelar <pshe...@nicira.com>
Signed-off-by: Ben Pfaff <b...@nicira.com>
---
 vswitchd/bridge.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index f4a10e6..e4a7fa8 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -497,12 +497,6 @@ bridge_reconfigure(const struct ovsrec_open_vswitch 
*ovs_cfg)
         bridge_configure_tables(br);
     }
     free(managers);
-
-    if (!need_reconfigure) {
-        /* ovs-vswitchd has completed initialization, so allow the process that
-         * forked us to exit successfully. */
-        daemonize_complete();
-    }
 }
 
 /* Iterate over all ofprotos and delete any of them that do not have a
@@ -1990,8 +1984,15 @@ bridge_run(void)
             struct ovsdb_idl_txn *txn = ovsdb_idl_txn_create(idl);
 
             bridge_reconfigure(cfg);
+            if (!need_reconfigure) {
+                /* Notify database clients that reconfiguration is complete. */
+                ovsrec_open_vswitch_set_cur_cfg(cfg, cfg->next_cfg);
+
+                /* ovs-vswitchd has completed initialization, so allow the
+                 * process that forked us to exit successfully. */
+                daemonize_complete();
+            }
 
-            ovsrec_open_vswitch_set_cur_cfg(cfg, cfg->next_cfg);
             ovsdb_idl_txn_commit(txn);
             ovsdb_idl_txn_destroy(txn); /* XXX */
         } else {
-- 
1.7.2.5

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to