[Libguestfs] [PATCH] qemu: Upstream regression of -stdio serial option.

Richard W.M. Jones rjones at redhat.com
Thu Jan 7 12:24:26 UTC 2010


I've tested this with both upstream qemu from git, and the old
non-broken qemu from Fedora 12.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
-------------- next part --------------
>From d3caa3384d2f485679b4732ef2d0f0ffb12d202b Mon Sep 17 00:00:00 2001
From: Richard Jones <rjones at redhat.com>
Date: Thu, 7 Jan 2010 12:21:42 +0000
Subject: [PATCH] qemu: Upstream regression of -stdio serial option.

Best explained by the comment in the code:

    /* Newer versions of qemu (from around 2009/12) changed the
     * behaviour of monitors so that an implicit '-monitor stdio' is
     * assumed if we are in -nographic mode and there is no other
     * -monitor option.  Only a single stdio device is allowed, so
     * this broke the '-serial stdio' option.  Therefore if qemu
     * supports the -monitor option at all, set it to null.  Note also
     * that '-monitor none' doesn't work here either.
     */
---
 src/guestfs.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/src/guestfs.c b/src/guestfs.c
index 7cc09ce..a6812aa 100644
--- a/src/guestfs.c
+++ b/src/guestfs.c
@@ -1095,11 +1095,26 @@ guestfs__launch (guestfs_h *g)
     add_cmdline (g, "-m");
     add_cmdline (g, buf);
 
-    add_cmdline (g, "-no-reboot"); /* Force exit instead of reboot on panic */
+    /* Newer versions of qemu (from around 2009/12) changed the
+     * behaviour of monitors so that an implicit '-monitor stdio' is
+     * assumed if we are in -nographic mode and there is no other
+     * -monitor option.  Only a single stdio device is allowed, so
+     * this broke the '-serial stdio' option.  Therefore if qemu
+     * supports the -monitor option at all, set it to null.  Note also
+     * that '-monitor none' doesn't work here either.
+     */
+    if (qemu_supports (g, "-monitor")) {
+      add_cmdline (g, "-monitor");
+      add_cmdline (g, "null");
+    }
+
     add_cmdline (g, "-nographic");
     add_cmdline (g, "-serial");
     add_cmdline (g, "stdio");
 
+    /* Force exit instead of reboot on panic */
+    add_cmdline (g, "-no-reboot");
+
     /* These options recommended by KVM developers to improve reliability. */
     if (qemu_supports (g, "-no-hpet"))
       add_cmdline (g, "-no-hpet");
-- 
1.6.5.2



More information about the Libguestfs mailing list