From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 9FFF91FF15C for ; Wed, 13 Nov 2024 16:58:41 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E3F231A1C4; Wed, 13 Nov 2024 16:58:41 +0100 (CET) From: Filip Schauer To: pbs-devel@lists.proxmox.com Date: Wed, 13 Nov 2024 16:58:00 +0100 Message-Id: <20241113155802.190824-3-f.schauer@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241113155802.190824-1-f.schauer@proxmox.com> References: <20241113155802.190824-1-f.schauer@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.031 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: [pbs-devel] [PATCH vma-to-pbs v6 2/4] add option to skip vmids whose backups failed to upload X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" Signed-off-by: Filip Schauer --- src/main.rs | 6 ++++++ src/vma2pbs.rs | 13 ++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index de1e6e0..e87da87 100644 --- a/src/main.rs +++ b/src/main.rs @@ -54,6 +54,9 @@ Options: File containing a comment/notes [--log-file ] Log file + --skip-failed + Skip VMIDs that failed to be uploaded and continue onto the next VMID if a dump directory + is specified. -y, --yes Automatic yes to prompts -h, --help @@ -74,6 +77,7 @@ fn parse_args() -> Result { "--compress", "-e", "--encrypt", + "--skip-failed", "-y", "--yes", ]; @@ -123,6 +127,7 @@ fn parse_args() -> Result { let key_password_file: Option = args.opt_value_from_str("--key-password-file")?; let notes_file: Option = args.opt_value_from_str("--notes-file")?; let log_file_path: Option = args.opt_value_from_str("--log-file")?; + let skip_failed = args.contains("--skip-failed"); let yes = args.contains(["-y", "--yes"]); match (encrypt, keyfile.is_some()) { @@ -350,6 +355,7 @@ fn parse_args() -> Result { let options = BackupVmaToPbsArgs { pbs_args, grouped_vmas, + skip_failed, }; Ok(options) diff --git a/src/vma2pbs.rs b/src/vma2pbs.rs index b26c62e..b7de0cd 100644 --- a/src/vma2pbs.rs +++ b/src/vma2pbs.rs @@ -32,6 +32,7 @@ const VMA_CLUSTER_SIZE: usize = 65536; pub struct BackupVmaToPbsArgs { pub pbs_args: PbsArgs, pub grouped_vmas: HashMap>, + pub skip_failed: bool, } pub struct PbsArgs { @@ -478,12 +479,18 @@ pub fn vma2pbs(args: BackupVmaToPbsArgs) -> Result<(), Error> { for (_, vma_group) in args.grouped_vmas { for backup_args in vma_group { if let Err(e) = upload_vma_file(pbs_args, &backup_args) { - eprintln!( + let err_msg = format!( "Failed to upload vma file at {:?} - {e}", backup_args.vma_file_path.unwrap_or("(stdin)".into()), ); - println!("Skipping VMID {}", backup_args.backup_id); - break; + + if args.skip_failed { + eprintln!("{}", err_msg); + println!("Skipping VMID {}", backup_args.backup_id); + break; + } else { + bail!(err_msg); + } } } } -- 2.39.5 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel