[virt-tools-list] [PATCH] python3: fix bytes/string mess in serial console
Cole Robinson
crobinso at redhat.com
Wed Dec 20 21:11:39 UTC 2017
On 12/13/2017 06:08 AM, Cédric Bosdonnat wrote:
> 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):
>
ACK and pushed
Thanks,
Cole
More information about the virt-tools-list
mailing list