public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server 6/8] clone disk/block jobs: change signatures to take guest agent property string
Date: Tue, 24 Mar 2026 14:50:46 +0100	[thread overview]
Message-ID: <20260324135325.120749-7-f.ebner@proxmox.com> (raw)
In-Reply-To: <20260324135325.120749-1-f.ebner@proxmox.com>

In preparation to harmonize checks for guest fs freeze.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/PVE/API2/Qemu.pm           | 14 ++------------
 src/PVE/QemuServer.pm          |  2 +-
 src/PVE/QemuServer/BlockJob.pm | 12 ++++++++----
 3 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/src/PVE/API2/Qemu.pm b/src/PVE/API2/Qemu.pm
index 841c4830..2c338295 100644
--- a/src/PVE/API2/Qemu.pm
+++ b/src/PVE/API2/Qemu.pm
@@ -374,9 +374,6 @@ my $import_from_volid = sub {
 
         my ($src_storeid) = PVE::Storage::parse_volume_id($src_volid);
 
-        my $qga = PVE::QemuServer::Agent::get_qga_key($src_conf->{agent}, 'enabled')
-            && (PVE::QemuServer::Agent::get_qga_key($src_conf->{agent}, 'guest-fsfreeze') // 1);
-
         return PVE::QemuServer::clone_disk(
             $storecfg,
             $source_info,
@@ -385,7 +382,7 @@ my $import_from_volid = sub {
             $vollist,
             undef,
             undef,
-            $qga,
+            $src_conf->{agent},
             PVE::Storage::get_bandwidth_limit('clone', [$src_storeid, $dest_info->{storage}]),
         );
     };
@@ -4562,13 +4559,6 @@ __PACKAGE__->register_method({
                     $dest_info->{efisize} = PVE::QemuServer::get_efivars_size($oldconf)
                         if $opt eq 'efidisk0';
 
-                    my $qga = PVE::QemuServer::Agent::get_qga_key($oldconf->{agent}, 'enabled')
-                        && (
-                            PVE::QemuServer::Agent::get_qga_key(
-                                $oldconf->{agent}, 'guest-fsfreeze',
-                            ) // 1
-                        );
-
                     my $newdrive = PVE::QemuServer::clone_disk(
                         $storecfg,
                         $source_info,
@@ -4577,7 +4567,7 @@ __PACKAGE__->register_method({
                         $newvollist,
                         $jobs,
                         $completion,
-                        $qga,
+                        $oldconf->{agent},
                         $clonelimit,
                     );
 
diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 039b6a8c..5d900239 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -7939,7 +7939,7 @@ sub clone_disk {
             $dest_info->{'zero-initialized'} = 1 if $sparseinit;
             $dest_info->{vmid} = $newvmid if defined($newvmid);
             my $mirror_opts = {};
-            $mirror_opts->{'guest-agent'} = 1 if $qga;
+            $mirror_opts->{'guest-agent'} = $qga;
             $mirror_opts->{bwlimit} = $bwlimit if defined($bwlimit);
             PVE::QemuServer::BlockJob::mirror(
                 $source_info,
diff --git a/src/PVE/QemuServer/BlockJob.pm b/src/PVE/QemuServer/BlockJob.pm
index d7c78741..dc5804a6 100644
--- a/src/PVE/QemuServer/BlockJob.pm
+++ b/src/PVE/QemuServer/BlockJob.pm
@@ -162,13 +162,16 @@ sub monitor {
                 last if $completion eq 'skip' || $completion eq 'auto';
 
                 if ($vmiddst && $vmiddst != $vmid) {
-                    my $should_fsfreeze = $qga && qga_check_running($vmid);
+                    my $freeze_enabled =
+                        PVE::QemuServer::Agent::get_qga_key($qga, 'enabled') &&
+                        (PVE::QemuServer::Agent::get_qga_key($qga, 'guest-fsfreeze') // 1);
+                    my $should_fsfreeze = $freeze_enabled && qga_check_running($vmid);
                     if ($should_fsfreeze) {
                         print "issuing guest agent 'guest-fsfreeze-freeze' command\n";
                         eval { PVE::QemuServer::Agent::guest_fsfreeze($vmid); };
                         warn $@ if $@;
                     } else {
-                        if (!$qga) {
+                        if (!$freeze_enabled) {
                             print "skipping guest-agent 'guest-fsfreeze-freeze', disabled in VM"
                                 . " options\n";
                         } else {
@@ -430,8 +433,9 @@ original drive to use the new target.
 
 =over
 
-=item C<< $options->{'guest-agent'} >>: If the guest agent is configured for the VM. It will be used
-to freeze and thaw the filesystems for consistency when the target belongs to a different VM.
+=item C<< $options->{'guest-agent'} >>: The guest agent configuration of the VM, i.e. the 'agent'
+property string. If enabled by the configuration, freeze and thaw the filesystems for consistency
+when the target belongs to a different VM.
 
 =item C<< $options->{'bwlimit'} >>: The bandwidth limit to use for the mirroring operation, in
 KiB/s.
-- 
2.47.3





  parent reply	other threads:[~2026-03-24 13:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-24 13:50 [PATCH-SERIES qemu-server 0/8] fix #7383: agent: fsfreeze: skip freeze if already frozen Fiona Ebner
2026-03-24 13:50 ` [PATCH qemu-server 1/8] agent: fs thaw: check command result Fiona Ebner
2026-03-25 21:20   ` applied: " Thomas Lamprecht
2026-03-24 13:50 ` [PATCH qemu-server 2/8] api: clone/import: fix check if agent is enabled Fiona Ebner
2026-03-25 21:20   ` applied: " Thomas Lamprecht
2026-03-24 13:50 ` [PATCH qemu-server 3/8] backup: freeze: " Fiona Ebner
2026-03-25 21:20   ` applied: " Thomas Lamprecht
2026-03-24 13:50 ` [PATCH qemu-server 4/8] agent: parse: change signature to take property string rather than full VM config Fiona Ebner
2026-03-24 13:50 ` [PATCH qemu-server 5/8] agent: get qga key: " Fiona Ebner
2026-03-24 13:50 ` Fiona Ebner [this message]
2026-03-24 13:50 ` [PATCH qemu-server 7/8] agent: fsfreeze: harmonize checks for guest fs freeze Fiona Ebner
2026-03-25 21:16   ` Thomas Lamprecht
2026-03-24 13:50 ` [PATCH qemu-server 8/8] fix #7383: agent: fsfreeze: skip freeze if already frozen Fiona Ebner

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=20260324135325.120749-7-f.ebner@proxmox.com \
    --to=f.ebner@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal