From: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
To: Jakob Klocker <j.klocker@proxmox.com>
Cc: pve-devel@lists.proxmox.com
Subject: Re: [PATCH manager/qemu-server 0/2] fix #5032: sync guest time after restore from saved state
Date: Thu, 18 Jun 2026 14:35:57 +0200 [thread overview]
Message-ID: <foqookahoxsezdchlzd73ts6nbo4m2iq2azgevnpvipefnlabv@biyxrjndbzq6> (raw)
In-Reply-To: <20260612122942.181958-1-j.klocker@proxmox.com>
On Fri, Jun 12, 2026 at 02:29:40PM +0200, Jakob Klocker wrote:
> This series adds a new agent option set-time-on-resume to
> automatically synchronize the guest clock via the QEMU Guest Agent
> after operations that can leave the guest time stale. The option is
> enabled by default when the QEMU Guest Agent is configured.
>
> When a VM is restored from a saved state (hibernation or snapshot with
> RAM), the guest clock continues from the point the state was saved and
> no longer matches wall-clock time. The same skew can appear after
> creating a snapshot of a running VM. For guests whose OS does not
> correct this on its own, the drift persists until the next NTP sync (if
> any), which can cause problems for time-sensitive workloads.
>
> This series introduces the set-time-on-resume agent option and triggers
> a guest-set-time call:
> * after restoring a VM from a saved state or snapshot with RAM
> * after taking a snapshot
>
> The option is exposed in the VM configuration GUI so it can be toggled
> per guest.
>
> This series depends on [0] being applied first.
>
> [0] https://lore.proxmox.com/pve-devel/20260612100758.116697-1-j.klocker@proxmox.com/T/#u
>
> Link: https://bugzilla.proxmox.com/show_bug.cgi?id=5032
>
>
> qemu-server:
>
> Jakob Klocker (1):
> fix #5032: qemu: sync guest time on resume and snapshot of saved state
>
> src/PVE/QemuConfig.pm | 7 ++++++
> src/PVE/QemuServer.pm | 10 ++++++++
> src/PVE/QemuServer/Agent.pm | 47 +++++++++++++++++++++++++++++++++++++
> 3 files changed, 64 insertions(+)
>
>
> pve-manager:
>
> Jakob Klocker (1):
> fix #5032: ui: qemu agent: add set-time-on-resume option
>
> www/manager6/Utils.js | 2 ++
> www/manager6/form/AgentFeatureSelector.js | 18 ++++++++++++++++++
> 2 files changed, 20 insertions(+)
>
>
> Summary over all repositories:
> 5 files changed, 84 insertions(+), 0 deletions(-)
>
> --
> Generated by murpp 0.12.0
>
I tested the two paths calling guest-set-time.
Skew after restore:
I set up a guest with kvm-clock & NTP enabled. I took a snapshot of it
with RAM, waited a minute and rolled the VM back to the snapshot.
Before applying this series, I observed a transient clock skew on the VM
which was corrected shortly after.
After applying, there was no observable clock skew.
Skew after snapshot:
This was a bit trickier to test. I edited
/sys/devices/system/clocksource/clocksource0/current_clocksource from
kvm-clock to tsc, however I was not able to observe any skew in the
guest after taking snapshots. I then added a sleep to pve-qemu to force
longer freezes during snapshots, still could not reproduce the skew.
I ended up just disabling NTP (`timedatectl set-ntp false`) in the
guest and setting a wrong date with `date -s`. I then saw that, before
the patch, the time stayed wrong in the guest after a snapshot, whereas
after the patch, it was corrected by the guest-set-time command.
Not very familiar with that part of the code, but FWIW the code looks
good to me as well. Left two minor comments on the patches (not blockers)
Consider this series:
Reviewed-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
Tested-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
prev parent reply other threads:[~2026-06-18 12:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-12 12:29 [PATCH manager/qemu-server 0/2] fix #5032: sync guest time after restore from saved state Jakob Klocker
2026-06-12 12:29 ` [PATCH qemu-server 1/2] fix #5032: qemu: sync guest time on resume and snapshot of " Jakob Klocker
2026-06-18 12:36 ` Arthur Bied-Charreton
2026-06-12 12:29 ` [PATCH pve-manager 2/2] fix #5032: ui: qemu agent: add set-time-on-resume option Jakob Klocker
2026-06-18 12:36 ` Arthur Bied-Charreton
2026-06-18 12:35 ` Arthur Bied-Charreton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=foqookahoxsezdchlzd73ts6nbo4m2iq2azgevnpvipefnlabv@biyxrjndbzq6 \
--to=a.bied-charreton@proxmox.com \
--cc=j.klocker@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox