]> git.proxmox.com Git - proxmox-backup.git/commitdiff
tape: change code hierarchy to improve docs
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 21 Jan 2021 16:12:01 +0000 (17:12 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 21 Jan 2021 16:12:01 +0000 (17:12 +0100)
21 files changed:
src/api2/config/changer.rs
src/api2/config/drive.rs
src/api2/tape/backup.rs
src/api2/tape/changer.rs
src/api2/tape/drive.rs
src/api2/tape/media.rs
src/api2/tape/restore.rs
src/bin/proxmox-tape.rs
src/bin/proxmox_tape/changer.rs
src/bin/proxmox_tape/drive.rs
src/bin/sg-tape-cmd.rs
src/tape/changer/mod.rs
src/tape/changer/online_status_map.rs [new file with mode: 0644]
src/tape/drive/linux_tape.rs
src/tape/drive/mam.rs
src/tape/drive/mod.rs
src/tape/drive/virtual_tape.rs
src/tape/inventory.rs
src/tape/mod.rs
src/tape/online_status_map.rs [deleted file]
src/tape/pool_writer.rs

index c1e8c59e0b2d9da16f4d52b9ba6a2e5601caffb4..c420dda1f9dcbc3e51ecd67aecfdb8bf8cc74bd5 100644 (file)
@@ -21,7 +21,7 @@ use crate::{
         ScsiTapeChanger,
         LinuxTapeDrive,
     },
-    tape::{
+    tape::drive::{
         linux_tape_changer_list,
         check_drive_path,
         lookup_drive,
index 546017957f501fabd0603c83c7bb482fed59300c..e48926a7c59ce40b64c503e2a1e879fb61bd4b36 100644 (file)
@@ -16,7 +16,7 @@ use crate::{
         LinuxTapeDrive,
         ScsiTapeChanger,
     },
-    tape::{
+    tape::drive::{
         linux_tape_device_list,
         check_drive_path,
         lookup_drive,
index 2288a393d8f6ff6e33db2d2b375c680c442c698c..6aa12d568d2d22bbd745decb2246483bc2db88e7 100644 (file)
@@ -37,8 +37,8 @@ use crate::{
         PoolWriter,
         MediaPool,
         SnapshotReader,
-        media_changer,
-        update_changer_online_status,
+        drive::media_changer,
+        changer::update_changer_online_status,
     },
 };
 
index 43545a668be0016d80c5ef4fb42babe3a8d54e97..4c1b57e9b0c5a633ec1260f0c829b329d370e688 100644 (file)
@@ -17,13 +17,15 @@ use crate::{
     },
     tape::{
         TAPE_STATUS_DIR,
-        ElementStatus,
-        OnlineStatusMap,
         Inventory,
-        linux_tape_changer_list,
-        mtx_status,
-        mtx_status_to_online_set,
-        mtx_transfer,
+        drive::linux_tape_changer_list,
+        changer::{
+            OnlineStatusMap,
+            ElementStatus,
+            mtx_status,
+            mtx_status_to_online_set,
+            mtx_transfer,
+        },
     },
 };
 
index bdad9bb98e2c1378807a16fa951847870dfaf3dd..6e6259054a0d8699fddc14d86a839db45f3e7b49 100644 (file)
@@ -43,24 +43,24 @@ use crate::{
     server::WorkerTask,
     tape::{
         TAPE_STATUS_DIR,
-        TapeDriver,
         MediaPool,
         Inventory,
         MediaCatalog,
         MediaId,
-        linux_tape_device_list,
-        open_drive,
-        media_changer,
-        required_media_changer,
-        update_changer_online_status,
-        linux_tape::{
-            LinuxTapeHandle,
-            open_linux_tape_device,
-        },
-        file_formats::{
+         file_formats::{
             MediaLabel,
             MediaSetLabel,
         },
+        drive::{
+            TapeDriver,
+            LinuxTapeHandle,
+            open_linux_tape_device,
+            linux_tape_device_list,
+            media_changer,
+            required_media_changer,
+            open_drive,
+        },
+        changer::update_changer_online_status,
     },
 };
 
index 9d698bc8aa2cd2d4b33d32c88321beb311610e3b..70af454c321ddf1096569b9575adb624a447bce7 100644 (file)
@@ -33,7 +33,7 @@ use crate::{
         Inventory,
         MediaPool,
         MediaCatalog,
-        update_online_status,
+        changer::update_online_status,
     },
 };
 
index 2b4102d1ce8d1fef0bcce084403f3d6fab3d74db..f5ec365291d4e7c614f7ebbe26f3e3b959f9ce6f 100644 (file)
@@ -55,10 +55,8 @@ use crate::{
         MediaId,
         MediaCatalog,
         ChunkArchiveDecoder,
-        TapeDriver,
         MediaPool,
         Inventory,
-        request_and_load_media,
         file_formats::{
             PROXMOX_BACKUP_MEDIA_LABEL_MAGIC_1_0,
             PROXMOX_BACKUP_SNAPSHOT_ARCHIVE_MAGIC_1_0,
@@ -67,6 +65,10 @@ use crate::{
             PROXMOX_BACKUP_CHUNK_ARCHIVE_MAGIC_1_0,
             MediaContentHeader,
         },
+        drive::{
+            TapeDriver,
+            request_and_load_media,
+        }
     },
 };
 
index 7995977db97c02908dfecf412cfeb55b21718d15..ae76fd7cccc1b97197c10845ca56238de1bfb979 100644 (file)
@@ -41,7 +41,7 @@ use proxmox_backup::{
         media_pool::complete_pool_name,
     },
     tape::{
-        open_drive,
+        drive::open_drive,
         complete_media_label_text,
         complete_media_set_uuid,
         file_formats::{
index f9bff02b04e77378699e3cf00ff757beaeb2fe9b..a8dabf9cf6b3a0cb40174795def309f009138868 100644 (file)
@@ -19,8 +19,10 @@ use proxmox_backup::{
         },
     },
     tape::{
-        complete_changer_path,
-        media_changer,
+        drive::{
+            media_changer,
+            complete_changer_path,
+        },
     },
     config::{
         self,
index 217b7c86c504d9e01ba434d0aaf9cd5324caece4..2b442adf87e8523acdf806dd8a6e3fad504940b5 100644 (file)
@@ -17,9 +17,7 @@ use proxmox_backup::{
             DRIVE_NAME_SCHEMA,
         },
     },
-    tape::{
-        complete_drive_path,
-    },
+    tape::drive::complete_drive_path,
     config::drive::{
         complete_drive_name,
         complete_changer_name,
index 8621b02e48c63d7c67b1eed0053c572673b2a662..475b2cbb16b26b18784a09a21d56d7c5b6595ccb 100644 (file)
@@ -31,8 +31,8 @@ use proxmox_backup::{
         LinuxTapeDrive,
     },
     tape::{
-        TapeDriver,
-        linux_tape::{
+        drive::{
+            TapeDriver,
             LinuxTapeHandle,
             open_linux_tape_device,
             check_tape_is_linux_tape_device,
index 6e92bbe2fb44bb2d43f7dfb29ed613d394802973..ec1f1e31c7901fec1cce651398a1853d8cbbcc1d 100644 (file)
@@ -1,3 +1,5 @@
+//! Media changer implementation (SCSI media changer)
+
 mod email;
 pub use email::*;
 
@@ -10,6 +12,9 @@ pub use mtx_wrapper::*;
 mod mtx;
 pub use mtx::*;
 
+mod online_status_map;
+pub use online_status_map::*;
+
 use anyhow::{bail, Error};
 
 /// Interface to the media changer device for a single drive
diff --git a/src/tape/changer/online_status_map.rs b/src/tape/changer/online_status_map.rs
new file mode 100644 (file)
index 0000000..53f5fa4
--- /dev/null
@@ -0,0 +1,192 @@
+use std::path::Path;
+use std::collections::{HashMap, HashSet};
+
+use anyhow::{bail, Error};
+
+use proxmox::tools::Uuid;
+use proxmox::api::section_config::SectionConfigData;
+
+use crate::{
+    api2::types::{
+        VirtualTapeDrive,
+        ScsiTapeChanger,
+    },
+    tape::{
+        Inventory,
+        changer::{
+            MediaChange,
+            MtxStatus,
+            ElementStatus,
+            mtx_status,
+        },
+    },
+};
+
+/// Helper to update media online status
+///
+/// A tape media is considered online if it is accessible by a changer
+/// device. This class can store the list of available changes,
+/// together with the accessible media ids.
+pub struct OnlineStatusMap {
+    map: HashMap<String, Option<HashSet<Uuid>>>,
+    changer_map: HashMap<Uuid, String>,
+}
+
+impl OnlineStatusMap {
+
+    /// Creates a new instance with one map entry for each configured
+    /// changer (or 'VirtualTapeDrive', which has an internal
+    /// changer). The map entry is set to 'None' to indicate that we
+    /// do not have information about the online status.
+    pub fn new(config: &SectionConfigData) -> Result<Self, Error> {
+
+        let mut map = HashMap::new();
+
+        let changers: Vec<ScsiTapeChanger> = config.convert_to_typed_array("changer")?;
+        for changer in changers {
+            map.insert(changer.name.clone(), None);
+        }
+
+        let vtapes: Vec<VirtualTapeDrive> = config.convert_to_typed_array("virtual")?;
+        for vtape in vtapes {
+            map.insert(vtape.name.clone(), None);
+        }
+
+        Ok(Self { map, changer_map: HashMap::new() })
+    }
+
+    /// Returns the assiciated changer name for a media.
+    pub fn lookup_changer(&self, uuid: &Uuid) -> Option<&String> {
+        self.changer_map.get(uuid)
+    }
+
+    /// Returns the map which assiciates media uuids with changer names.
+    pub fn changer_map(&self) -> &HashMap<Uuid, String> {
+        &self.changer_map
+    }
+
+    /// Returns the set of online media for the specified changer.
+    pub fn online_map(&self, changer_name: &str) -> Option<&Option<HashSet<Uuid>>> {
+        self.map.get(changer_name)
+    }
+
+    /// Update the online set for the specified changer
+    pub fn update_online_status(&mut self, changer_name: &str, online_set: HashSet<Uuid>) -> Result<(), Error> {
+
+        match self.map.get(changer_name) {
+            None => bail!("no such changer '{}' device", changer_name),
+            Some(None) => { /* Ok */ },
+            Some(Some(_)) => {
+                // do not allow updates to keep self.changer_map consistent
+                bail!("update_online_status '{}' called twice", changer_name);
+            }
+        }
+
+        for uuid in online_set.iter() {
+            self.changer_map.insert(uuid.clone(), changer_name.to_string());
+        }
+
+        self.map.insert(changer_name.to_string(), Some(online_set));
+
+        Ok(())
+    }
+}
+
+/// Extract the list of online media from MtxStatus
+///
+/// Returns a HashSet containing all found media Uuid. This only
+/// returns media found in Inventory.
+pub fn mtx_status_to_online_set(status: &MtxStatus, inventory: &Inventory) -> HashSet<Uuid> {
+
+    let mut online_set = HashSet::new();
+
+    for drive_status in status.drives.iter() {
+        if let ElementStatus::VolumeTag(ref label_text) = drive_status.status {
+            if let Some(media_id) = inventory.find_media_by_label_text(label_text) {
+                online_set.insert(media_id.label.uuid.clone());
+            }
+        }
+    }
+
+    for (import_export, slot_status) in status.slots.iter() {
+        if *import_export { continue; }
+        if let ElementStatus::VolumeTag(ref label_text) = slot_status {
+            if let Some(media_id) = inventory.find_media_by_label_text(label_text) {
+                online_set.insert(media_id.label.uuid.clone());
+            }
+        }
+    }
+
+    online_set
+}
+
+/// Update online media status
+///
+/// Simply ask all changer devices.
+pub fn update_online_status(state_path: &Path) -> Result<OnlineStatusMap, Error> {
+
+    let (config, _digest) = crate::config::drive::config()?;
+
+    let mut inventory = Inventory::load(state_path)?;
+
+    let changers: Vec<ScsiTapeChanger> = config.convert_to_typed_array("changer")?;
+
+    let mut map = OnlineStatusMap::new(&config)?;
+
+    for changer in changers {
+        let status = match mtx_status(&changer) {
+            Ok(status) => status,
+            Err(err) => {
+                eprintln!("unable to get changer '{}' status - {}", changer.name, err);
+                continue;
+            }
+        };
+
+        let online_set = mtx_status_to_online_set(&status, &inventory);
+        map.update_online_status(&changer.name, online_set)?;
+    }
+
+    let vtapes: Vec<VirtualTapeDrive> = config.convert_to_typed_array("virtual")?;
+    for mut vtape in vtapes {
+        let media_list = match vtape.online_media_label_texts() {
+            Ok(media_list) => media_list,
+            Err(err) => {
+                eprintln!("unable to get changer '{}' status - {}", vtape.name, err);
+                continue;
+            }
+        };
+
+        let mut online_set = HashSet::new();
+        for label_text in media_list {
+            if let Some(media_id) = inventory.find_media_by_label_text(&label_text) {
+                online_set.insert(media_id.label.uuid.clone());
+            }
+        }
+        map.update_online_status(&vtape.name, online_set)?;
+    }
+
+    inventory.update_online_status(&map)?;
+
+    Ok(map)
+}
+
+/// Update online media status with data from a single changer device
+pub fn update_changer_online_status(
+    drive_config: &SectionConfigData,
+    inventory: &mut Inventory,
+    changer_name: &str,
+    label_text_list: &[String],
+) -> Result<(), Error> {
+
+    let mut online_map = OnlineStatusMap::new(drive_config)?;
+    let mut online_set = HashSet::new();
+    for label_text in label_text_list.iter() {
+        if let Some(media_id) = inventory.find_media_by_label_text(&label_text) {
+            online_set.insert(media_id.label.uuid.clone());
+        }
+    }
+    online_map.update_online_status(&changer_name, online_set)?;
+    inventory.update_online_status(&online_map)?;
+
+    Ok(())
+}
index 440edba3e1627d269c986516a790b033050e45c7..84f1d05a5e7173a98999aeafc7154722dc030f32 100644 (file)
@@ -26,17 +26,17 @@ use crate::{
     tape::{
         TapeRead,
         TapeWrite,
-        TapeAlertFlags,
-        Lp17VolumeStatistics,
-        read_mam_attributes,
-        mam_extract_media_usage,
-        read_tape_alert_flags,
-        read_volume_statistics,
-        set_encryption,
         drive::{
+            linux_mtio::*,
             LinuxTapeDrive,
             TapeDriver,
-            linux_mtio::*,
+            TapeAlertFlags,
+            Lp17VolumeStatistics,
+            read_mam_attributes,
+            mam_extract_media_usage,
+            read_tape_alert_flags,
+            read_volume_statistics,
+            set_encryption,
         },
         file_formats::{
             PROXMOX_TAPE_BLOCK_SIZE,
index 5af4297e00fe43ed76a6e11070d8aed2164985cf..ae3da41ab88b4737f5989adc47b85a6c6dae57be 100644 (file)
@@ -10,7 +10,7 @@ use proxmox::tools::io::ReadExt;
 use crate::{
     api2::types::MamAttribute,
     tape::{
-        TapeAlertFlags,
+        drive::TapeAlertFlags,
         sgutils2::SgRaw,
     },
 };
index 8f6f11dae4f4a58a1b22c5c575f11d173d856de2..8c6d31d00c2668dd4d53d7ebdbdcbc1acefa0256 100644 (file)
@@ -1,3 +1,5 @@
+//! Tape drivers
+
 mod virtual_tape;
 mod linux_mtio;
 
@@ -10,7 +12,8 @@ pub use volume_statistics::*;
 mod encryption;
 pub use encryption::*;
 
-pub mod linux_tape;
+mod linux_tape;
+pub use linux_tape::*;
 
 mod mam;
 pub use mam::*;
@@ -44,7 +47,6 @@ use crate::{
         TapeWrite,
         TapeRead,
         MediaId,
-        MtxMediaChanger,
         file_formats::{
             PROXMOX_BACKUP_MEDIA_LABEL_MAGIC_1_0,
             PROXMOX_BACKUP_MEDIA_SET_LABEL_MAGIC_1_0,
@@ -54,6 +56,7 @@ use crate::{
         },
         changer::{
             MediaChange,
+            MtxMediaChanger,
             send_load_media_email,
         },
     },
index 126c8d3ace1b030ad7cd7b158b6684b49d4827e0..218c4f83c76023dedba2214f3b77be68d361fa3b 100644 (file)
@@ -15,10 +15,12 @@ use crate::{
     tape::{
         TapeWrite,
         TapeRead,
-        MtxStatus,
-        DriveStatus,
-        ElementStatus,
-        changer::MediaChange,
+        changer::{
+            MediaChange,
+            MtxStatus,
+            DriveStatus,
+            ElementStatus,
+        },
         drive::{
             VirtualTapeDrive,
             TapeDriver,
index 8babcbf514abd92727069b381a6020810998c9c8..e8855f16f406601f3b356e05f7b80ad82288e4c6 100644 (file)
@@ -31,12 +31,12 @@ use crate::{
     },
     tape::{
         TAPE_STATUS_DIR,
-        OnlineStatusMap,
         MediaSet,
         file_formats::{
             MediaLabel,
             MediaSetLabel,
         },
+        changer::OnlineStatusMap,
     },
 };
 
index 2729eef9179e524a62420ac25ba17dbf0d1188ae..18d86d71550747aaa375d432d2076fe370502e72 100644 (file)
@@ -26,14 +26,9 @@ pub use media_set::*;
 mod inventory;
 pub use inventory::*;
 
-mod changer;
-pub use changer::*;
+pub mod changer;
 
-mod drive;
-pub use drive::*;
-
-mod online_status_map;
-pub use online_status_map::*;
+pub mod drive;
 
 mod media_pool;
 pub use media_pool::*;
diff --git a/src/tape/online_status_map.rs b/src/tape/online_status_map.rs
deleted file mode 100644 (file)
index 5204221..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-use std::path::Path;
-use std::collections::{HashMap, HashSet};
-
-use anyhow::{bail, Error};
-
-use proxmox::tools::Uuid;
-use proxmox::api::section_config::SectionConfigData;
-
-use crate::{
-    api2::types::{
-        VirtualTapeDrive,
-        ScsiTapeChanger,
-    },
-    tape::{
-        MediaChange,
-        Inventory,
-        MtxStatus,
-        ElementStatus,
-        mtx_status,
-    },
-};
-
-/// Helper to update media online status
-///
-/// A tape media is considered online if it is accessible by a changer
-/// device. This class can store the list of available changes,
-/// together with the accessible media ids.
-pub struct OnlineStatusMap {
-    map: HashMap<String, Option<HashSet<Uuid>>>,
-    changer_map: HashMap<Uuid, String>,
-}
-
-impl OnlineStatusMap {
-
-    /// Creates a new instance with one map entry for each configured
-    /// changer (or 'VirtualTapeDrive', which has an internal
-    /// changer). The map entry is set to 'None' to indicate that we
-    /// do not have information about the online status.
-    pub fn new(config: &SectionConfigData) -> Result<Self, Error> {
-
-        let mut map = HashMap::new();
-
-        let changers: Vec<ScsiTapeChanger> = config.convert_to_typed_array("changer")?;
-        for changer in changers {
-            map.insert(changer.name.clone(), None);
-        }
-
-        let vtapes: Vec<VirtualTapeDrive> = config.convert_to_typed_array("virtual")?;
-        for vtape in vtapes {
-            map.insert(vtape.name.clone(), None);
-        }
-
-        Ok(Self { map, changer_map: HashMap::new() })
-    }
-
-    /// Returns the assiciated changer name for a media.
-    pub fn lookup_changer(&self, uuid: &Uuid) -> Option<&String> {
-        self.changer_map.get(uuid)
-    }
-
-    /// Returns the map which assiciates media uuids with changer names.
-    pub fn changer_map(&self) -> &HashMap<Uuid, String> {
-        &self.changer_map
-    }
-
-    /// Returns the set of online media for the specified changer.
-    pub fn online_map(&self, changer_name: &str) -> Option<&Option<HashSet<Uuid>>> {
-        self.map.get(changer_name)
-    }
-
-    /// Update the online set for the specified changer
-    pub fn update_online_status(&mut self, changer_name: &str, online_set: HashSet<Uuid>) -> Result<(), Error> {
-
-        match self.map.get(changer_name) {
-            None => bail!("no such changer '{}' device", changer_name),
-            Some(None) => { /* Ok */ },
-            Some(Some(_)) => {
-                // do not allow updates to keep self.changer_map consistent
-                bail!("update_online_status '{}' called twice", changer_name);
-            }
-        }
-
-        for uuid in online_set.iter() {
-            self.changer_map.insert(uuid.clone(), changer_name.to_string());
-        }
-
-        self.map.insert(changer_name.to_string(), Some(online_set));
-
-        Ok(())
-    }
-}
-
-/// Extract the list of online media from MtxStatus
-///
-/// Returns a HashSet containing all found media Uuid. This only
-/// returns media found in Inventory.
-pub fn mtx_status_to_online_set(status: &MtxStatus, inventory: &Inventory) -> HashSet<Uuid> {
-
-    let mut online_set = HashSet::new();
-
-    for drive_status in status.drives.iter() {
-        if let ElementStatus::VolumeTag(ref label_text) = drive_status.status {
-            if let Some(media_id) = inventory.find_media_by_label_text(label_text) {
-                online_set.insert(media_id.label.uuid.clone());
-            }
-        }
-    }
-
-    for (import_export, slot_status) in status.slots.iter() {
-        if *import_export { continue; }
-        if let ElementStatus::VolumeTag(ref label_text) = slot_status {
-            if let Some(media_id) = inventory.find_media_by_label_text(label_text) {
-                online_set.insert(media_id.label.uuid.clone());
-            }
-        }
-    }
-
-    online_set
-}
-
-/// Update online media status
-///
-/// Simply ask all changer devices.
-pub fn update_online_status(state_path: &Path) -> Result<OnlineStatusMap, Error> {
-
-    let (config, _digest) = crate::config::drive::config()?;
-
-    let mut inventory = Inventory::load(state_path)?;
-
-    let changers: Vec<ScsiTapeChanger> = config.convert_to_typed_array("changer")?;
-
-    let mut map = OnlineStatusMap::new(&config)?;
-
-    for changer in changers {
-        let status = match mtx_status(&changer) {
-            Ok(status) => status,
-            Err(err) => {
-                eprintln!("unable to get changer '{}' status - {}", changer.name, err);
-                continue;
-            }
-        };
-
-        let online_set = mtx_status_to_online_set(&status, &inventory);
-        map.update_online_status(&changer.name, online_set)?;
-    }
-
-    let vtapes: Vec<VirtualTapeDrive> = config.convert_to_typed_array("virtual")?;
-    for mut vtape in vtapes {
-        let media_list = match vtape.online_media_label_texts() {
-            Ok(media_list) => media_list,
-            Err(err) => {
-                eprintln!("unable to get changer '{}' status - {}", vtape.name, err);
-                continue;
-            }
-        };
-
-        let mut online_set = HashSet::new();
-        for label_text in media_list {
-            if let Some(media_id) = inventory.find_media_by_label_text(&label_text) {
-                online_set.insert(media_id.label.uuid.clone());
-            }
-        }
-        map.update_online_status(&vtape.name, online_set)?;
-    }
-
-    inventory.update_online_status(&map)?;
-
-    Ok(map)
-}
-
-/// Update online media status with data from a single changer device
-pub fn update_changer_online_status(
-    drive_config: &SectionConfigData,
-    inventory: &mut Inventory,
-    changer_name: &str,
-    label_text_list: &[String],
-) -> Result<(), Error> {
-
-    let mut online_map = OnlineStatusMap::new(drive_config)?;
-    let mut online_set = HashSet::new();
-    for label_text in label_text_list.iter() {
-        if let Some(media_id) = inventory.find_media_by_label_text(&label_text) {
-            online_set.insert(media_id.label.uuid.clone());
-        }
-    }
-    online_map.update_online_status(&changer_name, online_set)?;
-    inventory.update_online_status(&online_map)?;
-
-    Ok(())
-}
index 075d799e45653fa6beff0cd9af94d82e803b7975..75d64366b1647c0cf46de16965f56d440cd72d04 100644 (file)
@@ -15,7 +15,6 @@ use crate::{
         TAPE_STATUS_DIR,
         MAX_CHUNK_ARCHIVE_SIZE,
         COMMIT_BLOCK_SIZE,
-        TapeDriver,
         TapeWrite,
         ChunkArchiveWriter,
         SnapshotReader,
@@ -25,10 +24,13 @@ use crate::{
         MediaCatalog,
         MediaSetCatalog,
         tape_write_snapshot_archive,
-        request_and_load_media,
-        tape_alert_flags_critical,
-        media_changer,
         file_formats::MediaSetLabel,
+        drive::{
+            TapeDriver,
+            request_and_load_media,
+            tape_alert_flags_critical,
+            media_changer,
+        },
     },
     config::tape_encryption_keys::load_key_configs,
 };