|
|
ae23c9 |
From bc04db3da4dea7e587bb9d0c587b8a4295f90a1f Mon Sep 17 00:00:00 2001
|
|
|
ae23c9 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
Date: Tue, 26 Jun 2018 09:47:50 +0200
|
|
|
ae23c9 |
Subject: [PATCH 082/268] blockjob: expose error string via query
|
|
|
ae23c9 |
|
|
|
ae23c9 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
Message-id: <20180626094856.6924-8-kwolf@redhat.com>
|
|
|
ae23c9 |
Patchwork-id: 81059
|
|
|
ae23c9 |
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH v2 07/73] blockjob: expose error string via query
|
|
|
ae23c9 |
Bugzilla: 1513543
|
|
|
ae23c9 |
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
ae23c9 |
|
|
|
ae23c9 |
From: John Snow <jsnow@redhat.com>
|
|
|
ae23c9 |
|
|
|
ae23c9 |
When we've reached the concluded state, we need to expose the error
|
|
|
ae23c9 |
state if applicable. Add the new field.
|
|
|
ae23c9 |
|
|
|
ae23c9 |
This should be sufficient for determining if a job completed
|
|
|
ae23c9 |
successfully or not after concluding; if we want to discriminate
|
|
|
ae23c9 |
based on how it failed more mechanically, we can always add an
|
|
|
ae23c9 |
explicit return code enumeration later.
|
|
|
ae23c9 |
|
|
|
ae23c9 |
I didn't bother to make it only show up if we are in the concluded
|
|
|
ae23c9 |
state; I don't think it's necessary.
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Cc: qemu-stable@nongnu.org
|
|
|
ae23c9 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
ae23c9 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
ae23c9 |
Reviewed-by: Alberto Garcia <berto@igalia.com>
|
|
|
ae23c9 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
(cherry picked from commit ab9ba614556ac5b0f8d96b99e0dba19f1e28d6c2)
|
|
|
ae23c9 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
ae23c9 |
---
|
|
|
ae23c9 |
blockjob.c | 2 ++
|
|
|
ae23c9 |
qapi/block-core.json | 6 +++++-
|
|
|
ae23c9 |
2 files changed, 7 insertions(+), 1 deletion(-)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
diff --git a/blockjob.c b/blockjob.c
|
|
|
ae23c9 |
index b39d0f8..6746cad 100644
|
|
|
ae23c9 |
--- a/blockjob.c
|
|
|
ae23c9 |
+++ b/blockjob.c
|
|
|
ae23c9 |
@@ -839,6 +839,8 @@ BlockJobInfo *block_job_query(BlockJob *job, Error **errp)
|
|
|
ae23c9 |
info->status = job->status;
|
|
|
ae23c9 |
info->auto_finalize = job->auto_finalize;
|
|
|
ae23c9 |
info->auto_dismiss = job->auto_dismiss;
|
|
|
ae23c9 |
+ info->has_error = job->ret != 0;
|
|
|
ae23c9 |
+ info->error = job->ret ? g_strdup(strerror(-job->ret)) : NULL;
|
|
|
ae23c9 |
return info;
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
|
|
ae23c9 |
index 9e4f1ac..28b4964 100644
|
|
|
ae23c9 |
--- a/qapi/block-core.json
|
|
|
ae23c9 |
+++ b/qapi/block-core.json
|
|
|
ae23c9 |
@@ -1172,6 +1172,9 @@
|
|
|
ae23c9 |
# @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the NULL
|
|
|
ae23c9 |
# state and disappearing from the query list. (since 2.12)
|
|
|
ae23c9 |
#
|
|
|
ae23c9 |
+# @error: Error information if the job did not complete successfully.
|
|
|
ae23c9 |
+# Not set if the job completed successfully. (since 2.12.1)
|
|
|
ae23c9 |
+#
|
|
|
ae23c9 |
# Since: 1.1
|
|
|
ae23c9 |
##
|
|
|
ae23c9 |
{ 'struct': 'BlockJobInfo',
|
|
|
ae23c9 |
@@ -1179,7 +1182,8 @@
|
|
|
ae23c9 |
'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
|
|
|
ae23c9 |
'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
|
|
|
ae23c9 |
'status': 'BlockJobStatus',
|
|
|
ae23c9 |
- 'auto-finalize': 'bool', 'auto-dismiss': 'bool' } }
|
|
|
ae23c9 |
+ 'auto-finalize': 'bool', 'auto-dismiss': 'bool',
|
|
|
ae23c9 |
+ '*error': 'str' } }
|
|
|
ae23c9 |
|
|
|
ae23c9 |
##
|
|
|
ae23c9 |
# @query-block-jobs:
|
|
|
ae23c9 |
--
|
|
|
ae23c9 |
1.8.3.1
|
|
|
ae23c9 |
|