[Libguestfs] [PATCH 2/3] New API parameter: Add discard parameter to guestfs_add_drive_opts.

Pino Toscano ptoscano at redhat.com
Mon Mar 10 17:50:39 UTC 2014


Hi,

On Monday 10 March 2014 17:28:53 Richard W.M. Jones wrote:
> index 1e84061..584c4de 100644
> --- a/src/launch-direct.c
> +++ b/src/launch-direct.c
> @@ -509,6 +509,29 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
>      CLEANUP_FREE char *file = NULL, *escaped_file = NULL, *param = NULL;
> 
>      if (!drv->overlay) {
> +      const char *discard_mode = "";
> +      int major = data->qemu_version_major, minor = data->qemu_version_minor;
> +
> +      switch (drv->discard) {
> +      case discard_disable:
> +        /* Since the default is always discard=ignore, don't specify it
> +         * on the command line.  This also avoids unnecessary breakage
> +         * with qemu < 1.5 which didn't have the option at all.
> +         */
> +        break;
> +      case discard_enable:
> +        if (!guestfs___discard_possible (g, drv, major, minor))

There is an argument mismatch in this call to guestfs___discard_possible
(int's vs bool's).

What about turn guestfs___discard_possible to just get the qemu version,
and do the checks in it rather than asking to prefill the two
"is qemu >= 1.5" and "is qemu >= 1.6" bool's?

-- 
Pino Toscano




More information about the Libguestfs mailing list