[virt-tools-list] [PATCH] python3: fix bytes/string mess in serial console
Cédric Bosdonnat
cbosdonnat at suse.com
Wed Dec 13 11:08:50 UTC 2017
Add a few encode() and decode() to convert between libvirt stream
functions expecting bytes arrays and Vte callbacks providing strings.
---
virtManager/serialcon.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/virtManager/serialcon.py b/virtManager/serialcon.py
index 7caf6db4..21ab8ae7 100644
--- a/virtManager/serialcon.py
+++ b/virtManager/serialcon.py
@@ -149,7 +149,7 @@ class LibvirtConsoleConnection(ConsoleConnection):
self.stream = None
- self.streamToTerminal = ""
+ self.streamToTerminal = b""
self.terminalToStream = ""
def _event_on_stream(self, stream, events, opaque):
@@ -187,7 +187,7 @@ class LibvirtConsoleConnection(ConsoleConnection):
self.terminalToStream):
try:
- done = self.stream.send(self.terminalToStream)
+ done = self.stream.send(self.terminalToStream.encode())
except Exception:
logging.exception("Error sending stream data")
self.close()
@@ -262,7 +262,7 @@ class LibvirtConsoleConnection(ConsoleConnection):
return
terminal.feed(self.streamToTerminal)
- self.streamToTerminal = ""
+ self.streamToTerminal = b""
class vmmSerialConsole(vmmGObject):
--
2.15.1
More information about the virt-tools-list
mailing list