[ovs-dev] [PATCH] ovs-vtep: Modify patch port name separators

Gurucharan Shetty shettyg at nicira.com
Wed Sep 10 17:44:26 UTC 2014


On Wed, Sep 10, 2014 at 10:02 AM, Mark Maglana <mmaglana at gmail.com> wrote:
> That's a more elegant solution. Yes, that works for me. Thanks! :-)
>
Thanks. I applied the following version (copy-pasted).
[PATCH] ovs-vtep: Handle physical ports with '-' in its name.

As of now, if a physical port has a '-' in its name, ovs-vtep
throws a ValueError exception. This patch fixes the problem.

Reported-by: Mark Maglana <mmaglana at gmail.com>
Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
---
 vtep/ovs-vtep |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/vtep/ovs-vtep b/vtep/ovs-vtep
index 721063b..ea233e0 100755
--- a/vtep/ovs-vtep
+++ b/vtep/ovs-vtep
@@ -288,7 +288,9 @@ class Logical_Switch(object):
         for interface in self.ports.iterkeys():
             if not interface.endswith("-l"):
                 continue
-            vlan, pp_name, logical = interface.split("-")
+            # Physical ports can have a '-' as part of its name.
+            vlan, remainder = interface.split("-", 1)
+            pp_name, logical = remainder.rsplit("-", 1)
             uuid = vtep_ctl("get physical_port %s vlan_stats:%s"
                             % (pp_name, vlan))
             if not uuid:
@@ -308,7 +310,7 @@ class Logical_Switch(object):
 def add_binding(ps_name, binding, ls):
     vlog.info("adding binding %s" % binding)

-    vlan, pp_name = binding.split("-")
+    vlan, pp_name = binding.split("-", 1)
     pbinding = binding+"-p"
     lbinding = binding+"-l"



More information about the dev mailing list