On 12/26/2017 07:35 AM, Jie Wang wrote:
> when the blockjob return status:"BLOCK_JOB_COMPLETED" with error:
> "File descriptor in bad state", "offset" and "len" are equal to zero,
> but the blockjob event should be "VIR_DOMAIN_BLOCK_JOB_FAILED"
> ---
> src/qemu/qemu_monitor_json.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
> index e45868b..943360a 100644
> --- a/src/qemu/qemu_monitor_json.c
> +++ b/src/qemu/qemu_monitor_json.c
> @@ -886,7 +886,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 || offset == 0)
Unfortunately, offset can also be 0 on success if you perform a block
job on a zero-length disk (why anyone would use a 0-length disk in
practice is beyond me, but who knows). Isn't a better patch to make our
decision based on whether 'error' is non-NULL?
> event = VIR_DOMAIN_BLOCK_JOB_FAILED;
> break;
> case VIR_DOMAIN_BLOCK_JOB_CANCELED:
>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list