On 25/8/23 12:10, David Hildenbrand wrote:
On 25.08.23 11:59, David Hildenbrand wrote:
On 25.08.23 11:56, Markus Armbruster wrote:
David Hildenbrand <da...@redhat.com> writes:
On 25.08.23 11:10, Markus Armbruster wrote:
David Hildenbrand <da...@redhat.com> writes:
On 25.08.23 08:57, ThinerLogoer wrote:
Hello,
At 2023-08-23 23:34:11, "David Hildenbrand" <da...@redhat.com>
wrote:
For migration purposes, users might want to reuse the default RAM
backend id, but specify a different memory backend.
For example, to reuse "pc.ram" on q35, one has to set
-machine q35,memory-backend=pc.ram
Only then, can a memory backend with the id "pc.ram" be created
manually.
Let's improve the error message.
Unfortuantely, we cannot use error_append_hint(), because the
caller
passes &error_fatal.
Suggested-by: ThinerLogoer <logoerthin...@163.com>
Signed-off-by: David Hildenbrand <da...@redhat.com>
---
hw/core/machine.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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;
}
Reviewed-by: Philippe Mathieu-Daudé <phi...@linaro.org>