[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] Fix serial console telnet protocol support



With e.g.:

  <serial type='tcp'>
    <source mode='bind' host='127.0.0.1' service='4444'/>
    <protocol type='telnet'/>
    <target port='0'/>
  </serial>

You currently get:

  Unknown option: listen
  qemu: could not open serial device 'telnet:127.0.0.1:4444,listen'

With the telnet protocol, qemu expects "server" as an option
rather than "listen".

Signed-off-by: Mark McLoughlin <markmc redhat com>

Index: libvirt/src/qemu_conf.c
===================================================================
--- libvirt.orig/src/qemu_conf.c	2008-08-13 18:14:34.000000000 +0100
+++ libvirt/src/qemu_conf.c	2008-08-13 18:35:20.000000000 +0100
@@ -685,12 +685,19 @@
         break;
 
     case VIR_DOMAIN_CHR_TYPE_TCP:
-        if (snprintf(buf, buflen, "%s:%s:%s%s",
-                     dev->data.tcp.protocol == VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET ? "telnet" : "tcp",
-                     dev->data.tcp.host,
-                     dev->data.tcp.service,
-                     dev->data.tcp.listen ? ",listen" : "") >= buflen)
-            return -1;
+        if (dev->data.tcp.protocol == VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET) {
+            if (snprintf(buf, buflen, "telnet:%s:%s%s",
+                         dev->data.tcp.host,
+                         dev->data.tcp.service,
+                         dev->data.tcp.listen ? ",server" : "") >= buflen)
+                return -1;
+        } else {
+            if (snprintf(buf, buflen, "tcp:%s:%s%s",
+                         dev->data.tcp.host,
+                         dev->data.tcp.service,
+                         dev->data.tcp.listen ? ",listen" : "") >= buflen)
+                return -1;
+        }
         break;
 
     case VIR_DOMAIN_CHR_TYPE_UNIX:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]