[libvirt] [PATCH V2] blockjob: Fix error checking of blockjob status

Eric Blake eblake at redhat.com
Thu Jan 4 16:51:51 UTC 2018


On 01/04/2018 10:12 AM, Jie Wang wrote:
> offset and len can also be equal to 0 on failed if blockjob return
> status:"BLOCK_JOB_COMPLETED" with error:"File descriptor in bad state",
> so it's better to make our decision based on whether 'error' is non-NULL.
> ---
>  src/qemu/qemu_monitor_json.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
> index e45868b..ae64a5a 100644
> --- a/src/qemu/qemu_monitor_json.c
> +++ b/src/qemu/qemu_monitor_json.c
> @@ -885,8 +885,7 @@ qemuMonitorJSONHandleBlockJobImpl(qemuMonitorPtr mon,
>      switch ((virConnectDomainEventBlockJobStatus) event) {
>      case VIR_DOMAIN_BLOCK_JOB_COMPLETED:
>          error = virJSONValueObjectGetString(data, "error");
> -        /* Make sure the whole device has been processed */
> -        if (offset != len)
> +        if (error != NULL)
>              event = VIR_DOMAIN_BLOCK_JOB_FAILED;

Is the offset != len check still worthwhile?  Is there a case where qemu
can return different values but not set error, in which case we want
(offset != len || error)?

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180104/4ffe2ae3/attachment-0001.sig>


More information about the libvir-list mailing list