Message ID | 1468526997-7163-1-git-send-email-dlu998@gmail.com |
---|---|
State | Superseded |
Headers | show |
On Thu, Jul 14, 2016 at 4:09 PM, Darrell Ball <dlu998@gmail.com> 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 <dlu998@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 > + It looks like this largely copies code from setup_ls(). How about a new function? > 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 >
On Thu, Jul 14, 2016 at 1:51 PM, Russell Bryant <russell@ovn.org> wrote: > > On Thu, Jul 14, 2016 at 4:09 PM, Darrell Ball <dlu998@gmail.com> 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 <dlu998@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 >> + > > > > 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 >> dev@openvswitch.org >> http://openvswitch.org/mailman/listinfo/dev >> > > > > -- > Russell Bryant >
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):
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 <dlu998@gmail.com> --- vtep/ovs-vtep | 15 +++++++++++++++ 1 file changed, 15 insertions(+)