From 93e21fd230a05121fd4d732bd0de0501ce3e16ce Mon Sep 17 00:00:00 2001 From: Christoph Heiss Date: Thu, 23 Feb 2023 15:18:03 +0100 Subject: [PATCH] vzdump: Add VM QGA option to skip fs-freeze/-thaw on backup Signed-off-by: Christoph Heiss --- PVE/QemuServer.pm | 8 +++++++- PVE/VZDump/QemuServer.pm | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index be5c2dbc..ed361a52 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -160,7 +160,13 @@ my $agent_fmt = { description => "Run fstrim after moving a disk or migrating the VM.", type => 'boolean', optional => 1, - default => 0 + default => 0, + }, + 'freeze-fs-on-backup' => { + description => "Freeze/thaw guest filesystems on backup for consistency.", + type => 'boolean', + optional => 1, + default => 1, }, type => { description => "Select the agent type", diff --git a/PVE/VZDump/QemuServer.pm b/PVE/VZDump/QemuServer.pm index 0eb5ec62..30baa464 100644 --- a/PVE/VZDump/QemuServer.pm +++ b/PVE/VZDump/QemuServer.pm @@ -862,6 +862,12 @@ sub qga_fs_freeze { return; } + my $freeze = PVE::QemuServer::get_qga_key($self->{vmlist}->{$vmid}, 'freeze-fs-on-backup') // 1; + if (!$freeze) { + $self->loginfo("skipping guest-agent 'fs-freeze', disabled in VM options"); + return; + } + $self->loginfo("issuing guest-agent 'fs-freeze' command"); eval { mon_cmd($vmid, "guest-fsfreeze-freeze") }; $self->logerr($@) if $@;