[pbs-devel] [PATCH proxmox-backup v2 2/2] tape: inventory: skip unassigned tapes

Dominik Csapak d.csapak at proxmox.com
Tue Nov 29 15:17:01 CET 2022


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 at 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






More information about the pbs-devel mailing list