On 15/06/2015 19:28, "Gurucharan Shetty" <shet...@nicira.com> wrote:

>On Mon, Jun 15, 2015 at 11:09 AM, Daniele Di Proietto
><diproiet...@vmware.com> wrote:
>> With this commit, the VTEP emulator detects the datapath_type of the
>> bridge used as a "physical" switch, and creates subsequent bridges
>> with the same type.  This allows ovs-vtep to work with the userspace
>> datapath.
>>
>> Signed-off-by: Daniele Di Proietto <diproiet...@vmware.com>
>> ---
>>  vtep/ovs-vtep | 12 ++++++++++--
>>  1 file changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/vtep/ovs-vtep b/vtep/ovs-vtep
>> index 60dbb95..49c323f 100755
>> --- a/vtep/ovs-vtep
>> +++ b/vtep/ovs-vtep
>> @@ -40,6 +40,7 @@ vlog = ovs.vlog.Vlog("ovs-vtep")
>>  exiting = False
>>
>>  ps_name = ""
>> +ps_type = ""
>>  Tunnel_Ip = ""
>>  Lswitches = {}
>>  Bindings = {}
>> @@ -103,7 +104,8 @@ class Logical_Switch(object):
>>              self.tunnel_key = 0
>>              vlog.warn("invalid tunnel key for %s, using 0" % self.name)
>>
>> -        ovs_vsctl("--may-exist add-br %s" % self.short_name)
>> +        ovs_vsctl("--may-exist add-br %s -- set Bridge %s
>>datapath_type=%s"
>> +                  % (self.short_name, self.short_name, ps_type))
>>          ovs_vsctl("br-set-external-id %s vtep_logical_switch true"
>>                    % self.short_name)
>>          ovs_vsctl("br-set-external-id %s logical_switch_name %s"
>> @@ -595,6 +597,11 @@ def setup():
>>      if (ps_name not in br_list):
>>          ovs.util.ovs_fatal(0, "couldn't find OVS bridge %s" % ps_name,
>>vlog)
>>
>> +    global ps_type
>> +    ps_type = ovs_vsctl("get Bridge %s datapath_type" % ps_name)
>> +    if ps_type == "":
>Not a python expert, but I think 'if not ps_type:' is the preferred way.

More expert than I am, since I was not aware of this!
I actually had to change that particular test, because it turns out that
ovs-vsctl is returning "\"\"" if datapath_type is not set, but I've used
your suggestion elsewhere in the code

>
>> +        ovs.util.ovs_fatal(0, "couldn't find %s datapath_type" %
>>ps_name, vlog)
>Is datapath_type always populated automatically? When I create a
>bridge on tip of master, that column does not get populated.

You're right, thanks for noticing this.  I'll send out a v2 that doesn't
set the
datapath_type if it's not set in the physical bridge.

Thanks for your input!

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

Reply via email to