Acked-by: Ariel Tubaltsev <atubalts...@vmware.com>


On 9/19/14 7:29 AM, "Gurucharan Shetty" <shet...@nicira.com> wrote:

>ovs-vtep is an emulator and it works only on one
>physical switch. This switch name is stored in the variable
>'ps_name' and then passed around. An upcoming commit requires
>access to this variable at more places and it is easier if this
>variable is global.
>
>Signed-off-by: Gurucharan Shetty <gshe...@nicira.com>
>---
> vtep/ovs-vtep |   20 +++++++++++---------
> 1 file changed, 11 insertions(+), 9 deletions(-)
>
>diff --git a/vtep/ovs-vtep b/vtep/ovs-vtep
>index ea21794..c70ed64 100755
>--- a/vtep/ovs-vtep
>+++ b/vtep/ovs-vtep
>@@ -38,6 +38,7 @@ __pychecker__ = 'no-reuseattr'  # Remove in pychecker
>>= 0.8.19.
> vlog = ovs.vlog.Vlog("ovs-vtep")
> exiting = False
> 
>+ps_name = ""
> Tunnel_Ip = ""
> Lswitches = {}
> Bindings = {}
>@@ -307,7 +308,7 @@ class Logical_Switch(object):
>         self.update_remote_macs()
>         self.update_stats()
> 
>-def add_binding(ps_name, binding, ls):
>+def add_binding(binding, ls):
>     vlog.info("adding binding %s" % binding)
> 
>     vlan, pp_name = binding.split("-", 1)
>@@ -348,7 +349,7 @@ def add_binding(ps_name, binding, ls):
>     ls.add_lbinding(lbinding)
>     Bindings[binding] = ls.name
> 
>-def del_binding(ps_name, binding, ls):
>+def del_binding(binding, ls):
>     vlog.info("removing binding %s" % binding)
> 
>     vlan, pp_name = binding.split("-")
>@@ -377,7 +378,7 @@ def del_binding(ps_name, binding, ls):
> 
>     del Bindings[binding]
> 
>-def handle_physical(ps_name):
>+def handle_physical():
>     # Gather physical ports except the patch ports we created
>     ovs_ports = ovs_vsctl("list-ports %s" % ps_name).split()
>     ovs_port_set = set([port for port in ovs_ports if port[-2:] != "-p"])
>@@ -410,9 +411,9 @@ def handle_physical(ps_name):
>                 if Bindings[binding] == ls_name:
>                     continue
>                 else:
>-                    del_binding(ps_name, binding,
>Lswitches[Bindings[binding]])
>+                    del_binding(binding, Lswitches[Bindings[binding]])
> 
>-            add_binding(ps_name, binding, ls)
>+            add_binding(binding, ls)
> 
> 
>     dead_bindings = set(Bindings.keys()).difference(new_bindings)
>@@ -420,14 +421,14 @@ def handle_physical(ps_name):
>         ls_name = Bindings[binding]
>         ls = Lswitches[ls_name]
> 
>-        del_binding(ps_name, binding, ls)
>+        del_binding(binding, ls)
> 
>         if not len(ls.ports):
>             ovs_vsctl("del-br %s" % Lswitches[ls_name].short_name)
>             vtep_ctl("clear-local-macs %s" % Lswitches[ls_name].name)
>             del Lswitches[ls_name]
> 
>-def setup(ps_name):
>+def setup():
>     br_list = ovs_vsctl("list-br").split()
>     if (ps_name not in br_list):
>         ovs.util.ovs_fatal(0, "couldn't find OVS bridge %s" % ps_name,
>vlog)
>@@ -485,6 +486,7 @@ def main():
>     if args.root_prefix:
>         root_prefix = args.root_prefix
> 
>+    global ps_name
>     ps_name = args.ps_name
> 
>     ovs.daemon.daemonize()
>@@ -495,14 +497,14 @@ def main():
>     if error:
>         ovs.util.ovs_fatal(error, "could not create unixctl server",
>vlog)
> 
>-    setup(ps_name)
>+    setup()
> 
>     while True:
>         unixctl.run()
>         if exiting:
>             break
> 
>-        handle_physical(ps_name)
>+        handle_physical()
> 
>         for ls_name, ls in Lswitches.items():
>             ls.run()
>-- 
>1.7.9.5
>
>_______________________________________________
>dev mailing list
>dev@openvswitch.org
>https://urldefense.proofpoint.com/v1/url?u=http://openvswitch.org/mailman/
>listinfo/dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=MV0ainYANUJshevWnic4Bqj
>PTBitdF4sSVi8%2ByXyTlU%3D%0A&m=VjSglMFCPuV0PMaO6HhAfw%2BG5sKd59E%2FW2ntLtV
>XYsQ%3D%0A&s=2ea0153e92b869079d60565cdd0951874dd24551701f0da66a59aa940e4e0
>62d

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

Reply via email to