]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
blockjob: Fix a error checking of blockjob status in some case
authorJie Wang <wangjie88@huawei.com>
Fri, 19 Jan 2018 14:03:05 +0000 (22:03 +0800)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 1 Feb 2018 14:48:17 +0000 (09:48 -0500)
Commit id 'bc444666f' added a check if the returned data
buffer had an error, but failed to adjust the event from
VIR_DOMAIN_BLOCK_JOB_COMPLETED to VIR_DOMAIN_BLOCK_JOB_FAILED
in order to propagate an error such as "File descriptor in bad
state" that may be returned from QEMU when both @offset and
@len are set to 0 such as is the case when performing an async
block job read on a read only filesystem.

Signed-off-by: Jie Wang <wangjie88@huawei.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/qemu/qemu_monitor_json.c

index 5ddd85575052cf9eec361d4825f2daecc7d538cb..442b218601bc91f2a3788aba8f1e06b73d9dabfd 100644 (file)
@@ -889,7 +889,7 @@ qemuMonitorJSONHandleBlockJobImpl(qemuMonitorPtr mon,
     case VIR_DOMAIN_BLOCK_JOB_COMPLETED:
         error = virJSONValueObjectGetString(data, "error");
         /* Make sure the whole device has been processed */
-        if (offset != len)
+        if (offset != len || error)
             event = VIR_DOMAIN_BLOCK_JOB_FAILED;
         break;
     case VIR_DOMAIN_BLOCK_JOB_CANCELED: