summaryrefslogtreecommitdiff
path: root/xenserver
diff options
context:
space:
mode:
Diffstat (limited to 'xenserver')
-rw-r--r--xenserver/opt_xensource_libexec_InterfaceReconfigure.py11
-rw-r--r--xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py2
2 files changed, 10 insertions, 3 deletions
diff --git a/xenserver/opt_xensource_libexec_InterfaceReconfigure.py b/xenserver/opt_xensource_libexec_InterfaceReconfigure.py
index f37e03863..9cdb3bc27 100644
--- a/xenserver/opt_xensource_libexec_InterfaceReconfigure.py
+++ b/xenserver/opt_xensource_libexec_InterfaceReconfigure.py
@@ -758,15 +758,22 @@ def pif_ipdev_name(pif):
def netdev_exists(netdev):
return os.path.exists(root_prefix() + "/sys/class/net/" + netdev)
+
+def unicode_2to3(string):
+ if sys.version_info < (3,):
+ return string.encode()
+ return string
+
+
def pif_netdev_name(pif):
"""Get the netdev name for a PIF."""
pifrec = db().get_pif_record(pif)
if pif_is_vlan(pif):
- return "%(device)s.%(VLAN)s" % pifrec
+ return unicode_2to3("%(device)s.%(VLAN)s" % pifrec)
else:
- return pifrec['device']
+ return unicode_2to3(pifrec['device'])
#
# Bridges
diff --git a/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py b/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py
index 30fc17669..d70c24914 100644
--- a/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py
+++ b/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py
@@ -655,7 +655,7 @@ class DatapathVswitch(Datapath):
for flow in self._bridge_flows:
if flow.find('in_port=%s') != -1 or flow.find('actions=%s') != -1:
for port in ofports:
- f = flow % (port)
+ f = flow % (port.decode())
run_command(['/usr/bin/ovs-ofctl', 'add-flow', dpname, f])
else:
run_command(['/usr/bin/ovs-ofctl', 'add-flow', dpname, flow])