[pve-devel] [PATCH storage 1/1] Fix #318: Delete vzdump log when deleting a backup

Dominik Csapak d.csapak at proxmox.com
Wed Apr 3 12:39:33 CEST 2019


On 4/3/19 12:27 PM, Dominic Jaeger wrote:
> Signed-off-by: Dominic Jaeger <d.jaeger at proxmox.com>
> ---
>   PVE/API2/Storage/Content.pm | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/PVE/API2/Storage/Content.pm b/PVE/API2/Storage/Content.pm
> index e941cb6..cbee77d 100644
> --- a/PVE/API2/Storage/Content.pm
> +++ b/PVE/API2/Storage/Content.pm
> @@ -308,6 +308,11 @@ __PACKAGE__->register_method ({
>   
>   	PVE::Storage::vdisk_free ($cfg, $volid);
>   
> +	# Delete not only image but also logfile
> +	my $logpath = substr $path, 0, index($path, '.');

i don't think this is correct, since index returns the *first* occurence 
of the substr, meaning that

'/my/path.with.dots/vzdump....'

leads to the deletion of

'/my/path.log'

> +	$logpath = "$logpath.log";
> +	unlink($logpath) || die "unlink '$logpath' failed - $!\n";
> +
>   	return undef;
>       }});
>   
> 





More information about the pve-devel mailing list