[pve-devel] [PATCH storage v2 3/3] Fix: #2124 storage: add zstd support
Alwin Antreich
a.antreich at proxmox.com
Fri Jan 31 17:01:04 CET 2020
Signed-off-by: Alwin Antreich <a.antreich at proxmox.com>
---
PVE/Storage.pm | 10 +++++++---
PVE/Storage/Plugin.pm | 4 ++--
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index bf12634..51c8bc9 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -514,7 +514,7 @@ sub path_to_volume_id {
} elsif ($path =~ m!^$privatedir/(\d+)$!) {
my $vmid = $1;
return ('rootdir', "$sid:rootdir/$vmid");
- } elsif ($path =~ m!^$backupdir/([^/]+\.(tgz|((tar|vma)(\.(gz|lzo))?)))$!) {
+ } elsif ($path =~ m!^$backupdir/([^/]+\.(tgz|((tar|vma)(\.(gz|lzo|zst))?)))$!) {
my $name = $1;
return ('iso', "$sid:backup/$name");
}
@@ -1271,7 +1271,7 @@ sub archive_info {
if (!defined($comp) || !defined($format)) {
my $volid = basename($archive);
- if ($volid =~ /vzdump-(lxc|openvz|qemu)-\d+-(\d{4})_(\d{2})_(\d{2})-(\d{2})_(\d{2})_(\d{2})\.(tgz|((tar|vma)(\.(gz|lzo))?))$/) {
+ if ($volid =~ /vzdump-(lxc|openvz|qemu)-\d+-(\d{4})_(\d{2})_(\d{2})-(\d{2})_(\d{2})_(\d{2})\.(tgz|((tar|vma)(\.(gz|lzo|zst))?))$/) {
$type = $1;
if ($8 eq 'tgz') {
@@ -1295,6 +1295,10 @@ sub archive_info {
'vma' => [ "lzop", "-d", "-c", $archive ],
'tar' => [ "tar", "--lzop", $archive ],
},
+ zst => {
+ 'vma' => [ "zstd", "-d", "-c", $archive ],
+ 'tar' => [ "tar", "--zstd", $archive ],
+ },
};
my $info;
@@ -1369,7 +1373,7 @@ sub extract_vzdump_config_vma {
my $errstring;
my $err = sub {
my $output = shift;
- if ($output =~ m/lzop: Broken pipe: <stdout>/ || $output =~ m/gzip: stdout: Broken pipe/) {
+ if ($output =~ m/lzop: Broken pipe: <stdout>/ || $output =~ m/gzip: stdout: Broken pipe/ || $output =~ m/zstd: error 70 : Write error : Broken pipe/) {
$broken_pipe = 1;
} elsif (!defined ($errstring) && $output !~ m/^\s*$/) {
$errstring = "Failed to extract config from VMA archive: $output\n";
diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm
index 58a801a..c300c58 100644
--- a/PVE/Storage/Plugin.pm
+++ b/PVE/Storage/Plugin.pm
@@ -423,7 +423,7 @@ sub parse_volname {
return ('vztmpl', $1);
} elsif ($volname =~ m!^rootdir/(\d+)$!) {
return ('rootdir', $1, $1);
- } elsif ($volname =~ m!^backup/([^/]+(\.(tgz|((tar|vma)(\.(gz|lzo))?))))$!) {
+ } elsif ($volname =~ m!^backup/([^/]+(\.(tgz|((tar|vma)(\.(gz|lzo|zst))?))))$!) {
my $fn = $1;
if ($fn =~ m/^vzdump-(openvz|lxc|qemu)-(\d+)-.+/) {
return ('backup', $fn, $2);
@@ -910,7 +910,7 @@ my $get_subdir_files = sub {
} elsif ($tt eq 'backup') {
next if defined($vmid) && $fn !~ m/\S+-$vmid-\S+/;
- next if $fn !~ m!/([^/]+\.(tgz|((tar|vma)(\.(gz|lzo))?)))$!;
+ next if $fn !~ m!/([^/]+\.(tgz|((tar|vma)(\.(gz|lzo|zst))?)))$!;
$info = { volid => "$sid:backup/$1", format => $2 };
--
2.20.1
More information about the pve-devel
mailing list