The DeviceNotActive error is not a particularly good match, add a separate one.
Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> --- 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