tape: implement load-media command

This commit is contained in:
Dietmar Maurer
2020-12-10 07:52:56 +01:00
parent 0098b712a5
commit e49f0c03d9
3 changed files with 81 additions and 0 deletions

View File

@ -8,6 +8,7 @@ use crate::{
config,
api2::types::{
DRIVE_ID_SCHEMA,
MEDIA_LABEL_SCHEMA,
LinuxTapeDrive,
ScsiTapeChanger,
TapeDeviceInfo,
@ -56,6 +57,32 @@ pub fn load_slot(
mtx_load(&changer.path, slot, drivenum)
}
#[api(
input: {
properties: {
drive: {
schema: DRIVE_ID_SCHEMA,
},
"changer-id": {
schema: MEDIA_LABEL_SCHEMA,
},
},
},
)]
/// Load media with specified label
///
/// Issue a media load request to the associated changer device.
pub fn load_media(drive: String, changer_id: String) -> Result<(), Error> {
let (config, _digest) = config::drive::config()?;
let (mut changer, _) = media_changer(&config, &drive, false)?;
changer.load_media(&changer_id)?;
Ok(())
}
#[api(
input: {
properties: {