提交 f6b5319d 编写于 作者: S Sascha Silbe 提交者: Markus Armbruster

qdev-monitor: improve error message when alias device is unavailable

When trying to instantiate an alias that points to a device class that
doesn't exist, the error message looks like qemu misunderstood the
request:

$ s390x-softmmu/qemu-system-s390x -device virtio-gpu
qemu-system-s390x: -device virtio-gpu: 'virtio-gpu-ccw' is not a valid
device model name

Special-case the error message to make it explicit that alias
expansion is going on:

$ s390x-softmmu/qemu-system-s390x -device virtio-gpu
qemu-system-s390x: -device virtio-gpu: 'virtio-gpu' (alias
'virtio-gpu-ccw') is not a valid device model name
Suggested-By: NCornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: NSascha Silbe <silbe@linux.vnet.ibm.com>
Message-Id: <1455831854-49013-2-git-send-email-silbe@linux.vnet.ibm.com>
Reviewed-by: NCornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
上级 a6cdb77f
......@@ -188,6 +188,7 @@ static DeviceClass *qdev_get_device_class(const char **driver, Error **errp)
{
ObjectClass *oc;
DeviceClass *dc;
const char *original_name = *driver;
oc = object_class_by_name(*driver);
if (!oc) {
......@@ -200,7 +201,12 @@ static DeviceClass *qdev_get_device_class(const char **driver, Error **errp)
}
if (!object_class_dynamic_cast(oc, TYPE_DEVICE)) {
error_setg(errp, "'%s' is not a valid device model name", *driver);
if (*driver != original_name) {
error_setg(errp, "'%s' (alias '%s') is not a valid device model"
" name", original_name, *driver);
} else {
error_setg(errp, "'%s' is not a valid device model name", *driver);
}
return NULL;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册