Re: [PATCH] qemu: blockjob: Don't report block job progress at 100% if job isn't ready

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 29, 2019 at 05:24:09PM +0100, Peter Krempa wrote:
> Some clients take the advice to poll virDomainGetBlockJobInfo rather
> than wait for the ready event. In some cases qemu can get to 100% and
> still not reach the synchronised phase.
> 
> Since we are dealing with a computer interacting, 

OCD nit: The above sounds awkward to me, might want to rephrase it,
maybe something like: "Given that computers are interacting here ..."

> the error that the job
> can't be finalized yet is not handled very well by those specific
> implementations.
> 
> Our docs now correctly state to use the event.

Nit: Calling out the event name, VIR_DOMAIN_BLOCK_JOB_READY can be
useful when reading Git logs at a later time.

> We already munge the output for the start of the job, so we can do it
> even here.

Optional, a bit of explanation of "munging the output" at the start (and
end) of the job would be useful for those new to these block APIs.

Reading between the lines, and from what I recall Eric explaining once,
what you're implying here is: that even if QEMU reported "cur==end", but
if the _READY event is not emitted, libvirt manipulates it to report
"cur<end".

Thanks for the workaround (because "QEMU is not accurately reporting
data") fix.

/me wonders if he could make a reliable reproducer test for this...

> Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
> ---
>  src/qemu/qemu_driver.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 26edbf799f..cf500507da 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -17477,6 +17477,14 @@ qemuBlockJobInfoTranslate(qemuMonitorBlockJobInfoPtr rawInfo,
>          }
>      }
> 
> +    /* If qemu reports that it's not ready yet don't make the job go to
> +     * cur == end as some apps wrote code polling this instead of waiting for
> +     * the ready event */
> +    if (rawInfo->ready == 0 &&
> +        info->cur == info->end &&
> +        info->cur > 0)
> +        info->cur -= 1;
> +
>      info->type = rawInfo->type;
>      if (info->type == VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT &&
>          disk->mirrorJob == VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT)
> -- 
> 2.20.1
> 
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

-- 
/kashyap

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux