Skip to contentSkip to conversation

qdev-monitor: Improve error message for -device nonexistant

PATCH In review [email protected] 3 participants 3 messages Dec 19, 2013 – Dec 20, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qdev-monitor: Improve error message for -device nonexistant

From: Markus Armbruster <[email protected]>

Once upon a time, the error message was:

qemu: -device nonexistant: "Device "nonexistant" not found. Try -device '?' for a list.

But progress marches on, and conversion to QError (commit 0204276) changed it into:

Invalid parameter 'driver'
Try with argument '?' for a list.

Progress didn't stop there, of course. After a couple of iterations, we arrived at the current message (commit 6acbe4c):

qemu: -device nonexistant: Parameter 'driver' expects device type

Mission accomplished: this is complete mush.

We've since abandoned our quest for "rich" error objects, fortunately before it turned all error messages into mush. Time to undo the damage to this one. Make it:

qemu: -device nonexistant: nonexistant is not a valid device model name

---
 qdev-monitor.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
qdev-monitor.c +2 -1
index dc37a43..6251107 100644
@@ -478,7 +478,8 @@ DeviceState *qdev_device_add(QemuOpts *opts)
     }
 
     if (!oc) {
-        qerror_report(QERR_INVALID_PARAMETER_VALUE, "driver", "device type");
+        qerror_report(ERROR_CLASS_GENERIC_ERROR,
+                      "'%s' is not a valid device model name", driver);
         return NULL;
     }
 
Signature · 1 line
1.8.1.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · On 12/19/2013 07:30 AM, [email protected] wrote:

From: Markus Armbruster <[email protected]>

We've since abandoned our quest for "rich" error objects, fortunately before it turned all error messages into mush. Time to undo the damage to this one. Make it:

Quoted 6 lines

qemu: -device nonexistant: nonexistant is not a valid device model name

---
 qdev-monitor.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#2 lore raw
In reply to [email protected]

Am 19.12.2013 15:30, schrieb [email protected]:

Quoted 23 lines

From: Markus Armbruster <[email protected]>

Once upon a time, the error message was:

qemu: -device nonexistant: "Device "nonexistant" not found. Try -device '?' for a list.

But progress marches on, and conversion to QError (commit 0204276) changed it into:

Invalid parameter 'driver'
Try with argument '?' for a list.

Progress didn't stop there, of course. After a couple of iterations, we arrived at the current message (commit 6acbe4c):

qemu: -device nonexistant: Parameter 'driver' expects device type

Mission accomplished: this is complete mush.

We've since abandoned our quest for "rich" error objects, fortunately before it turned all error messages into mush. Time to undo the damage to this one. Make it:

Quoted 6 lines

qemu: -device nonexistant: nonexistant is not a valid device model name

---
 qdev-monitor.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Thanks, rebased onto your other fix and applied to qom-next:
https://github.com/afaerber/qemu-cpu/commits/qom-next

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg