qmp hmp: Improve error messages when SPICE is not in use
authorMarkus Armbruster <armbru@redhat.com>
Tue, 13 Jan 2015 16:21:45 +0000 (17:21 +0100)
committerMarkus Armbruster <armbru@redhat.com>
Thu, 29 Jan 2015 09:01:31 +0000 (10:01 +0100)
Commit 7572150 adopted QERR_DEVICE_NOT_ACTIVE for the purpose,
probably because adding another error seemed cumbersome overkill.
Produces "No spice device has been activated", which is awkward.

We've since abandoned our quest for "rich" error objects.  Time to
undo the damage to this error message.  Replace it by "SPICE is not in
use".

Keep the stupid DeviceNotActive ErrorClass for compatibility, even
though Libvirt doesn't use it.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
include/ui/qemu-spice.h

index db7926d50b1e6e33eb11c8451c3d689acef1bb23..762e06312547f8e659b3432fec0aaa4bc6154401 100644 (file)
@@ -91,8 +91,8 @@ static inline int qemu_spice_display_add_client(int csock, int skipauth,
 static inline bool qemu_using_spice(Error **errp)
 {
     if (!using_spice) {
-        /* correct one? spice isn't a device ,,, */
-        error_set(errp, QERR_DEVICE_NOT_ACTIVE, "spice");
+        error_set(errp, ERROR_CLASS_DEVICE_NOT_ACTIVE,
+                  "SPICE is not in use");
         return false;
     }
     return true;