bridge: Execute bridge_run() only after retrieving db contents.
authorAlex Wang <alexw@nicira.com>
Wed, 1 Apr 2015 23:11:19 +0000 (16:11 -0700)
committerAlex Wang <alexw@nicira.com>
Thu, 2 Apr 2015 00:02:39 +0000 (17:02 -0700)
During upgrade of ovs-vswitchd, we do not want to recreate the already
configured kernel interfaces.  Especially when IP address is assigned to
the internal port, the recreation will cause the lost of connection.
Therefore, ovs-vswitchd should read current ovsdb content first and then
reuse the existing kernel interfaces that are configured in ovsdb.  In
terms of the code language, ovs-vswitchd should only execute bridge_run()
after it finishes reading the ovsdb content.

However, this expected behavior is broken by the recent commit d18e52e
(ovsdb-idl: Tolerate missing tables and columns.) which causes the
execution of bridge_run() before getting the hint of configured interfaces
from ovsdb.

To fix the issue, this commit makes sure that the execution of bridge_run()
happens only after retrieving the ovsdb contents.

VMware-BZ: #1424342

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
vswitchd/bridge.c

index 2e90ea2..afd7c3e 100644 (file)
@@ -2895,7 +2895,10 @@ bridge_run(void)
          * disable system stats collection. */
         system_stats_enable(false);
         return;
-    } else if (!ovsdb_idl_has_lock(idl)) {
+    } else if (!ovsdb_idl_has_lock(idl)
+               || !ovsdb_idl_has_ever_connected(idl)) {
+        /* Returns if not holding the lock or not done retrieving db
+         * contents. */
         return;
     }
     cfg = ovsrec_open_vswitch_first(idl);