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 [212.224.123.68])
	by lore.proxmox.com (Postfix) with ESMTPS id 755311FF187
	for <inbox@lore.proxmox.com>; Wed,  9 Apr 2025 16:27:21 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 9E3A2A1AB;
	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:23 +0200
Message-Id: <20250409142423.130540-13-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 vma-to-pbs 12/12] add support for xz compressed
 VMA files
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>

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
---
 src/main.rs    | 3 ++-
 src/vma2pbs.rs | 6 ++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/main.rs b/src/main.rs
index 5d7c3bf..03dd64f 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -254,7 +254,7 @@ fn parse_args() -> Result<BackupVmaToPbsArgs, Error> {
 
     let grouped_vmas = if let Some(dump_dir_path) = bulk {
         let re = Regex::new(
-            r"vzdump-qemu-(\d+)-(\d{4}_\d{2}_\d{2}-\d{2}_\d{2}_\d{2}).vma(|.zst|.lzo|.gz|.bz2)$",
+            r"vzdump-qemu-(\d+)-(\d{4}_\d{2}_\d{2}-\d{2}_\d{2}_\d{2}).vma(|.zst|.lzo|.gz|.xz|.bz2)$",
         )?;
 
         let mut vmas = Vec::new();
@@ -291,6 +291,7 @@ fn parse_args() -> Result<BackupVmaToPbsArgs, Error> {
                     ".zst" => Some(Compression::Zstd),
                     ".lzo" => Some(Compression::Lzo),
                     ".gz" => Some(Compression::GZip),
+                    ".xz" => Some(Compression::XZ),
                     ".bz2" => Some(Compression::BZip2),
                     _ => bail!("Unexpected file extension: {ext}"),
                 };
diff --git a/src/vma2pbs.rs b/src/vma2pbs.rs
index a27a07d..d8ccf84 100644
--- a/src/vma2pbs.rs
+++ b/src/vma2pbs.rs
@@ -53,6 +53,7 @@ pub enum Compression {
     Zstd,
     Lzo,
     GZip,
+    XZ,
     BZip2,
 }
 
@@ -534,6 +535,11 @@ fn upload_vma_file(pbs_args: &PbsArgs, backup_args: &VmaBackupArgs) -> Result<()
                     cmd
                 }
                 Compression::GZip => Command::new("zcat"),
+                Compression::XZ => {
+                    let mut cmd = Command::new("xzcat");
+                    cmd.args(["-q"]);
+                    cmd
+                }
                 Compression::BZip2 => {
                     let mut cmd = Command::new("bzcat");
                     cmd.args(["-q"]);
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel