qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] vl: exit if a bad property value is passed to -


From: David Gibson
Subject: Re: [Qemu-devel] [PATCH] vl: exit if a bad property value is passed to -global
Date: Thu, 14 Jul 2016 11:42:40 +1000
User-agent: Mutt/1.6.1 (2016-04-27)

On Wed, Jul 13, 2016 at 08:05:03PM +0200, Greg Kurz wrote:
> When passing '-global driver=host-powerpc64-cpu,property=compat,value=foo'
> on the command line, without this patch, we get the following warning per
> device (which means many lines if the guests has many cpus):
> 
> qemu-system-ppc64: Warning: can't apply global host-powerpc64-cpu.compat=foo:
>     Invalid compatibility mode "foo"
> 
> ... and QEMU continues execution, ignoring the property.
> 
> With this patch, we get a single line:
> 
> qemu-system-ppc64: can't apply global host-powerpc64-cpu.compat=foo:
>     Invalid compatibility mode "foo"
> 
> ... and QEMU exits.
> 
> Signed-off-by: Greg Kurz <address@hidden>

Reviewed-by: David Gibson <address@hidden>

Not really up to me to decide if this is the right approach for global
option handling, but it seems like the way to go to me.

> ---
>  vl.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/vl.c b/vl.c
> index 356713ea075c..a7cc92781687 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2922,6 +2922,7 @@ static int global_init_func(void *opaque, QemuOpts 
> *opts, Error **errp)
>      g->property = qemu_opt_get(opts, "property");
>      g->value    = qemu_opt_get(opts, "value");
>      g->user_provided = true;
> +    g->errp = errp;
>      qdev_prop_register_global(g);
>      return 0;
>  }
> @@ -4451,7 +4452,7 @@ int main(int argc, char **argv, char **envp)
>      machine_register_compat_props(current_machine);
>  
>      qemu_opts_foreach(qemu_find_opts("global"),
> -                      global_init_func, NULL, NULL);
> +                      global_init_func, NULL, &error_fatal);
>  
>      /* This checkpoint is required by replay to separate prior clock
>         reading from the other reads, because timer polling functions query
> 

-- 
David Gibson                    | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
                                | _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]