From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 23D961FF13F for ; Thu, 18 Jun 2026 14:36:42 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0499417F45; Thu, 18 Jun 2026 14:36:42 +0200 (CEST) Date: Thu, 18 Jun 2026 14:36:05 +0200 From: Arthur Bied-Charreton To: Jakob Klocker Subject: Re: [PATCH qemu-server 1/2] fix #5032: qemu: sync guest time on resume and snapshot of saved state Message-ID: <2x7ah45wpudiy7njj52gygsqmrvq5irqrehftaw5m4yrbbo4xt@a2cihrt3i6az> References: <20260612122942.181958-1-j.klocker@proxmox.com> <20260612122942.181958-2-j.klocker@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260612122942.181958-2-j.klocker@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1781786107314 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.760 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: GSIG4DSWIXCUNB3MG7PN2OBY5FCVA4ZW X-Message-ID-Hash: GSIG4DSWIXCUNB3MG7PN2OBY5FCVA4ZW X-MailFrom: a.bied-charreton@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: pve-devel@lists.proxmox.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 Tested-by: Arthur Bied-Charreton > 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 > --- [...] > 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; > } [...]