From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 6AB221FF15C for ; Wed, 30 Oct 2024 14:56:17 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6EB441A5B0; Wed, 30 Oct 2024 14:56:22 +0100 (CET) From: Filip Schauer To: pbs-devel@lists.proxmox.com Date: Wed, 30 Oct 2024 14:55:34 +0100 Message-Id: <20241030135537.92595-4-f.schauer@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241030135537.92595-1-f.schauer@proxmox.com> References: <20241030135537.92595-1-f.schauer@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.033 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 v4 3/6] 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 4c5135b..4e3a91b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -50,6 +50,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 @@ -70,6 +73,7 @@ fn parse_args() -> Result { "--compress", "-e", "--encrypt", + "--skip-failed", "-y", "--yes", ]; @@ -119,6 +123,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()) { @@ -341,6 +346,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 a3f1eee..ef9d770 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: Vec>, + pub skip_failed: bool, } pub struct PbsArgs { @@ -479,13 +480,19 @@ 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 {:?} - {}", backup_args.vma_file_path.unwrap_or("(stdin)".into()), e ); - 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