public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
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 2/4] api/tape/inventory: optionally try to restore catalogs
Date: Tue, 18 Oct 2022 10:18:08 +0200	[thread overview]
Message-ID: <20221018081808.rvmqljzl2pfcqtyw@casey.proxmox.com> (raw)
In-Reply-To: <20221006113610.2764065-3-d.csapak@proxmox.com>

On Thu, Oct 06, 2022 at 01:36:08PM +0200, Dominik Csapak wrote:
> in a disaster recovery case, it is useful to not only re-invetorize
> the labels + media-sets, but also to try to recover the catalogs
> from the tape (to know whats on there). This adds an option to
> the inventory api call that tries to do a fast catalog restore
> from each tape to be inventorized.
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>  src/api2/tape/drive.rs | 41 +++++++++++++++++++++++++++++++++++------
>  1 file changed, 35 insertions(+), 6 deletions(-)
> 
> diff --git a/src/api2/tape/drive.rs b/src/api2/tape/drive.rs
> index 28c0f0f5..3394afe9 100644
> --- a/src/api2/tape/drive.rs
> +++ b/src/api2/tape/drive.rs
> @@ -848,6 +848,13 @@ pub async fn inventory(drive: String) -> Result<Vec<LabelUuidMap>, Error> {
>              "read-all-labels": {
>                  description: "Load all tapes and try read labels (even if already inventoried)",
>                  type: bool,
> +                default: false,
> +                optional: true,
> +            },
> +            "catalog": {
> +                description: "Restore the catalog from tape.",
> +                type: bool,
> +                default: false,
>                  optional: true,

If we're adding default+optional here...

>              },
>          },
> @@ -867,10 +874,13 @@ pub async fn inventory(drive: String) -> Result<Vec<LabelUuidMap>, Error> {
>  /// then loads any unknown media into the drive, reads the label, and
>  /// store the result to the media database.
>  ///
> +/// If `catalog` is true, also tries to restore the catalog from tape.
> +///
>  /// Note: This updates the media online status.
>  pub fn update_inventory(
>      drive: String,
>      read_all_labels: Option<bool>,
> +    catalog: Option<bool>,

...let's just drop the `Option` bit here in both parameters...

>      rpcenv: &mut dyn RpcEnvironment,
>  ) -> Result<Value, Error> {
>      let upid_str = run_drive_worker(
> @@ -889,6 +899,8 @@ pub fn update_inventory(
>              let mut inventory = Inventory::load(TAPE_STATUS_DIR)?;
>  
>              update_changer_online_status(&config, &mut inventory, &changer_name, &label_text_list)?;
> +            let catalog = catalog.unwrap_or(false);
> +            let read_all_labels = read_all_labels.unwrap_or(false);

... Then we don't need to repeat (and potentially mess up in the future)
the defaults here. ^




  reply	other threads:[~2022-10-18  8:18 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 [this message]
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
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=20221018081808.rvmqljzl2pfcqtyw@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal