From 34605654146029691034ef1a88f91e3288971931 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 29 Dec 2020 10:55:20 +0100 Subject: [PATCH] tape: create the MediaCatalog when we label a tape --- src/api2/tape/drive.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/api2/tape/drive.rs b/src/api2/tape/drive.rs index ee5f5c8a..898ed701 100644 --- a/src/api2/tape/drive.rs +++ b/src/api2/tape/drive.rs @@ -44,6 +44,7 @@ use crate::{ MediaChange, Inventory, MediaStateDatabase, + MediaCatalog, MediaId, mtx_load, mtx_unload, @@ -399,7 +400,12 @@ fn write_media_label( let media_id = MediaId { label, media_set_label }; - let mut inventory = Inventory::load(Path::new(TAPE_STATUS_DIR))?; + let status_path = Path::new(TAPE_STATUS_DIR); + + // Create the media catalog + MediaCatalog::overwrite(status_path, &media_id, false)?; + + let mut inventory = Inventory::load(status_path)?; inventory.store(media_id.clone())?; drive.rewind()?;