Pino Toscano
2013-Dec-09 15:19 UTC
[Libguestfs] [PATCH] launch: switch from -nographic to -display none
The latter is a better way to disable the qemu display output as we
need to, without enabling extra devices (which are disabled already,
anyway).
Also, related to the change above, ban the -display parameter from the
ones that can be supplied by the user.
---
configure.ac | 8 ++++----
src/launch-direct.c | 12 ++++++++----
src/launch.c | 1 +
3 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/configure.ac b/configure.ac
index ae676c4..eb0e493 100644
--- a/configure.ac
+++ b/configure.ac
@@ -797,16 +797,16 @@ working.
AC_MSG_FAILURE([$QEMU version must be >= 1.0.])
fi
- AC_MSG_CHECKING([that $QEMU -nographic -machine accel=kvm:tcg -device ?
works])
- if $QEMU -nographic -machine accel=kvm:tcg -device \?
>&AS_MESSAGE_LOG_FD 2>&1; then
+ AC_MSG_CHECKING([that $QEMU -display none -machine accel=kvm:tcg -device ?
works])
+ if $QEMU -display none -machine accel=kvm:tcg -device \?
>&AS_MESSAGE_LOG_FD 2>&1; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
- AC_MSG_FAILURE([$QEMU -nographic -machine accel=kvm:tcg -device ?
doesn't work.])
+ AC_MSG_FAILURE([$QEMU -display none -machine accel=kvm:tcg -device ?
doesn't work.])
fi
AC_MSG_CHECKING([for virtio-serial support in $QEMU])
- if $QEMU $QEMU_OPTIONS -nographic -machine accel=kvm:tcg -device \?
2>&1 | grep -sq virtio-serial; then
+ if $QEMU $QEMU_OPTIONS -display none -machine accel=kvm:tcg -device \?
2>&1 | grep -sq virtio-serial; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
diff --git a/src/launch-direct.c b/src/launch-direct.c
index 8d0d8ce..f45f582 100644
--- a/src/launch-direct.c
+++ b/src/launch-direct.c
@@ -349,7 +349,8 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
if (qemu_supports (g, data, "-nodefaults"))
ADD_CMDLINE ("-nodefaults");
- ADD_CMDLINE ("-nographic");
+ ADD_CMDLINE ("-display");
+ ADD_CMDLINE ("none");
#ifdef MACHINE_TYPE
ADD_CMDLINE ("-M");
@@ -918,7 +919,8 @@ test_qemu (guestfs_h *g, struct backend_direct_data *data)
data->qemu_devices = NULL;
guestfs___cmd_add_arg (cmd1, g->hv);
- guestfs___cmd_add_arg (cmd1, "-nographic");
+ guestfs___cmd_add_arg (cmd1, "-display");
+ guestfs___cmd_add_arg (cmd1, "none");
guestfs___cmd_add_arg (cmd1, "-help");
guestfs___cmd_set_stdout_callback (cmd1, read_all, &data->qemu_help,
CMD_STDOUT_FLAG_WHOLE_BUFFER);
@@ -927,7 +929,8 @@ test_qemu (guestfs_h *g, struct backend_direct_data *data)
goto error;
guestfs___cmd_add_arg (cmd2, g->hv);
- guestfs___cmd_add_arg (cmd2, "-nographic");
+ guestfs___cmd_add_arg (cmd2, "-display");
+ guestfs___cmd_add_arg (cmd2, "none");
guestfs___cmd_add_arg (cmd2, "-version");
guestfs___cmd_set_stdout_callback (cmd2, read_all,
&data->qemu_version,
CMD_STDOUT_FLAG_WHOLE_BUFFER);
@@ -938,7 +941,8 @@ test_qemu (guestfs_h *g, struct backend_direct_data *data)
parse_qemu_version (g, data);
guestfs___cmd_add_arg (cmd3, g->hv);
- guestfs___cmd_add_arg (cmd3, "-nographic");
+ guestfs___cmd_add_arg (cmd3, "-display");
+ guestfs___cmd_add_arg (cmd3, "none");
guestfs___cmd_add_arg (cmd3, "-machine");
guestfs___cmd_add_arg (cmd3, "accel=kvm:tcg");
guestfs___cmd_add_arg (cmd3, "-device");
diff --git a/src/launch.c b/src/launch.c
index 60f6811..9c1c33a 100644
--- a/src/launch.c
+++ b/src/launch.c
@@ -295,6 +295,7 @@ guestfs__config (guestfs_h *g,
if (STREQ (hv_param, "-kernel") ||
STREQ (hv_param, "-initrd") ||
STREQ (hv_param, "-nographic") ||
+ STREQ (hv_param, "-display") ||
STREQ (hv_param, "-serial") ||
STREQ (hv_param, "-full-screen") ||
STREQ (hv_param, "-std-vga") ||
--
1.8.3.1
Richard W.M. Jones
2013-Dec-09 15:25 UTC
Re: [Libguestfs] [PATCH] launch: switch from -nographic to -display none
On Mon, Dec 09, 2013 at 04:19:11PM +0100, Pino Toscano wrote:> The latter is a better way to disable the qemu display output as we > need to, without enabling extra devices (which are disabled already, > anyway). > > Also, related to the change above, ban the -display parameter from the > ones that can be supplied by the user. > --- > configure.ac | 8 ++++---- > src/launch-direct.c | 12 ++++++++---- > src/launch.c | 1 + > 3 files changed, 13 insertions(+), 8 deletions(-) > > diff --git a/configure.ac b/configure.ac > index ae676c4..eb0e493 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -797,16 +797,16 @@ working. > AC_MSG_FAILURE([$QEMU version must be >= 1.0.]) > fi > > - AC_MSG_CHECKING([that $QEMU -nographic -machine accel=kvm:tcg -device ? works]) > - if $QEMU -nographic -machine accel=kvm:tcg -device \? >&AS_MESSAGE_LOG_FD 2>&1; then > + AC_MSG_CHECKING([that $QEMU -display none -machine accel=kvm:tcg -device ? works]) > + if $QEMU -display none -machine accel=kvm:tcg -device \? >&AS_MESSAGE_LOG_FD 2>&1; then > AC_MSG_RESULT([yes]) > else > AC_MSG_RESULT([no]) > - AC_MSG_FAILURE([$QEMU -nographic -machine accel=kvm:tcg -device ? doesn't work.]) > + AC_MSG_FAILURE([$QEMU -display none -machine accel=kvm:tcg -device ? doesn't work.]) > fi > > AC_MSG_CHECKING([for virtio-serial support in $QEMU]) > - if $QEMU $QEMU_OPTIONS -nographic -machine accel=kvm:tcg -device \? 2>&1 | grep -sq virtio-serial; then > + if $QEMU $QEMU_OPTIONS -display none -machine accel=kvm:tcg -device \? 2>&1 | grep -sq virtio-serial; then > AC_MSG_RESULT([yes]) > else > AC_MSG_RESULT([no]) > diff --git a/src/launch-direct.c b/src/launch-direct.c > index 8d0d8ce..f45f582 100644 > --- a/src/launch-direct.c > +++ b/src/launch-direct.c > @@ -349,7 +349,8 @@ launch_direct (guestfs_h *g, void *datav, const char *arg) > if (qemu_supports (g, data, "-nodefaults")) > ADD_CMDLINE ("-nodefaults"); > > - ADD_CMDLINE ("-nographic"); > + ADD_CMDLINE ("-display"); > + ADD_CMDLINE ("none"); > > #ifdef MACHINE_TYPE > ADD_CMDLINE ("-M"); > @@ -918,7 +919,8 @@ test_qemu (guestfs_h *g, struct backend_direct_data *data) > data->qemu_devices = NULL; > > guestfs___cmd_add_arg (cmd1, g->hv); > - guestfs___cmd_add_arg (cmd1, "-nographic"); > + guestfs___cmd_add_arg (cmd1, "-display"); > + guestfs___cmd_add_arg (cmd1, "none"); > guestfs___cmd_add_arg (cmd1, "-help"); > guestfs___cmd_set_stdout_callback (cmd1, read_all, &data->qemu_help, > CMD_STDOUT_FLAG_WHOLE_BUFFER); > @@ -927,7 +929,8 @@ test_qemu (guestfs_h *g, struct backend_direct_data *data) > goto error; > > guestfs___cmd_add_arg (cmd2, g->hv); > - guestfs___cmd_add_arg (cmd2, "-nographic"); > + guestfs___cmd_add_arg (cmd2, "-display"); > + guestfs___cmd_add_arg (cmd2, "none"); > guestfs___cmd_add_arg (cmd2, "-version"); > guestfs___cmd_set_stdout_callback (cmd2, read_all, &data->qemu_version, > CMD_STDOUT_FLAG_WHOLE_BUFFER); > @@ -938,7 +941,8 @@ test_qemu (guestfs_h *g, struct backend_direct_data *data) > parse_qemu_version (g, data); > > guestfs___cmd_add_arg (cmd3, g->hv); > - guestfs___cmd_add_arg (cmd3, "-nographic"); > + guestfs___cmd_add_arg (cmd3, "-display"); > + guestfs___cmd_add_arg (cmd3, "none"); > guestfs___cmd_add_arg (cmd3, "-machine"); > guestfs___cmd_add_arg (cmd3, "accel=kvm:tcg"); > guestfs___cmd_add_arg (cmd3, "-device"); > diff --git a/src/launch.c b/src/launch.c > index 60f6811..9c1c33a 100644 > --- a/src/launch.c > +++ b/src/launch.c > @@ -295,6 +295,7 @@ guestfs__config (guestfs_h *g, > if (STREQ (hv_param, "-kernel") || > STREQ (hv_param, "-initrd") || > STREQ (hv_param, "-nographic") || > + STREQ (hv_param, "-display") || > STREQ (hv_param, "-serial") || > STREQ (hv_param, "-full-screen") || > STREQ (hv_param, "-std-vga") || > -- > 1.8.3.1ACK. 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#)