Re: [PATCHv2 libvirt] qemu: Issue rtc-reset-reinjection command after guest-set-time

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

 



On 08/14/2014 02:24 AM, Michal Privoznik wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1103245
> 
> An advice appeared there on the qemu-devel list [1]. When a domain is
> suspended and then resumed guest kernel is not aware of this. So we've
> introduced virDomainSetTime API that resets the time within guest
> using qemu-ga. On the other hand, qemu itself is trying to make RTC
> beat faster to catch the difference. But if we don't tell qemu that
> guest's time was reset via the other method, both mechanisms are
> applied resulting in again wrong guest time. In order to avoid summing
> both corrections we need to tell qemu that it should not use the RTC
> injection if the guest time is set via guest agent.
> 
> 1: http://www.mail-archive.com/qemu-devel@xxxxxxxxxx/msg236435.html
> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
> 
> Notes:
>     diff to v1:
>     -fixed command name in subject
>     -added testcase
> 

> +++ b/src/qemu/qemu_driver.c
> @@ -16879,6 +16879,16 @@ qemuDomainSetTime(virDomainPtr dom,
>      rv = qemuAgentSetTime(priv->agent, seconds, nseconds, rtcSync);
>      qemuDomainObjExitAgent(vm);
>  
> +    if (!virDomainObjIsActive(vm)) {
> +        virReportError(VIR_ERR_OPERATION_INVALID,
> +                       "%s", _("domain is not running"));
> +        goto endjob;
> +    }
> +
> +    qemuDomainObjEnterMonitor(driver, vm);
> +    rv = qemuMonitorRTCResetReinjection(priv->mon);
> +    qemuDomainObjExitMonitor(driver, vm);

We have four combinations:

1. old qemu, old qga: command fails because qga doesn't support it, qemu
tries to catch up time manually (might eventually match real time)

2. new qemu, old qga: command fails because qga doesn't support it, qemu
tries to catch up time manually (might eventually match real time)

3. new qemu, new qga: both qga and qemu commands work, no additional
catchup attempted and guest is now accurate

4. old qemu, new qga: qga succeeds, but qemu command fails, so we have
overcorrected and qemu is trying to catch up time manually
(overcorrected, so it cannot match real time)

I guess reporting failure in those three cases is fine, although I'm
still worried about case 4.  I'd feel a lot better if there were a
qemu_capabilities.h bit that detects if the qemu command is present, and
skip even attempting the qga command unless we ALSO know the qemu
command is present (that is, use the capability check to completely
avoid case 4, by turning it into the same behavior as case 1).

Weak ACK, depending on whether you agree with my desire to avoid
attempting the qga command unless we also know the qemu command exists.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
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]