Blame SOURCES/kvm-qdev-monitor-Improve-error-message-for-device-nonexi.patch

0a122b
From 41eb96b80b2e805573cc79e3b6e7eff49892dd47 Mon Sep 17 00:00:00 2001
0a122b
From: Markus Armbruster <armbru@redhat.com>
0a122b
Date: Fri, 17 Jan 2014 17:07:59 +0100
0a122b
Subject: [PATCH 09/11] qdev-monitor: Improve error message for -device nonexistant
0a122b
MIME-Version: 1.0
0a122b
Content-Type: text/plain; charset=UTF-8
0a122b
Content-Transfer-Encoding: 8bit
0a122b
0a122b
RH-Author: Markus Armbruster <armbru@redhat.com>
0a122b
Message-id: <1389978479-30595-10-git-send-email-armbru@redhat.com>
0a122b
Patchwork-id: 56794
0a122b
O-Subject: [PATCH 7.0 qemu-kvm 9/9] qdev-monitor: Improve error message for -device nonexistant
0a122b
Bugzilla: 669524
0a122b
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
0a122b
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
0a122b
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
0a122b
0a122b
Once upon a time, the error message was:
0a122b
0a122b
    qemu: -device nonexistant: Device "nonexistant" not found.  Try -device '?' for a list.
0a122b
0a122b
But progress marches on, and conversion to QError (commit 0204276)
0a122b
changed it into:
0a122b
0a122b
    Invalid parameter 'driver'
0a122b
    Try with argument '?' for a list.
0a122b
0a122b
Progress didn't stop there, of course.  After a couple of iterations,
0a122b
we arrived at the current message (commit 6acbe4c):
0a122b
0a122b
    qemu: -device nonexistant: Parameter 'driver' expects device type
0a122b
0a122b
Mission accomplished: this is complete mush.
0a122b
0a122b
We've since abandoned our quest for "rich" error objects, fortunately
0a122b
before it turned all error messages into mush.  Time to undo the
0a122b
damage to this one.  Make it:
0a122b
0a122b
    qemu: -device nonexistant: nonexistant is not a valid device model name
0a122b
0a122b
Signed-off-by: Markus Armbruster <armbru@redhat.com>
0a122b
Reviewed-by: Eric Blake <eblake@redhat.com>
0a122b
Signed-off-by: Andreas Färber <afaerber@suse.de>
0a122b
(cherry picked from commit 11c308b17a34932033cceca4f88b5e67009e3ebd)
0a122b
---
0a122b
 qdev-monitor.c | 3 ++-
0a122b
 1 file changed, 2 insertions(+), 1 deletion(-)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 qdev-monitor.c |    3 ++-
0a122b
 1 files changed, 2 insertions(+), 1 deletions(-)
0a122b
0a122b
diff --git a/qdev-monitor.c b/qdev-monitor.c
0a122b
index 55a476b..ac65a10 100644
0a122b
--- a/qdev-monitor.c
0a122b
+++ b/qdev-monitor.c
0a122b
@@ -479,7 +479,8 @@ DeviceState *qdev_device_add(QemuOpts *opts)
0a122b
     }
0a122b
 
0a122b
     if (!object_class_dynamic_cast(oc, TYPE_DEVICE)) {
0a122b
-        qerror_report(QERR_INVALID_PARAMETER_VALUE, "driver", "device type");
0a122b
+        qerror_report(ERROR_CLASS_GENERIC_ERROR,
0a122b
+                      "'%s' is not a valid device model name", driver);
0a122b
         return NULL;
0a122b
     }
0a122b
 
0a122b
-- 
0a122b
1.7.1
0a122b