[PATCH qemu-server v2 4/7] agent: should fs freeze: change signature to take property string rather than full VM config

Fiona Ebner
2026-04-23T12:40:23Z

Better encapsulation and in preparation to harmonize checks for freeze
while avoiding the need to pass the full config to block jobs.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---

New in v2.

src/PVE/API2/Qemu.pm | 4 ++--
src/PVE/QemuConfig.pm | 2 +-
src/PVE/QemuServer/Agent.pm | 4 ++--
src/PVE/VZDump/QemuServer.pm | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/PVE/API2/Qemu.pm b/src/PVE/API2/Qemu.pm
index dadc06b0..e49e8dab 100644
--- a/src/PVE/API2/Qemu.pm
+++ b/src/PVE/API2/Qemu.pm
@@ -376,7 +376,7 @@ my $import_from_volid = sub {

my ($src_storeid) = PVE::Storage::parse_volume_id($src_volid);

- my $fs_freeze = PVE::QemuServer::Agent::should_fs_freeze($src_conf);
+ my $fs_freeze = PVE::QemuServer::Agent::should_fs_freeze($src_conf->{agent});

return PVE::QemuServer::clone_disk(
$storecfg,
@@ -4606,7 +4606,7 @@ __PACKAGE__->register_method({
$dest_info->{efisize} = PVE::QemuServer::get_efivars_size($oldconf)
if $opt eq 'efidisk0';

- my $fs_freeze = PVE::QemuServer::Agent::should_fs_freeze($oldconf);
+ my $fs_freeze = PVE::QemuServer::Agent::should_fs_freeze($oldconf->{agent});

my $newdrive = PVE::QemuServer::clone_disk(
$storecfg,
diff --git a/src/PVE/QemuConfig.pm b/src/PVE/QemuConfig.pm
index f93ee5bb..eedb34f9 100644
--- a/src/PVE/QemuConfig.pm
+++ b/src/PVE/QemuConfig.pm
@@ -297,7 +297,7 @@ sub __snapshot_check_freeze_needed {
return (
$running,
$running
- && PVE::QemuServer::Agent::should_fs_freeze($config)
+ && PVE::QemuServer::Agent::should_fs_freeze($config->{agent})
&& PVE::QemuServer::Agent::qga_check_running($vmid),
);
} else {
diff --git a/src/PVE/QemuServer/Agent.pm b/src/PVE/QemuServer/Agent.pm
index 8b814edd..e63b09f2 100644
--- a/src/PVE/QemuServer/Agent.pm
+++ b/src/PVE/QemuServer/Agent.pm
@@ -187,8 +187,8 @@ Does B<not> check whether the agent is actually running.

=cut

-sub should_fs_freeze($conf) {
- my $agent = parse_guest_agent($conf->{agent});
+sub should_fs_freeze($agent_str) {
+ my $agent = parse_guest_agent($agent_str);
return 0 if !$agent->{enabled};
return $agent->{'freeze-fs'} // 1;
}
diff --git a/src/PVE/VZDump/QemuServer.pm b/src/PVE/VZDump/QemuServer.pm
index ca4a8513..9952cff1 100644
--- a/src/PVE/VZDump/QemuServer.pm
+++ b/src/PVE/VZDump/QemuServer.pm
@@ -1110,7 +1110,7 @@ sub qga_fs_freeze {
return;
}

- if (!PVE::QemuServer::Agent::should_fs_freeze($conf)) {
+ if (!PVE::QemuServer::Agent::should_fs_freeze($conf->{agent})) {
$self->loginfo("skipping guest-agent 'fs-freeze', disabled in VM options");
return;
}
--
2.47.3