v2 o rebase on top of master o fix linux-user build breakage o maintain DeviceEncrypted error and let hmp_change() use it o drop patch that changed inet_connect() and inet_connect_opts() to return -errno o Simplified tcp_start_outgoing_migration() error handling o use g_strdup_vprintf() (instead of vsnprintf() plus g_strdup()) o drop errors from command's documentation in qapi-schema.json o update docs/writing-qmp-commands.txt
This series implements the 'Plan for error handling in QMP' as described by Anthony in this email: http://lists.gnu.org/archive/html/qemu-devel/2012-07/msg03764.html Basically, this replaces almost all error classes by GenericError (the exception are a few error classes used by libvirt) and drops the error data memeber. This also adds a free form string to error_set(). On the wire, we go from: { "error": { "class": "DeviceNotRemovable", "data": { "device": "virtio0" }, "desc": "Device 'virtio0' is not removable" } } to: { "error": { "class": "GenericError", "desc": "Device 'virtio0' is not removable" } } Internally, we go from: void error_set(Error **err, const char *fmt, ...); to: void error_set(Error **err, ErrorClass err_class, const char *fmt, ...); Makefile.objs | 1 + QMP/qmp-spec.txt | 10 +- block.c | 1 + block_int.h | 1 + configure | 10 - docs/writing-qmp-commands.txt | 47 ++-- error.c | 93 +------- error.h | 34 +-- error_int.h | 29 --- hmp.c | 75 +++--- hmp.h | 1 + migration-tcp.c | 22 +- monitor.c | 83 ++----- nbd.c | 2 +- qapi-schema.json | 93 +++----- qapi/qmp-core.h | 1 + qapi/qmp-dispatch.c | 11 +- qemu-char.c | 2 +- qemu-ga.c | 5 +- qemu-sockets.c | 14 +- qemu_socket.h | 4 +- qerror.c | 516 ++---------------------------------------- qerror.h | 168 ++++++-------- qmp-commands.hx | 4 +- scripts/qapi-types.py | 17 +- ui/vnc.c | 2 +- 26 files changed, 272 insertions(+), 974 deletions(-)