public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup v2 2/2] tape: inventory: skip unassigned tapes
Date: Tue, 29 Nov 2022 15:17:01 +0100	[thread overview]
Message-ID: <20221129141701.4109478-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20221129141701.4109478-1-d.csapak@proxmox.com>

tapes that are labeled into a pool but are not in a media-set yet, belong
to the special 'all zero' media-set. these will never have a catalog on them,
so skip them

fixes the issue, that an inventory with 'catalog restore' aborted on
such a tape

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
changes from v1:
* use the 'unassigned' function of the MediaSetLabel
* better commit message

 src/api2/tape/drive.rs | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/api2/tape/drive.rs b/src/api2/tape/drive.rs
index 2175a460..f8f29d88 100644
--- a/src/api2/tape/drive.rs
+++ b/src/api2/tape/drive.rs
@@ -952,17 +952,17 @@ pub fn update_inventory(
                             media_id.label.uuid
                         );
 
-                        if let Some(MediaSetLabel {
-                            ref pool, ref uuid, ..
-                        }) = media_id.media_set_label
-                        {
-                            let _pool_lock = lock_media_pool(TAPE_STATUS_DIR, pool)?;
-                            let _lock = lock_media_set(TAPE_STATUS_DIR, uuid, None)?;
+                        if let Some(ref set) = media_id.media_set_label {
+                            if set.unassigned() {
+                                continue;
+                            }
+                            let _pool_lock = lock_media_pool(TAPE_STATUS_DIR, &set.pool)?;
+                            let _lock = lock_media_set(TAPE_STATUS_DIR, &set.uuid, None)?;
                             MediaCatalog::destroy_unrelated_catalog(TAPE_STATUS_DIR, &media_id)?;
                             inventory.store(media_id.clone(), false)?;
 
                             if catalog {
-                                let media_set = inventory.compute_media_set_members(uuid)?;
+                                let media_set = inventory.compute_media_set_members(&set.uuid)?;
                                 if let Err(err) = fast_catalog_restore(
                                     &worker,
                                     &mut drive,
-- 
2.30.2





  reply	other threads:[~2022-11-29 14:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-29 14:17 [pbs-devel] [PATCH proxmox-backup v2 1/2] tape: hide internal use of all zero uuid for " Dominik Csapak
2022-11-29 14:17 ` Dominik Csapak [this message]
2022-11-30 16:32 ` [pbs-devel] applied-series: " Thomas Lamprecht

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=20221129141701.4109478-2-d.csapak@proxmox.com \
    --to=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