From: Filip Schauer <f.schauer@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: Re: [pbs-devel] [PATCH vma-to-pbs v5 1/4] add support for bulk import of a dump directory
Date: Wed, 13 Nov 2024 17:02:00 +0100 [thread overview]
Message-ID: <77ed0a36-8302-4ee4-82ab-a547994b9f78@proxmox.com> (raw)
In-Reply-To: <D5L0U96TMHFA.2DRXOPBDV5GIT@proxmox.com>
On 13/11/2024 12:41, Shannon Sterz wrote:
>> const CMD_HELP: &str = "\
>> Usage: vma-to-pbs [OPTIONS] --repository <auth_id@host:port:datastore> --vmid <VMID> [vma_file]
>>
>> Arguments:
>> - [vma_file]
>> + [vma_file | dump_directory]
>>
>> Options:
>> --repository <auth_id@host:port:datastore>
>> Repository URL
>> [--ns <NAMESPACE>]
>> Namespace
>> - --vmid <VMID>
>> + [--vmid <VMID>]
> nit: this is marked as optional here (and in the code), but the usage
> line above still make it look like it's required.
That usage line describes the command for a single VMA file. In that
case `--vmid` actually is required. It is however not required for bulk
import. So to make that clearer I made two usage lines in v6.
On 13/11/2024 12:41, Shannon Sterz wrote:
>> + let vma_file: Box<dyn BufRead> = match &backup_args.compression {
>> + Some(compression) => {
>> + let vma_file_path = backup_args
>> + .vma_file_path
>> + .as_ref()
>> + .expect("No VMA file path provided");
>> + let mut cmd = match compression {
>> + Compression::Zstd => {
>> + let mut cmd = Command::new("zstd");
>> + cmd.args(["-q", "-d", "-c"]);
>> + cmd
> i think the following would be more elegant here:
>
>
> ```rs
> Compression::Zstd => Command::new("zstd")
> .args(["-q", "-d", "-c"]),
> ```
>
> it's a bit more concise imo
>
>> + }
>> + Compression::Lzo => {
>> + let mut cmd = Command::new("lzop");
>> + cmd.args(["-d", "-c"]);
>> + cmd
> same as above
Yeah I tried that, but unfortunatelly it does not compile:
```
error[E0716]: temporary value dropped while borrowed
--> src/vma2pbs.rs:532:38
|
531 | let mut cmd = match compression {
| ------- borrow later stored here
532 | Compression::Zstd =>
Command::new("zstd").args(["-q", "-d", "-c"]),
| ^^^^^^^^^^^^^^^^^^^^ - temporary value is
freed at the end of this statement
| |
| creates a temporary value
which is freed while still in use
|
= note: consider using a `let` binding to create a longer lived value
```
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
next prev parent reply other threads:[~2024-11-13 16:02 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-11 13:08 [pbs-devel] [PATCH vma-to-pbs v5 0/4] " Filip Schauer
2024-11-11 13:08 ` [pbs-devel] [PATCH vma-to-pbs v5 1/4] " Filip Schauer
2024-11-13 11:41 ` Shannon Sterz
2024-11-13 16:02 ` Filip Schauer [this message]
2024-11-11 13:08 ` [pbs-devel] [PATCH vma-to-pbs v5 2/4] add option to skip vmids whose backups failed to upload Filip Schauer
2024-11-13 11:41 ` Shannon Sterz
2024-11-11 13:08 ` [pbs-devel] [PATCH vma-to-pbs v5 3/4] use level-based logging instead of println Filip Schauer
2024-11-13 11:41 ` Shannon Sterz
2024-11-13 16:02 ` Filip Schauer
2024-11-11 13:08 ` [pbs-devel] [PATCH vma-to-pbs v5 4/4] log device upload progress as a percentage Filip Schauer
2024-11-13 11:41 ` Shannon Sterz
2024-11-13 16:07 ` Filip Schauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=77ed0a36-8302-4ee4-82ab-a547994b9f78@proxmox.com \
--to=f.schauer@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.