[ovs-dev] [patch_v1] ovs-vtep: Handle tunnel key configuration in any order.

Darrell Ball dlu998 at gmail.com
Thu Jul 14 21:59:50 UTC 2016


On Thu, Jul 14, 2016 at 1:51 PM, Russell Bryant <russell at ovn.org> wrote:

>
> On Thu, Jul 14, 2016 at 4:09 PM, Darrell Ball <dlu998 at 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 at 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 at openvswitch.org
>> http://openvswitch.org/mailman/listinfo/dev
>>
>
>
>
> --
> Russell Bryant
>



More information about the dev mailing list