Blame SOURCES/kvm-blockjob-expose-error-string-via-query.patch

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