[pve-devel] applied-series: [PATCH qemu-server 1/2] migrate: add log for guest fstrim

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Apr 26 12:16:08 CEST 2022


thanks!

On April 25, 2022 2:31 pm, Fabian Ebner wrote:
> and make a failure noticable.
> 
> Suggested-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
> Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
> ---
>  PVE/QemuMigrate.pm | 21 +++++++++++++++------
>  1 file changed, 15 insertions(+), 6 deletions(-)
> 
> diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
> index 891edfb2..c293e294 100644
> --- a/PVE/QemuMigrate.pm
> +++ b/PVE/QemuMigrate.pm
> @@ -1170,14 +1170,23 @@ sub phase3_cleanup {
>  		    $self->{errors} = 1;
>  		}
>  	    }
> +	}
>  
> -	    if (
> -		$self->{storage_migration}
> -		&& PVE::QemuServer::parse_guest_agent($conf)->{fstrim_cloned_disks}
> -		&& $self->{running}
> -	    ) {
> +	if (
> +	    $self->{storage_migration}
> +	    && PVE::QemuServer::parse_guest_agent($conf)->{fstrim_cloned_disks}
> +	    && $self->{running}
> +	) {
> +	    if (!$self->{vm_was_paused}) {
> +		$self->log('info', "issuing guest fstrim");
>  		my $cmd = [@{$self->{rem_ssh}}, 'qm', 'guest', 'cmd', $vmid, 'fstrim'];
> -		eval{ PVE::Tools::run_command($cmd, outfunc => sub {}, errfunc => sub {}) };
> +		eval { PVE::Tools::run_command($cmd, outfunc => sub {}, errfunc => sub {}) };
> +		if (my $err = $@) {
> +		    $self->log('err', "fstrim failed - $err");
> +		    $self->{errors} = 1;
> +		}
> +	    } else {
> +		$self->log('info', "skipping guest fstrim, because VM is paused");
>  	    }
>  	}
>      }
> -- 
> 2.30.2
> 
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 





More information about the pve-devel mailing list