tape: create the MediaCatalog when we label a tape

This commit is contained in:
Dietmar Maurer 2020-12-29 10:55:20 +01:00
parent 26b62138ee
commit 3460565414

View File

@ -44,6 +44,7 @@ use crate::{
MediaChange, MediaChange,
Inventory, Inventory,
MediaStateDatabase, MediaStateDatabase,
MediaCatalog,
MediaId, MediaId,
mtx_load, mtx_load,
mtx_unload, mtx_unload,
@ -399,7 +400,12 @@ fn write_media_label(
let media_id = MediaId { label, media_set_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())?; inventory.store(media_id.clone())?;
drive.rewind()?; drive.rewind()?;