Record output of qemu -device '?'.

This allows us to find out what qemu devices are supported
at runtime.
This commit is contained in:
Richard W.M. Jones
2012-06-12 14:52:43 +01:00
parent 295d6af48d
commit e0b5ecc801
4 changed files with 19 additions and 0 deletions

View File

@@ -589,6 +589,14 @@ working.
AC_MSG_FAILURE([$QEMU version must be >= 1.0.])
fi
AC_MSG_CHECKING([that $QEMU -machine accel=kvm:tcg -device ? works])
if $QEMU -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 -machine accel=kvm:tcg -device ? doesn't work.])
fi
AC_MSG_CHECKING([for virtio-serial support in $QEMU])
if $QEMU $QEMU_OPTIONS -machine accel=kvm:tcg -device \? 2>&1 | grep -sq virtio-serial; then
AC_MSG_RESULT([yes])

View File

@@ -187,6 +187,7 @@ struct guestfs_h
char *tmpdir; /* Temporary directory containing socket. */
char *qemu_help, *qemu_version; /* Output of qemu -help, qemu -version. */
char *qemu_devices; /* Output of qemu -device ? */
char **cmdline; /* Qemu command line. */
size_t cmdline_size;

View File

@@ -270,6 +270,7 @@ guestfs_close (guestfs_h *g)
free (g->append);
free (g->qemu_help);
free (g->qemu_version);
free (g->qemu_devices);
free (g);
}

View File

@@ -1319,6 +1319,8 @@ test_qemu (guestfs_h *g)
g->qemu_help = NULL;
free (g->qemu_version);
g->qemu_version = NULL;
free (g->qemu_devices);
g->qemu_devices = NULL;
snprintf (cmd, sizeof cmd, "LC_ALL=C '%s' -nographic -help", g->qemu);
@@ -1338,6 +1340,13 @@ test_qemu (guestfs_h *g)
if (test_qemu_cmd (g, cmd, &g->qemu_version) == -1)
goto qemu_error;
snprintf (cmd, sizeof cmd,
"LC_ALL=C '%s' -nographic -machine accel=kvm:tcg -device '?' 2>&1",
g->qemu);
if (test_qemu_cmd (g, cmd, &g->qemu_devices) == -1)
goto qemu_error;
return 0;
}