From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <pve-devel-bounces@lists.proxmox.com> Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 5CA9D1FF187 for <inbox@lore.proxmox.com>; Wed, 9 Apr 2025 16:27:16 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 17C48A169; Wed, 9 Apr 2025 16:26:28 +0200 (CEST) From: Filip Schauer <f.schauer@proxmox.com> To: pve-devel@lists.proxmox.com Date: Wed, 9 Apr 2025 16:24:13 +0200 Message-Id: <20250409142423.130540-3-f.schauer@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250409142423.130540-1-f.schauer@proxmox.com> References: <20250409142423.130540-1-f.schauer@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.017 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH storage 02/12] add support for xz compressed VM and container backups X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com> List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe> List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/> List-Post: <mailto:pve-devel@lists.proxmox.com> List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help> List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe> Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com> Add support for xz compressed VMA files and allow the use of xz compressed container backups, which are already explicitly supported in PVE::LXC::Create::restore_tar_archive. Signed-off-by: Filip Schauer <f.schauer@proxmox.com> --- debian/control | 1 + src/PVE/Storage.pm | 3 +++ src/PVE/Storage/Plugin.pm | 2 +- src/test/archive_info_test.pm | 4 +++- src/test/list_volumes_test.pm | 11 ++++++++++- src/test/parse_volname_test.pm | 6 +++--- src/test/path_to_volume_id_test.pm | 13 ++++++++----- 7 files changed, 29 insertions(+), 11 deletions(-) diff --git a/debian/control b/debian/control index 4e1a046..c8e4f4e 100644 --- a/debian/control +++ b/debian/control @@ -51,6 +51,7 @@ Depends: bzip2, smbclient, thin-provisioning-tools, udev, + xz-utils, zstd, ${misc:Depends}, ${perl:Depends}, diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm index 6031261..0f0fad8 100755 --- a/src/PVE/Storage.pm +++ b/src/PVE/Storage.pm @@ -1578,18 +1578,21 @@ sub decompressor_info { my $decompressor = { tar => { gz => ['tar', '-z'], + xz => ['tar', '--xz'], lzo => ['tar', '--lzop'], zst => ['tar', '--zstd'], bz2 => ['tar', '--bzip2'], }, vma => { gz => ['zcat'], + xz => ['xzcat', '-q'], lzo => ['lzop', '-d', '-c'], zst => ['zstd', '-q', '-d', '-c'], bz2 => ['bzcat', '-q'], }, iso => { gz => ['zcat'], + xz => ['xzcat', '-q'], lzo => ['lzop', '-d', '-c'], zst => ['zstd', '-q', '-d', '-c'], bz2 => ['bzcat', '-q'], diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm index 4e16420..9bc04ad 100644 --- a/src/PVE/Storage/Plugin.pm +++ b/src/PVE/Storage/Plugin.pm @@ -21,7 +21,7 @@ use JSON; use base qw(PVE::SectionConfig); -use constant KNOWN_COMPRESSION_FORMATS => ('gz', 'lzo', 'zst', 'bz2'); +use constant KNOWN_COMPRESSION_FORMATS => ('gz', 'xz', 'lzo', 'zst', 'bz2'); use constant COMPRESSOR_RE => join('|', KNOWN_COMPRESSION_FORMATS); use constant LOG_EXT => ".log"; diff --git a/src/test/archive_info_test.pm b/src/test/archive_info_test.pm index 53e37be..f8bf7b1 100644 --- a/src/test/archive_info_test.pm +++ b/src/test/archive_info_test.pm @@ -119,12 +119,14 @@ my $tests = [ my $decompressor = { tar => { gz => ['tar', '-z'], + xz => ['tar', '--xz'], lzo => ['tar', '--lzop'], zst => ['tar', '--zstd'], bz2 => ['tar', '--bzip2'], }, vma => { gz => ['zcat'], + xz => ['xzcat', '-q'], lzo => ['lzop', '-d', '-c'], zst => ['zstd', '-q', '-d', '-c'], bz2 => ['bzcat', '-q'], @@ -167,7 +169,7 @@ for my $virt (sort keys %$bkp_suffix) { my $non_bkp_suffix = { 'openvz' => [ 'zip', 'tgz.lzo', 'zip.gz', '', ], 'lxc' => [ 'zip', 'tgz.lzo', 'zip.gz', '', ], - 'qemu' => [ 'vma.xz', 'vms.gz', 'vmx.zst', '', ], + 'qemu' => [ 'vms.gz', 'vmx.zst', '', ], 'none' => [ 'tar.gz', ], }; diff --git a/src/test/list_volumes_test.pm b/src/test/list_volumes_test.pm index 5adba03..588cba1 100644 --- a/src/test/list_volumes_test.pm +++ b/src/test/list_volumes_test.pm @@ -95,6 +95,7 @@ my @tests = ( "$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/dump/vzdump-qemu-16110-2020_03_30-21_16_05.vma.xz", "$storage_dir/snippets/userconfig.yaml", "$storage_dir/snippets/hookscript.pl", ], @@ -174,6 +175,15 @@ my @tests = ( 'vmid' => '16110', 'volid' => 'local:backup/vzdump-qemu-16110-2020_03_30-21_15_00.vma.bz2', }, + { + 'content' => 'backup', + 'ctime' => 1585602965, + 'format' => 'vma.xz', + 'size' => DEFAULT_SIZE, + 'subtype' => 'qemu', + 'vmid' => '16110', + 'volid' => 'local:backup/vzdump-qemu-16110-2020_03_30-21_16_05.vma.xz', + }, { 'content' => 'snippets', 'ctime' => DEFAULT_CTIME, @@ -469,7 +479,6 @@ my @tests = ( "$storage_dir/private/subvol-19254-disk-0/19254", "$storage_dir/dump/vzdump-openvz-16112-2020_03_30-21_39_30.zip.gz", "$storage_dir/dump/vzdump-openvz-16112-2020_03_30-21_39_30.tgz.lzo", - "$storage_dir/dump/vzdump-qemu-16110-2020_03_30-21_12_40.vma.xz", "$storage_dir/dump/vzdump-qemu-16110-2020_03_30-21_12_40.vms.gz", ], expected => [], # returns empty list diff --git a/src/test/parse_volname_test.pm b/src/test/parse_volname_test.pm index 0ede982..8e32945 100644 --- a/src/test/parse_volname_test.pm +++ b/src/test/parse_volname_test.pm @@ -214,8 +214,8 @@ foreach my $s (@$disk_suffix) { # create more test cases for backup files matches my $bkp_suffix = { - qemu => [ 'vma', 'vma.gz', 'vma.lzo', 'vma.zst', 'vma.bz2' ], - lxc => [ 'tar', 'tgz', 'tar.gz', 'tar.lzo', 'tar.zst', 'tar.bz2' ], + qemu => [ 'vma', 'vma.gz', 'vma.xz', 'vma.lzo', 'vma.zst', 'vma.bz2' ], + lxc => [ 'tar', 'tgz', 'tar.gz', 'tar.xz', 'tar.lzo', 'tar.zst', 'tar.bz2' ], openvz => [ 'tar', 'tgz', 'tar.gz', 'tar.lzo', 'tar.zst' ], }; @@ -245,7 +245,7 @@ foreach my $virt (keys %$bkp_suffix) { # create more test cases for failed backup files matches my $non_bkp_suffix = { - qemu => [ 'vms.gz', 'vma.xz' ], + qemu => [ 'vms.gz' ], lxc => [ 'zip.gz', 'tgz.lzo' ], }; foreach my $virt (keys %$non_bkp_suffix) { diff --git a/src/test/path_to_volume_id_test.pm b/src/test/path_to_volume_id_test.pm index 23c5a23..9c7c8c4 100644 --- a/src/test/path_to_volume_id_test.pm +++ b/src/test/path_to_volume_id_test.pm @@ -84,6 +84,14 @@ my @tests = ( 'local:backup/vzdump-qemu-16110-2020_03_30-21_12_45.vma.lzo', ], }, + { + description => 'Backup, vma.xz', + volname => "$storage_dir/dump/vzdump-qemu-16110-2020_03_30-21_12_40.vma.xz", + expected => [ + 'backup', + 'local:backup/vzdump-qemu-16110-2020_03_30-21_12_40.vma.xz', + ], + }, { description => 'Backup, vma', volname => "$storage_dir/dump/vzdump-qemu-16110-2020_03_30-21_13_55.vma", @@ -238,11 +246,6 @@ my @tests = ( volname => "$storage_dir/dump/vzdump-openvz-16112-2020_03_30-21_39_30.tgz.lzo", expected => [''], }, - { - description => 'Backup, wrong ending, qemu, vma.xz', - volname => "$storage_dir/dump/vzdump-qemu-16110-2020_03_30-21_12_40.vma.xz", - expected => [''], - }, { description => 'Backup, wrong format, qemu, vms.gz', volname => "$storage_dir/dump/vzdump-qemu-16110-2020_03_30-21_12_40.vms.gz", -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel