all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Jakob Klocker <j.klocker@proxmox.com>, pve-devel@lists.proxmox.com
Subject: Re: [PATCH qemu-server v5 3/3] fix #5032: agent: sync guest time via QGA when the clock falls behind
Date: Thu, 5 Nov 2026 21:16:39 +0100	[thread overview]
Message-ID: <f4bb8181-e2b1-48df-8112-b81cc4d920b6@proxmox.com> (raw)
In-Reply-To: <20260813135713.380802-4-j.klocker@proxmox.com>

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 <vmid>
> --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 <j.klocker@proxmox.com>
> ---
>  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 = {};




  reply	other threads:[~2026-11-05 20:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13 13:57 [PATCH guest-common/manager/qemu-server v5 0/3] fix #5032: add guest time sync via QGA Jakob Klocker
2026-08-13 13:57 ` [PATCH pve-guest-common v5 1/3] AbstractConfig: allow passing options to snapshot_rollback Jakob Klocker
2026-08-13 13:57 ` [PATCH pve-manager v5 2/3] fix #5032: ui: qemu agent: add sync-time-on-resume option Jakob Klocker
2026-08-13 13:57 ` [PATCH qemu-server v5 3/3] fix #5032: agent: sync guest time via QGA when the clock falls behind Jakob Klocker
2026-11-05 20:16   ` Thomas Lamprecht [this message]
2026-11-06  8:58     ` Fiona Ebner
2026-11-06 10:36     ` Jakob Klocker
2026-11-05 10:41 ` [PATCH guest-common/manager/qemu-server v5 0/3] fix #5032: add guest time sync via QGA Jakob Klocker

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=f4bb8181-e2b1-48df-8112-b81cc4d920b6@proxmox.com \
    --to=t.lamprecht@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal