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 59A541FF15C for ; Wed, 13 Nov 2024 12:41:46 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id D544B1465F; Wed, 13 Nov 2024 12:41:47 +0100 (CET) Mime-Version: 1.0 Date: Wed, 13 Nov 2024 12:41:15 +0100 Message-Id: From: "Shannon Sterz" To: "Proxmox Backup Server development discussion" X-Mailer: aerc 0.17.0-69-g65571b67d7d3-dirty References: <20241111130822.124584-1-f.schauer@proxmox.com> <20241111130822.124584-3-f.schauer@proxmox.com> In-Reply-To: <20241111130822.124584-3-f.schauer@proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL -0.043 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: Re: [pbs-devel] [PATCH vma-to-pbs v5 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" comments in-line: On Mon Nov 11, 2024 at 2:08 PM CET, Filip Schauer wrote: > 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 a394078..d4b36fa 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()) { > @@ -347,6 +352,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 95ede9b..a5b4027 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,13 +479,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 nit: i'd move `e` into the format string, since you are basically already touching these lines :) > ); > - 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); > + } > } > } > } _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel