qemu-ppc
[Top][All Lists]
Advanced

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

Re: [PATCH v3 11/11] machine: Improve error message when using default R


From: Markus Armbruster
Subject: Re: [PATCH v3 11/11] machine: Improve error message when using default RAM backend id
Date: Fri, 01 Sep 2023 14:52:59 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

David Hildenbrand <david@redhat.com> writes:

> On 25.08.23 11:59, David Hildenbrand wrote:

[...]

>> ... hopefully I'm done with that error-handling pain in QEMU soon and
>> can continue focusing on things that make me feel more productive :P

I'm afraid you'll be done with error handling right when you're done
with developing software.

> ... hoping it's as simple as this:
>
> diff --git a/hw/core/machine.c b/hw/core/machine.c
> index f0d35c6401..09f40c7f07 100644
> --- a/hw/core/machine.c
> +++ b/hw/core/machine.c
> @@ -1352,6 +1352,7 @@ out:
>   
>   void machine_run_board_init(MachineState *machine, const char *mem_path, 
> Error **errp)
>   {
> +    ERRP_GUARD();
>       MachineClass *machine_class = MACHINE_GET_CLASS(machine);
>       ObjectClass *oc = object_class_by_name(machine->cpu_type);
>       CPUClass *cc;
> @@ -1380,9 +1381,13 @@ void machine_run_board_init(MachineState *machine, 
> const char *mem_path, Error *
>                  numa_uses_legacy_mem()) {
>           if (object_property_find(object_get_objects_root(),
>                                    machine_class->default_ram_id)) {
> -            error_setg(errp, "object name '%s' is reserved for the default"
> -                " RAM backend, it can't be used for any other purposes."
> -                " Change the object's 'id' to something else",
> +            error_setg(errp, "object's id '%s' is reserved for the default"
> +                " RAM backend, it can't be used for any other purposes",
> +                machine_class->default_ram_id);
> +            error_append_hint(errp,
> +                "Change the object's 'id' to something else or disable"
> +                " automatic creation of the default RAM backend by setting"
> +                " 'memory-backend=%s' with '-machine'.\n",
>                   machine_class->default_ram_id);
>               return;
>           }

Looks good to me!




reply via email to

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