[pve-devel] [PATCH manager v2 1/2] Fix #2124: Add support for zstd

Alwin Antreich a.antreich at proxmox.com
Fri Jan 31 17:00:57 CET 2020


Adds the zstd to the compression selection for backup on the GUI and the
.zst extension to the backup file filter.

Signed-off-by: Alwin Antreich <a.antreich at proxmox.com>
---

 PVE/VZDump.pm                            | 6 ++++--
 www/manager6/form/CompressionSelector.js | 3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index 3caa7ab8..21032fd6 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -592,6 +592,8 @@ sub compressor_info {
 	} else {
 	    return ('gzip --rsyncable', 'gz');
 	}
+    } elsif ($opt_compress eq 'zstd') {
+	return ('zstd', 'zst');
     } else {
 	die "internal error - unknown compression option '$opt_compress'";
     }
@@ -603,7 +605,7 @@ sub get_backup_file_list {
     my $bklist = [];
     foreach my $fn (<$dir/${bkname}-*>) {
 	next if $exclude_fn && $fn eq $exclude_fn;
-	if ($fn =~ m!/(${bkname}-(\d{4})_(\d{2})_(\d{2})-(\d{2})_(\d{2})_(\d{2})\.(tgz|((tar|vma)(\.(gz|lzo))?)))$!) {
+	if ($fn =~ m!/(${bkname}-(\d{4})_(\d{2})_(\d{2})-(\d{2})_(\d{2})_(\d{2})\.(tgz|((tar|vma)(\.(gz|lzo|zst))?)))$!) {
 	    $fn = "$dir/$1"; # untaint
 	    my $t = timelocal ($7, $6, $5, $4, $3 - 1, $2);
 	    push @$bklist, [$fn, $t];
@@ -863,7 +865,7 @@ sub exec_backup_task {
 		debugmsg ('info', "delete old backup '$d->[0]'", $logfd);
 		unlink $d->[0];
 		my $logfn = $d->[0];
-		$logfn =~ s/\.(tgz|((tar|vma)(\.(gz|lzo))?))$/\.log/;
+		$logfn =~ s/\.(tgz|((tar|vma)(\.(gz|lzo|zst))?))$/\.log/;
 		unlink $logfn;
 	    }
 	}
diff --git a/www/manager6/form/CompressionSelector.js b/www/manager6/form/CompressionSelector.js
index 8938fc0e..e8775e71 100644
--- a/www/manager6/form/CompressionSelector.js
+++ b/www/manager6/form/CompressionSelector.js
@@ -4,6 +4,7 @@ Ext.define('PVE.form.CompressionSelector', {
     comboItems: [
                 ['0', Proxmox.Utils.noneText],
                 ['lzo', 'LZO (' + gettext('fast') + ')'],
-                ['gzip', 'GZIP (' + gettext('good') + ')']
+                ['gzip', 'GZIP (' + gettext('good') + ')'],
+                ['zstd', 'ZSTD (' + gettext('better') + ')']
     ]
 });
-- 
2.20.1




More information about the pve-devel mailing list