From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: Dominik Csapak <d.csapak@proxmox.com>
Cc: pbs-devel@lists.proxmox.com
Subject: Re: [pbs-devel] [PATCH proxmox-backup v2 3/4] proxmox-tape: add 'catalog' option to 'proxmox-tape inventory'
Date: Tue, 18 Oct 2022 10:20:27 +0200 [thread overview]
Message-ID: <20221018082027.w4pntancsgdphlkb@casey.proxmox.com> (raw)
In-Reply-To: <20221006113610.2764065-4-d.csapak@proxmox.com>
On Thu, Oct 06, 2022 at 01:36:09PM +0200, Dominik Csapak wrote:
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> src/bin/proxmox-tape.rs | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/src/bin/proxmox-tape.rs b/src/bin/proxmox-tape.rs
> index 9cb3978f..5508dfc5 100644
> --- a/src/bin/proxmox-tape.rs
> +++ b/src/bin/proxmox-tape.rs
> @@ -444,6 +444,12 @@ async fn read_label(mut param: Value) -> Result<(), Error> {
> type: bool,
> optional: true,
^ I think we could declare the default here as well
> },
> + "catalog": {
> + description: "Try to restore catalogs from tapes.",
> + type: bool,
> + default: false,
> + optional: true,
> + }
> },
> },
> )]
> @@ -451,6 +457,7 @@ async fn read_label(mut param: Value) -> Result<(), Error> {
> async fn inventory(
> read_labels: Option<bool>,
> read_all_labels: Option<bool>,
> + catalog: Option<bool>,
^ and, as in patch 2, drop the `Option<>` here.
> mut param: Value,
> ) -> Result<(), Error> {
> let output_format = extract_output_format(&mut param);
> @@ -458,7 +465,9 @@ async fn inventory(
> let (config, _digest) = pbs_config::drive::config()?;
> let drive = extract_drive_name(&mut param, &config)?;
>
> - let do_read = read_labels.unwrap_or(false) || read_all_labels.unwrap_or(false);
> + let read_all_labels = read_all_labels.unwrap_or(false);
> + let catalog = catalog.unwrap_or(false);
> + let do_read = read_labels.unwrap_or(false) || read_all_labels || catalog;
>
> let client = connect_to_localhost()?;
>
> @@ -466,9 +475,8 @@ async fn inventory(
>
> if do_read {
> let mut param = json!({});
> - if let Some(true) = read_all_labels {
> - param["read-all-labels"] = true.into();
> - }
> + param["read-all-labels"] = read_all_labels.into();
> + param["catalog"] = catalog.into();
>
> let result = client.put(&path, Some(param)).await?; // update inventory
> view_task_result(&client, result, &output_format).await?;
> --
> 2.30.2
next prev parent reply other threads:[~2022-10-18 8:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-06 11:36 [pbs-devel] [PATCH proxmox-backup v2 0/4] allow restoring catalogs during inventory Dominik Csapak
2022-10-06 11:36 ` [pbs-devel] [PATCH proxmox-backup v2 1/4] tape: replace '&Path' with 'AsRef<Path>' in function parameters Dominik Csapak
2022-10-18 8:14 ` Wolfgang Bumiller
2022-10-06 11:36 ` [pbs-devel] [PATCH proxmox-backup v2 2/4] api/tape/inventory: optionally try to restore catalogs Dominik Csapak
2022-10-18 8:18 ` Wolfgang Bumiller
2022-10-06 11:36 ` [pbs-devel] [PATCH proxmox-backup v2 3/4] proxmox-tape: add 'catalog' option to 'proxmox-tape inventory' Dominik Csapak
2022-10-18 8:20 ` Wolfgang Bumiller [this message]
2022-10-06 11:36 ` [pbs-devel] [PATCH proxmox-backup v2 4/4] ui: tape/ChangerStatus: adding parameter selection to inventory Dominik Csapak
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=20221018082027.w4pntancsgdphlkb@casey.proxmox.com \
--to=w.bumiller@proxmox.com \
--cc=d.csapak@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox