|
From: | Gerd Hoffmann |
Subject: | Re: [Qemu-devel] [PATCH] qdev: add return value to init() callbacks. |
Date: | Wed, 12 Aug 2009 21:47:19 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Lightning/1.0pre Thunderbird/3.0b2 |
On 08/12/09 21:28, Paul Brook wrote:
We have already one case in-tree where this is needed: Try -device virtio-blk-pci (without drive= specified) and watch qemu segfault.No. Failure of the init routine should be fatal. i.e. virtio_blk_init_pci should call hw_error.
No. That policy doesn't belong there.
If you want to allow graceful failure (which is pointless for commandline options, but may be desirable for hotplug devices)
Exactly. And for that reason we must pass up the error to the caller. The caller can then decide what to do with it. For devices added via command line options we probably want to exit(1). For hotplugging we probably would not.
they you need to also add some way of reporting why device creation failure. fprintf(stderr) is just plain wrong.
Indeed. When hotplugging via monitor the error message should appear on the monitor, not stderr. It is already an item on my todo list.
I'd prefer to address that in a separate patch though, the patch is already big and invasive enough as-is.
cheers, Gerd
[Prev in Thread] | Current Thread | [Next in Thread] |