From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:57556) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfY6V-0001oK-Nf for qemu-devel@nongnu.org; Fri, 15 Jun 2012 11:06:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SfY6L-0004hC-Jt for qemu-devel@nongnu.org; Fri, 15 Jun 2012 11:06:27 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:47190) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfY6L-0004gs-9P for qemu-devel@nongnu.org; Fri, 15 Jun 2012 11:06:17 -0400 Received: by pbbro12 with SMTP id ro12so5648793pbb.4 for ; Fri, 15 Jun 2012 08:06:15 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Fri, 15 Jun 2012 17:05:25 +0200 Message-Id: <1339772759-31004-3-git-send-email-pbonzini@redhat.com> In-Reply-To: <1339772759-31004-1-git-send-email-pbonzini@redhat.com> References: <1339772759-31004-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [RFC PATCH 02/36] qerror/block: introduce QERR_BLOCK_JOB_NOT_ACTIVE List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@linux.vnet.ibm.com, lcapitulino@redhat.com The DeviceNotActive error is not a particularly good match, add a separate one. Signed-off-by: Paolo Bonzini --- blockdev.c | 4 ++-- qapi-schema.json | 5 ++--- qerror.c | 4 ++++ qerror.h | 3 +++ 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/blockdev.c b/blockdev.c index 9e0a72a..a3518f0 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1143,7 +1143,7 @@ void qmp_block_job_set_speed(const char *device, int64_t speed, Error **errp) BlockJob *job = find_block_job(device); if (!job) { - error_set(errp, QERR_DEVICE_NOT_ACTIVE, device); + error_set(errp, QERR_BLOCK_JOB_NOT_ACTIVE, device); return; } @@ -1155,7 +1155,7 @@ void qmp_block_job_cancel(const char *device, Error **errp) BlockJob *job = find_block_job(device); if (!job) { - error_set(errp, QERR_DEVICE_NOT_ACTIVE, device); + error_set(errp, QERR_BLOCK_JOB_NOT_ACTIVE, device); return; } diff --git a/qapi-schema.json b/qapi-schema.json index eca0872..35c16f3 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -1651,7 +1651,7 @@ # Returns: Nothing on success # If the job type does not support throttling, NotSupported # If the speed value is invalid, InvalidParameter -# If no background operation is active on this device, DeviceNotActive +# If no background operation is active on this device, BlockJobNotActive # # Since: 1.1 ## @@ -1679,8 +1679,7 @@ # @device: the device name # # Returns: Nothing on success -# If no background operation is active on this device, DeviceNotActive -# If cancellation already in progress, DeviceInUse +# If no background operation is active on this device, BlockJobNotActive # # Since: 1.1 ## diff --git a/qerror.c b/qerror.c index 92c4eff..bc672a5 100644 --- a/qerror.c +++ b/qerror.c @@ -60,6 +60,10 @@ static const QErrorStringTable qerror_table[] = { .desc = "Base '%(base)' not found", }, { + .error_fmt = QERR_BLOCK_JOB_NOT_ACTIVE, + .desc = "No active block job on device '%(name)'", + }, + { .error_fmt = QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, .desc = "Block format '%(format)' used by device '%(name)' does not support feature '%(feature)'", }, diff --git a/qerror.h b/qerror.h index b4c8758..7cf7d22 100644 --- a/qerror.h +++ b/qerror.h @@ -64,6 +64,9 @@ QError *qobject_to_qerror(const QObject *obj); #define QERR_BASE_NOT_FOUND \ "{ 'class': 'BaseNotFound', 'data': { 'base': %s } }" +#define QERR_BLOCK_JOB_NOT_ACTIVE \ + "{ 'class': 'BlockJobNotActive', 'data': { 'name': %s } }" + #define QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED \ "{ 'class': 'BlockFormatFeatureNotSupported', 'data': { 'format': %s, 'name': %s, 'feature': %s } }" -- 1.7.10.2