Presently, ovs-vtep expects the datapath tunnel key to be available
in the VTEP DB at startup. This may not be the case which is also
observed as interrmittent unit test failures. This patch allows
for the tunnel key to later appear in the VTEP database.

Signed-off-by: Darrell Ball <dlu...@gmail.com>
---
 vtep/ovs-vtep | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/vtep/ovs-vtep b/vtep/ovs-vtep
index e52c66f..871b999 100644
--- a/vtep/ovs-vtep
+++ b/vtep/ovs-vtep
@@ -259,6 +259,21 @@ class Logical_Switch(object):
         tunnels = set()
         parse_ucast = True
 
+        if not self.tunnel_key:
+            vlog.info("Invalid tunnel key %s in %s; requery VTEP DB"
+                      % (self.tunnel_key, self.name))
+            column = vtep_ctl("--columns=tunnel_key find logical_switch "
+                              "name=%s" % self.name)
+            tunnel_key = column.partition(":")[2].strip()
+            if tunnel_key and isinstance(eval(tunnel_key), six.integer_types):
+                self.tunnel_key = tunnel_key
+                vlog.info("update_remote_macs: using tunnel key %s in %s"
+                          % (self.tunnel_key, self.name))
+            else:
+                vlog.info("Invalid tunnel key %s in %s post VTEP DB requery"
+                          % (self.tunnel_key, self.name))
+                return
+
         mac_list = vtep_ctl("list-remote-macs %s" % self.name).splitlines()
         for line in mac_list:
             if (line.find("mcast-mac-remote") != -1):
-- 
1.9.1

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

Reply via email to