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 qemu-server 1/2] fix #5032: qemu: sync guest time on resume and snapshot of saved state
Date: Thu, 18 Jun 2026 14:36:05 +0200 [thread overview]
Message-ID: <2x7ah45wpudiy7njj52gygsqmrvq5irqrehftaw5m4yrbbo4xt@a2cihrt3i6az> (raw)
In-Reply-To: <20260612122942.181958-2-j.klocker@proxmox.com>
On Fri, Jun 12, 2026 at 02:29:41PM +0200, Jakob Klocker wrote:
One comment inline, with that addressed consider this:
Reviewed-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
Tested-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
> When a VM is resumed from a saved state (hibernation or snapshot with
> RAM), the guest clock may be stale. A time skew can occur when
> creating a snapshot of a running VM.
>
> Add a new agent option `set-time-on-resume` to automatically
> synchronize the guest time with the host using the QEMU Guest Agent.
>
> Trigger time synchronization:
> - after restoring a VM from a saved state or snapshot with RAM
> - after taking a snapshot
>
> This ensures consistent guest time after rollback, restore, or
> snapshot operations when the guest OS clock does not automatically
> correct itself.
>
> Link: https://bugzilla.proxmox.com/show_bug.cgi?id=5032
>
> Signed-off-by: Jakob Klocker <j.klocker@proxmox.com>
> ---
[...]
> diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
> index 239b0cab..99bdd9f5 100644
> --- a/src/PVE/QemuServer.pm
> +++ b/src/PVE/QemuServer.pm
> @@ -5983,6 +5983,16 @@ sub vm_start_nolock {
> );
> }
>
> + my $from_saved_state = $resume || ($statefile && !$migratedfrom);
> +
> + if (
> + $from_saved_state
> + && PVE::QemuServer::Agent::should_set_time_on_resume($conf->{agent})
> + ) {
> + eval { PVE::QemuServer::Agent::guest_set_time($vmid); 1 }
> + or warn "could not sync guest time after snapshot - $@";
> + }
Since this is the resume path, it would make sense to adapt this
warning message accordingly, would be less confusing and make it easier
to grep for the relevant code when seeing the line in the journal.
> +
> return $res;
> }
[...]
next 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 [this message]
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 ` [PATCH manager/qemu-server 0/2] fix #5032: sync guest time after restore from saved state Arthur Bied-Charreton
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=2x7ah45wpudiy7njj52gygsqmrvq5irqrehftaw5m4yrbbo4xt@a2cihrt3i6az \
--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