[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 10/37] blockjob: expose error string via query
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 10/37] blockjob: expose error string via query |
Date: |
Tue, 15 May 2018 17:40:06 +0200 |
From: John Snow <address@hidden>
When we've reached the concluded state, we need to expose the error
state if applicable. Add the new field.
This should be sufficient for determining if a job completed
successfully or not after concluding; if we want to discriminate
based on how it failed more mechanically, we can always add an
explicit return code enumeration later.
I didn't bother to make it only show up if we are in the concluded
state; I don't think it's necessary.
Cc: address@hidden
Signed-off-by: John Snow <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Alberto Garcia <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
qapi/block-core.json | 6 +++++-
blockjob.c | 2 ++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 21c3470234..17ffd44cce 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -1172,6 +1172,9 @@
# @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the NULL
# state and disappearing from the query list. (since 2.12)
#
+# @error: Error information if the job did not complete successfully.
+# Not set if the job completed successfully. (since 2.12.1)
+#
# Since: 1.1
##
{ 'struct': 'BlockJobInfo',
@@ -1179,7 +1182,8 @@
'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
'status': 'BlockJobStatus',
- 'auto-finalize': 'bool', 'auto-dismiss': 'bool' } }
+ 'auto-finalize': 'bool', 'auto-dismiss': 'bool',
+ '*error': 'str' } }
##
# @query-block-jobs:
diff --git a/blockjob.c b/blockjob.c
index dfffad921a..0b9b336d19 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -831,6 +831,8 @@ BlockJobInfo *block_job_query(BlockJob *job, Error **errp)
info->status = job->status;
info->auto_finalize = job->auto_finalize;
info->auto_dismiss = job->auto_dismiss;
+ info->has_error = job->ret != 0;
+ info->error = job->ret ? g_strdup(strerror(-job->ret)) : NULL;
return info;
}
--
2.13.6
- [Qemu-block] [PULL 00/37] Block layer patches, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 04/37] null: Switch to byte-based read/write, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 03/37] file-win32: Switch to byte-based callbacks, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 02/37] block: Support byte-based aio callbacks, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 05/37] rbd: Switch to byte-based callbacks, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 06/37] vxhs: Switch to byte-based callbacks, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 07/37] block: Drop last of the sector-based aio callbacks, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 08/37] block: Merge .bdrv_co_writev{, _flags} in drivers, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 09/37] hmp: Allow using a qdev id in block_set_io_throttle, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 01/37] block-backend: simplify blk_get_aio_context, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 10/37] blockjob: expose error string via query,
Kevin Wolf <=
- [Qemu-block] [PULL 15/37] blockjob: Introduce block_job_ratelimit_get_delay(), Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 11/37] blockjob: Fix assertion in block_job_finalize(), Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 16/37] blockjob: Add block_job_driver(), Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 14/37] blockjob: Implement block_job_set_speed() centrally, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 19/37] specs/qcow2: Clarify that compressed clusters have the COPIED bit reset, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 13/37] blockjob: Move RateLimit to BlockJob, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 12/37] blockjob: Wrappers for progress counter access, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 17/37] iotests: Split 214 off of 122, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 22/37] iotests: Add failure matching to common.qemu, Kevin Wolf, 2018/05/15
- [Qemu-block] [PULL 20/37] qcow2: Give the refcount cache the minimum possible size by default, Kevin Wolf, 2018/05/15