From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 3946D1FF0DF for ; Thu, 05 Nov 2026 21:16:46 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 12B86214DE; Thu, 05 Nov 2026 21:16:44 +0100 (CET) Message-ID: Date: Thu, 5 Nov 2026 21:16:39 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: [PATCH qemu-server v5 3/3] fix #5032: agent: sync guest time via QGA when the clock falls behind To: Jakob Klocker , pve-devel@lists.proxmox.com References: <20260813135713.380802-1-j.klocker@proxmox.com> <20260813135713.380802-4-j.klocker@proxmox.com> Content-Language: en-US From: Thomas Lamprecht Autocrypt: addr=t.lamprecht@proxmox.com; keydata= xsFNBFsLjcYBEACsaQP6uTtw/xHTUCKF4VD4/Wfg7gGn47+OfCKJQAD+Oyb3HSBkjclopC5J uXsB1vVOfqVYE6PO8FlD2L5nxgT3SWkc6Ka634G/yGDU3ZC3C/7NcDVKhSBI5E0ww4Qj8s9w OQRloemb5LOBkJNEUshkWRTHHOmk6QqFB/qBPW2COpAx6oyxVUvBCgm/1S0dAZ9gfkvpqFSD 90B5j3bL6i9FIv3YGUCgz6Ue3f7u+HsEAew6TMtlt90XV3vT4M2IOuECG/pXwTy7NtmHaBQ7 UJBcwSOpDEweNob50+9B4KbnVn1ydx+K6UnEcGDvUWBkREccvuExvupYYYQ5dIhRFf3fkS4+ wMlyAFh8PQUgauod+vqs45FJaSgTqIALSBsEHKEs6IoTXtnnpbhu3p6XBin4hunwoBFiyYt6 YHLAM1yLfCyX510DFzX/Ze2hLqatqzY5Wa7NIXqYYelz7tXiuCLHP84+sV6JtEkeSUCuOiUY virj6nT/nJK8m0BzdR6FgGtNxp7RVXFRz/+mwijJVLpFsyG1i0Hmv2zTn3h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EYbF55SdGBHHOAcZtA kEQKub86e+GHA+Z8oXQSGeSGOkqHi7zfgW1UexddTvaRwE6AyZ6FxTApm8wq8NT2cryWPWTF BDSGB3ujWHMM8ERRYJPcBSjTvt0GcEqnd+OSGgxTkGOdufn51oz82zfpVo1t+J/FNz6MRMcg 8nEC+uKvgzH1nujxJ5pRCBOquFZaGn/p71Yr0oVitkttLKblFsqwa+10Lt6HBxm+2+VLp4Ja 0WZNncZciz3V3cuArpan/ZhhyiWYV5FD0pOXPCJIx7WS9PTtxiv0AOS4ScWEUmBxyhFeOpYa DrEx In-Reply-To: <20260813135713.380802-4-j.klocker@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1793909799232 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.809 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: H5NRSJNIBKTWPLKKCLK7STON2YFHMQBU X-Message-ID-Hash: H5NRSJNIBKTWPLKKCLK7STON2YFHMQBU X-MailFrom: t.lamprecht@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 13.08.26 um 15:57 schrieb Jakob Klocker: > Add a 'sync-time-on-resume' agent config property (default off) that, > when enabled, issues the guest-set-time QGA command to set the guest > clock to the host's current time after operations that leave the clock > behind: > - resuming from hibernation (suspend-to-disk) > - resuming from pause/suspend > - rolling back to a snapshot that includes RAM > - live migration > - taking a snapshot, during which the guest is briefly frozen > > The start, resume and rollback API endpoints gain a > 'sync-time-on-resume' parameter (e.g. 'qm start > --sync-time-on-resume 0') that overrides the configured agent value for > a single operation, forcing the sync on or off regardless of config. > > guest_set_time prints a confirmation line to stdout on success. During > live migration the resume step runs over the migration tunnel, which > also uses stdout, so an unconditional print corrupts the tunnel > protocol. vm_resume therefore takes a 'quiet' parameter to suppress the > print on the migration path; the confirmation is logged by the migration > code instead. > > A version check was added for migration to display a clear error > message in case 'sync-time-on-resume' is enabled and the target doesn't > support the 'sync-time-on-resume' the option. > > Signed-off-by: Jakob Klocker > --- > src/PVE/API2/Qemu.pm | 75 ++++++++++++++++++++++++++++++++-- > src/PVE/CLI/qm.pm | 2 +- > src/PVE/QemuConfig.pm | 12 +++++- > src/PVE/QemuMigrate.pm | 13 ++++++ > src/PVE/QemuServer.pm | 18 +++++++- > src/PVE/QemuServer/Agent.pm | 61 +++++++++++++++++++++++++++ > src/PVE/QemuServer/RunState.pm | 11 ++++- > 7 files changed, 183 insertions(+), 9 deletions(-) > diff --git a/src/PVE/QemuMigrate.pm b/src/PVE/QemuMigrate.pm > index 8da6f15d..ae40195c 100644 > --- a/src/PVE/QemuMigrate.pm > +++ b/src/PVE/QemuMigrate.pm > @@ -312,6 +312,16 @@ sub prepare { > } > } > > + my $target_version = PVE::QemuServer::Helpers::get_node_pvecfg_version($self->{node}); not sure if this is all worth it, we normally require all nodes to be the same level and existing VMs do not automatically gain this on upgrade, one has to explicitly configure it first. We could also avoid it for now for migration (and probably taking a snapshot) those are milliseconds at max anyway (else it would not really be live anymore). Could be enabled later for that and then potentially backup snapshots too? There's also a brief pause there I think? But if we indeed want to add this check then it needs two changes... > + if ( > + $target_version > + && !PVE::QemuServer::Helpers::pvecfg_min_version($target_version, 9, 2, 5) ... this new call to PVE::QemuServer::Helpers::pvecfg_min_version(...) could be swapped with the new location of that, i.e. PVE::Tools::pvecfg_min_version(...) and the version updated (or at least a prominent NOTE in the diffstat section of this patch added as reminder to update it on applying. > + && PVE::QemuServer::Agent::get_qga_key($conf, 'sync-time-on-resume') This misses one explicitly setting the property to 0, in which case the other node still needs to support it. Would need a definedness check here. > + ) { > + die "target node '$self->{node}' is too old to support 'sync-time-on-resume'" > + . " (needs pve-manager >= 9.2.5); disable the option before migrating\n"; > + } > + > my $vollist = PVE::QemuServer::get_vm_volumes($conf); > > my $storages = {};