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 A26361FF0B4 for ; Tue, 10 Nov 2026 11:48:57 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 2B7192166A; Tue, 10 Nov 2026 11:48:41 +0100 (CET) From: Jakob Klocker To: pve-devel@lists.proxmox.com Subject: [PATCH guest-common/manager/qemu-server v6 0/3] fix #5032: add guest time sync via QGA Date: Tue, 10 Nov 2026 11:45:58 +0100 Message-ID: <20261110104601.200493-1-j.klocker@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1794307716134 X-SPAM-LEVEL: Spam detection results: 0 AWL 1.397 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: 3YWYIDXQIYHY3RP4PN3N6WX75EMEH2CP X-Message-ID-Hash: 3YWYIDXQIYHY3RP4PN3N6WX75EMEH2CP X-MailFrom: j.klocker@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: This series adds a new agent option 'sync-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 disabled by default and only takes effect when the QEMU Guest Agent is enabled. When a VM resumes with a restored RAM state (waking from hibernation or rolling back to a snapshot that includes RAM), the guest clock continues from the point the state was saved and no longer matches wall-clock time. Skew also appears whenever the guest is briefly frozen and resumed - after creating a snapshot, an ordinary pause/resume, the resume step of a live migration, or a vzdump in suspend mode. When enabled, the option triggers a guest-set-time call: * after resuming from hibernation (suspend-to-disk) * after rolling back to a snapshot that includes RAM * after a live migration * after an ordinary pause/resume * after taking a snapshot * after a vzdump backup in suspend mode The start, resume and rollback API endpoints also accept a 'sync-time-on-resume' parameter that overrides the configured value for a single operation. The option is exposed in the VM configuration GUI so it can be toggled per guest. Changes since v5: * drop the migration version check (covered by the strict config check series and the same-version cluster requirement) * vzdump: sync the guest clock after resuming from a suspend mode backup; snapshot mode doesn't pause the vCPUs and stop mode boots the guest fresh, so neither needs a sync * vm_resume: skip the sync when resuming from 'prelaunch' (e.g. a VM started paused for a backup) or after a reset, the guest boots fresh in both cases * guest_set_time: return whether the time was actually set * rebased on current master Changes since v4: * rebased on current master * no functional changes Link: https://bugzilla.proxmox.com/show_bug.cgi?id=5032 pve-guest-common: Jakob Klocker (1): AbstractConfig: allow passing options to snapshot_rollback src/PVE/AbstractConfig.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) pve-manager: Jakob Klocker (1): fix #5032: ui: qemu agent: add sync-time-on-resume option www/manager6/form/AgentFeatureSelector.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) qemu-server: Jakob Klocker (1): fix #5032: agent: sync guest time via QGA when the clock falls behind src/PVE/API2/Qemu.pm | 75 ++++++++++++++++++++++++++++++++-- src/PVE/CLI/qm.pm | 2 +- src/PVE/QemuConfig.pm | 12 +++++- src/PVE/QemuMigrate.pm | 3 ++ src/PVE/QemuServer.pm | 18 +++++++- src/PVE/QemuServer/Agent.pm | 64 +++++++++++++++++++++++++++++ src/PVE/QemuServer/RunState.pm | 15 ++++++- src/PVE/VZDump/QemuServer.pm | 25 +++++++++++- 8 files changed, 203 insertions(+), 11 deletions(-) Summary over all repositories: 10 files changed, 224 insertions(+), 13 deletions(-) -- Generated by murpp 0.12.0