From ebe208ff027371e43ebcd24c76039e9228b221df Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Jeffrey Cody Date: Wed, 17 Oct 2012 05:59:43 +0200 Subject: [PATCH 30/35] qerror: Error types for block-commit RH-Author: Jeffrey Cody Message-id: <018ac112d4281caf7d319b1cbfaf2c61d6fa9acb.1350447475.git.jcody@redhat.com> Patchwork-id: 43288 O-Subject: [RHEL6.4 qemu-kvm PATCH v4 30/35] qerror: Error types for block-commit Bugzilla: 767233 RH-Acked-by: Paolo Bonzini RH-Acked-by: Eric Blake RH-Acked-by: Kevin Wolf Upstream, block-commit uses the new error_setg() for most error messages. Implement these error types in the older qerror.[ch] error message format. To maintain consistency upstream, make all of these error class types 'GenericError'. Note, this has a bit of hackery to make sure they are each unique (noted inline via comments in qerror.h) Signed-off-by: Jeff Cody --- qerror.c | 16 ++++++++++++++++ qerror.h | 15 +++++++++++++++ 2 files changed, 31 insertions(+) Signed-off-by: Michal Novotny --- qerror.c | 16 ++++++++++++++++ qerror.h | 15 +++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/qerror.c b/qerror.c index ae13998..407263c 100644 --- a/qerror.c +++ b/qerror.c @@ -53,6 +53,10 @@ static const QErrorStringTable qerror_table[] = { .desc = "Base '%(base)' not found", }, { + .error_fmt = QERR_BASE_NOT_REACHABLE, + .desc = "Base '%(base)' not reachable from top '%(top)'", + }, + { .error_fmt = QERR_BUS_NOT_FOUND, .desc = "Bus '%(bus)' not found", }, @@ -238,6 +242,18 @@ static const QErrorStringTable qerror_table[] = { .desc = "Too many open files", }, { + .error_fmt = QERR_TOP_AND_BASE_IDENTICAL, + .desc = "Invalid files for merge: top and base are the same", + }, + { + .error_fmt = QERR_TOP_IS_ACTIVE, + .desc = "Top image as the active layer is currently unsupported", + }, + { + .error_fmt = QERR_TOP_NOT_FOUND, + .desc = "Top '%(top)' not found", + }, + { .error_fmt = QERR_UNDEFINED_ERROR, .desc = "An undefined error has ocurred", }, diff --git a/qerror.h b/qerror.h index a12da27..ae7b5a5 100644 --- a/qerror.h +++ b/qerror.h @@ -57,6 +57,10 @@ QError *qobject_to_qerror(const QObject *obj); #define QERR_BASE_NOT_FOUND \ "{ 'class': 'BaseNotFound', 'data': { 'base': %s } }" + +#define QERR_BASE_NOT_REACHABLE \ + "{ 'class': 'GenericError', 'data': { 'base': %s, 'top': %s } }" + #define QERR_BUS_NOT_FOUND \ "{ 'class': 'BusNotFound', 'data': { 'bus': %s } }" @@ -199,6 +203,17 @@ QError *qobject_to_qerror(const QObject *obj); #define QERR_TOO_MANY_FILES \ "{ 'class': 'TooManyFiles', 'data': {} }" +#define QERR_TOP_AND_BASE_IDENTICAL \ + "{ 'class': 'GenericError', 'data': {} }" + +/* Note: the extra space after the '}' and before the '"' is intentional + * so that it is different from QERR_TOP_AND_BASE_IDENTICAL */ +#define QERR_TOP_IS_ACTIVE \ + "{ 'class': 'GenericError', 'data': {} } " + +#define QERR_TOP_NOT_FOUND \ + "{ 'class': 'GenericError', 'data': { 'top': %s } }" + #define QERR_UNDEFINED_ERROR \ "{ 'class': 'UndefinedError', 'data': {} }" -- 1.7.11.7