[Libguestfs] [PATCH 2/4] configure: Drop --with-qemu-options / QEMU_OPTIONS.

Richard W.M. Jones rjones at redhat.com
Thu Apr 27 15:03:25 UTC 2017


In its current form this is very hard to implement because it requires
us to "unparse" the options, including removing any shell quoting.

It wasn't implemented at all for the libvirt backend.

Also contrary to the documentation, the configure script did not use
these options for testing, but constructed its own set of qemu test
options.
---
 configure.ac              |  2 +-
 docs/guestfs-building.pod |  5 ----
 lib/launch-direct.c       | 66 -----------------------------------------------
 m4/guestfs_qemu.m4        | 16 ------------
 4 files changed, 1 insertion(+), 88 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4b466f5..b6ba6de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -318,7 +318,7 @@ echo "This is how we have configured the optional components for you today:"
 echo
 echo       "Daemon .............................. $enable_daemon"
 echo       "Appliance ........................... $ENABLE_APPLIANCE"
-echo       "QEMU ................................ $QEMU $QEMU_OPTIONS"
+echo       "QEMU ................................ $QEMU"
 echo       "guestfish and C-based virt tools .... yes"
 echo       "FUSE filesystem ..................... $enable_fuse"
 AS_ECHO_N(["GNU gettext for i18n ................ "])
diff --git a/docs/guestfs-building.pod b/docs/guestfs-building.pod
index bfb46a0..b026667 100644
--- a/docs/guestfs-building.pod
+++ b/docs/guestfs-building.pod
@@ -663,11 +663,6 @@ Provide an alternate qemu binary (or list of binaries).  This can be
 overridden at runtime by setting the C<LIBGUESTFS_HV> environment
 variable.
 
-=item B<--with-qemu-options=">-M ... -cpu ...B<">
-
-If qemu requires extra options to work on this platform, you can pass
-them here, and they will be used both when testing and running qemu.
-
 =item B<--with-supermin-packager-config=>I<yum.conf>
 
 This passes the I<--packager-config> option to L<supermin(1)>.
diff --git a/lib/launch-direct.c b/lib/launch-direct.c
index b0038c6..aa9c292 100644
--- a/lib/launch-direct.c
+++ b/lib/launch-direct.c
@@ -97,64 +97,6 @@ create_cow_overlay_direct (guestfs_h *g, void *datav, struct drive *drv)
   return overlay;
 }
 
-#ifdef QEMU_OPTIONS
-/* Like 'add_cmdline' but allowing a shell-quoted string of zero or
- * more options.  XXX The unquoting is not very clever.
- */
-static void
-add_cmdline_shell_unquoted (guestfs_h *g, struct stringsbuf *sb,
-                            const char *options)
-{
-  char quote;
-  const char *startp, *endp, *nextp;
-
-  while (*options) {
-    quote = *options;
-    if (quote == '\'' || quote == '"')
-      startp = options+1;
-    else {
-      startp = options;
-      quote = ' ';
-    }
-
-    endp = strchr (options, quote);
-    if (endp == NULL) {
-      if (quote != ' ') {
-        fprintf (stderr,
-                 _("unclosed quote character (%c) in command line near: %s"),
-                 quote, options);
-        _exit (EXIT_FAILURE);
-      }
-      endp = options + strlen (options);
-    }
-
-    if (quote == ' ') {
-      if (endp[0] == '\0')
-        nextp = endp;
-      else
-        nextp = endp+1;
-    }
-    else {
-      if (!endp[1])
-        nextp = endp+1;
-      else if (endp[1] == ' ')
-        nextp = endp+2;
-      else {
-        fprintf (stderr, _("cannot parse quoted string near: %s"), options);
-        _exit (EXIT_FAILURE);
-      }
-    }
-    while (*nextp && *nextp == ' ')
-      nextp++;
-
-    guestfs_int_add_string_nodup (g, sb,
-				  safe_strndup (g, startp, endp-startp));
-
-    options = nextp;
-  }
-}
-#endif /* defined QEMU_OPTIONS */
-
 /* On Debian, /dev/kvm is mode 0660 and group kvm, so users need to
  * add themselves to the kvm group otherwise things are going to be
  * very slow (this is Debian bug 640328).  Warn about this.
@@ -604,14 +546,6 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
    * qemu -set parameters can modify previously added options.
    */
 
-  /* Add the extra options for the qemu command line specified
-   * at configure time.
-   */
-#ifdef QEMU_OPTIONS
-  if (STRNEQ (QEMU_OPTIONS, ""))
-    add_cmdline_shell_unquoted (g, &cmdline, QEMU_OPTIONS);
-#endif
-
   /* Add any qemu parameters. */
   for (hp = g->hv_params; hp; hp = hp->next) {
     ADD_CMDLINE (hp->hv_param);
diff --git a/m4/guestfs_qemu.m4 b/m4/guestfs_qemu.m4
index fb02854..e07e980 100644
--- a/m4/guestfs_qemu.m4
+++ b/m4/guestfs_qemu.m4
@@ -43,22 +43,6 @@ AS_IF([test "x$with_qemu" = "xno"],[
 
     AC_DEFINE_UNQUOTED([QEMU],["$QEMU"],[Location of qemu binary.])
 
-    dnl Does the user wish to specify -M, -cpu or other qemu options?
-    AC_MSG_CHECKING([if the user specified extra options for qemu command line])
-    AC_ARG_WITH([qemu-options],
-        [AS_HELP_STRING([--with-qemu-options="-M ... -cpu ... etc"],
-            [pass extra options for qemu command line @<:@default=no@:>@])],
-        [QEMU_OPTIONS="$withval"],
-        [QEMU_OPTIONS=no])
-    AS_IF([test "x$QEMU_OPTIONS" = "xno"],[
-        AC_MSG_RESULT([no])
-        QEMU_OPTIONS=
-    ],[
-        AC_MSG_RESULT([$QEMU_OPTIONS])
-    ])
-    AC_DEFINE_UNQUOTED([QEMU_OPTIONS],["$QEMU_OPTIONS"],
-                       [Extra options for qemu command line.])
-
     dnl Check that the chosen qemu has virtio-serial support.
     dnl For historical reasons this can be disabled by setting
     dnl vmchannel_test=no.
-- 
2.9.3




More information about the Libguestfs mailing list