From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 20B311FF0AA for ; Tue, 17 Nov 2026 09:57:59 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id CB614215EF; Tue, 17 Nov 2026 09:57:54 +0100 (CET) Message-ID: <99ced6dd-11dd-463d-886e-c09588ef4358@proxmox.com> Date: Tue, 17 Nov 2026 09:57:46 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH qemu-server v6 3/3] fix #5032: agent: sync guest time via QGA when the clock falls behind To: Jakob Klocker , pve-devel@lists.proxmox.com References: <20261110104601.200493-1-j.klocker@proxmox.com> <20261110104601.200493-4-j.klocker@proxmox.com> Content-Language: en-US From: Fiona Ebner In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1794905870911 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.253 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust 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: 7VJ4KZUTOPF2V7ROSG6GQTNI3M6NTRKU X-Message-ID-Hash: 7VJ4KZUTOPF2V7ROSG6GQTNI3M6NTRKU X-MailFrom: f.ebner@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 X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Am 16.11.26 um 1:21 PM schrieb Jakob Klocker: > Thanks for the feedback! > On Fri Nov 13, 2026 at 3:10 PM CET, Fiona Ebner wrote: >> Am 10.11.26 um 11:49 AM schrieb Jakob Klocker: >>> + verbose_description => >>> + "Override the 'sync-time-on-resume' setting from the VM's guest agent (QGA)" >>> + . " config for this start only. When enabled, the 'guest-set-time' QEMU guest" >>> + . " agent command is issued to synchronize the guest's clock to the host's current" >>> + . " time after the RAM state is restored, which happens here when starting a VM" >>> + . " that was hibernated (suspended to disk). Without synchronization the guest's" >>> + . " clock may still reflect the time from when the VM was hibernated. The time is" >> >> It's also for migration, or? >> > > No. The migration target is started through this endpoint, but the RAM > only arrives after vm_start returns AFAICT, so at that point the guest > is not running yet and the agent can't respond. That's why the sync in > vm_start_nolock is skipped when 'migratedfrom' is set. > > For migration, the clock is synced in vm_resume on the target, when > the source sends the 'resume' command through the migration tunnel > after the switchover. That always uses the value from the agent config. > Right, thanks for the clarification! >>> @@ -183,6 +183,19 @@ sub vm_resume($vmid, $skiplock = undef, $nocheck = undef) { >>> if $resume_cmd eq 'cont'; >>> >>> mon_cmd($vmid, $resume_cmd); >>> + >>> + # A VM in 'prelaunch' never ran, and a VM that shut down during a backup is reset >>> + # above. Both boot fresh, so the clock is not behind and the agent is not up yet. >>> + my $guest_was_running = !$reset && ($res->{status} // '') ne 'prelaunch'; >> >> Nit: could also skip 'shutdown' state for completeness. >> > > That's already covered: $reset is only set for the `shutdown` state, > and $guest_was_running checks !$reset. I'll check the status directly > in v7, so this is more obvious. Something along the lines: > > my $status = $res->{status} // ''; > my $guest_was_running = $status ne 'prelaunch' && $status ne 'shutdown'; Thanks!