[pve-devel] [PATCH qemu-server 1/3] vzdump: Add VM QGA option to skip `fs-freeze`/`fs-thaw` on backup

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Feb 23 11:55:55 CET 2023


Am 01/02/2023 um 13:59 schrieb Christoph Heiss:
> Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
> ---
>  PVE/QemuServer.pm        | 8 +++++++-
>  PVE/VZDump/QemuServer.pm | 5 +++++
>  2 files changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index e4d1a70..e409db1 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,
> +    },
> +    fsfreeze_thaw => {

Please rename this to:

'freeze-fs-on-backup'


> +	description => "Freeze/thaw filesystems on backup for consistency.",

detail/nit: s/filesystems/guest filesystem/

> +	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 0eb5ec6..5ff46f7 100644
> --- a/PVE/VZDump/QemuServer.pm
> +++ b/PVE/VZDump/QemuServer.pm
> @@ -862,6 +862,11 @@ sub qga_fs_freeze {
>  	return;
>      }
> 
> +    if (!PVE::QemuServer::get_qga_key($self->{vmlist}->{$vmid}, 'fsfreeze_thaw')) {

this is wrong as get_qga_key which uses parse_guest_agent which uses parse_property_string
doesn't sets the default from the schema on parse, so you'd also skip if it's not defined
(please negative test changes too)

Rather do something like:

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 $@;







More information about the pve-devel mailing list