[pve-devel] [PATCH storage 01/12] add support for .vma.bz2
Filip Schauer
f.schauer at proxmox.com
Wed Apr 9 16:24:12 CEST 2025
This aligns with the PVE::Storage::BACKUP_EXT_RE_2 regex
Signed-off-by: Filip Schauer <f.schauer at proxmox.com>
---
src/PVE/Storage.pm | 11 +++++++++--
src/test/list_volumes_test.pm | 10 ++++++++++
src/test/parse_volname_test.pm | 2 +-
3 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm
index d0a696a..6031261 100755
--- a/src/PVE/Storage.pm
+++ b/src/PVE/Storage.pm
@@ -1720,13 +1720,20 @@ sub extract_vzdump_config_vma {
if ($comp) {
my $cmd = [ [@$decompressor, $archive], ["vma", "config", "-"] ];
- # lzop/zcat exits with 1 when the pipe is closed early by vma, detect this and ignore the exit code later
+ # lzop/zcat/zstd/bzcat exits with 1 when the pipe is closed early by vma,
+ # detect this and ignore the exit code later
my $broken_pipe;
my $errstring;
my $err = sub {
my $output = shift;
- if ($output =~ m/lzop: Broken pipe: <stdout>/ || $output =~ m/gzip: stdout: Broken pipe/ || $output =~ m/zstd: error 70 : Write error.*Broken pipe/) {
+ if (
+ $output =~ m/lzop: Broken pipe: <stdout>/
+ || $output =~ m/gzip: stdout: Broken pipe/
+ || $output =~ m/zstd: error 70 : Write error.*Broken pipe/
+ || $output =~ m/bzcat: Broken pipe/
+ ) {
$broken_pipe = 1;
+ $errstring = "";
} elsif (!defined ($errstring) && $output !~ m/^\s*$/) {
$errstring = "Failed to extract config from VMA archive: $output\n";
}
diff --git a/src/test/list_volumes_test.pm b/src/test/list_volumes_test.pm
index 7b6df6a..5adba03 100644
--- a/src/test/list_volumes_test.pm
+++ b/src/test/list_volumes_test.pm
@@ -94,6 +94,7 @@ my @tests = (
"$storage_dir/dump/vzdump-qemu-16110-2020_03_30-21_12_45.vma.lzo",
"$storage_dir/dump/vzdump-qemu-16110-2020_03_30-21_13_55.vma",
"$storage_dir/dump/vzdump-qemu-16110-2020_03_30-21_13_55.vma.zst",
+ "$storage_dir/dump/vzdump-qemu-16110-2020_03_30-21_15_00.vma.bz2",
"$storage_dir/snippets/userconfig.yaml",
"$storage_dir/snippets/hookscript.pl",
],
@@ -164,6 +165,15 @@ my @tests = (
'vmid' => '16110',
'volid' => 'local:backup/vzdump-qemu-16110-2020_03_30-21_13_55.vma.zst',
},
+ {
+ 'content' => 'backup',
+ 'ctime' => 1585602900,
+ 'format' => 'vma.bz2',
+ 'size' => DEFAULT_SIZE,
+ 'subtype' => 'qemu',
+ 'vmid' => '16110',
+ 'volid' => 'local:backup/vzdump-qemu-16110-2020_03_30-21_15_00.vma.bz2',
+ },
{
'content' => 'snippets',
'ctime' => DEFAULT_CTIME,
diff --git a/src/test/parse_volname_test.pm b/src/test/parse_volname_test.pm
index 175500d..0ede982 100644
--- a/src/test/parse_volname_test.pm
+++ b/src/test/parse_volname_test.pm
@@ -214,7 +214,7 @@ foreach my $s (@$disk_suffix) {
# create more test cases for backup files matches
my $bkp_suffix = {
- qemu => [ 'vma', 'vma.gz', 'vma.lzo', 'vma.zst' ],
+ qemu => [ 'vma', 'vma.gz', 'vma.lzo', 'vma.zst', 'vma.bz2' ],
lxc => [ 'tar', 'tgz', 'tar.gz', 'tar.lzo', 'tar.zst', 'tar.bz2' ],
openvz => [ 'tar', 'tgz', 'tar.gz', 'tar.lzo', 'tar.zst' ],
};
--
2.39.5
More information about the pve-devel
mailing list