On Thu, Jul 14, 2016 at 1:51 PM, Russell Bryant <[email protected]> wrote:
> > On Thu, Jul 14, 2016 at 4:09 PM, Darrell Ball <[email protected]> wrote: > >> 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 <[email protected]> >> --- >> 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 >> + > > > > It looks like this largely copies code from setup_ls(). How about a new > function? > It was a toss up about breaking out the 4 common lines originally. + 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 However, I was leaning in the opposite direction, towards removing the existing code since the error handling is wrong anyways and it is now redundant. It simplifies the logic as well. > > >> 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 >> [email protected] >> http://openvswitch.org/mailman/listinfo/dev >> > > > > -- > Russell Bryant > _______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
