tape: add volume-statistics api/command
This commit is contained in:
@ -55,6 +55,7 @@ use crate::{
|
||||
drive::{
|
||||
TapeDriver,
|
||||
LinuxTapeHandle,
|
||||
Lp17VolumeStatistics,
|
||||
open_linux_tape_device,
|
||||
media_changer,
|
||||
required_media_changer,
|
||||
@ -934,6 +935,29 @@ pub fn cartridge_memory(drive: String) -> Result<Vec<MamAttribute>, Error> {
|
||||
handle.cartridge_memory()
|
||||
}
|
||||
|
||||
#[api(
|
||||
input: {
|
||||
properties: {
|
||||
drive: {
|
||||
schema: DRIVE_NAME_SCHEMA,
|
||||
},
|
||||
},
|
||||
},
|
||||
returns: {
|
||||
type: Lp17VolumeStatistics,
|
||||
},
|
||||
)]
|
||||
/// Read Volume Statistics (SCSI log page 17h)
|
||||
pub fn volume_statistics(drive: String) -> Result<Lp17VolumeStatistics, Error> {
|
||||
|
||||
let (config, _digest) = config::drive::config()?;
|
||||
|
||||
let drive_config: LinuxTapeDrive = config.lookup("linux", &drive)?;
|
||||
let mut handle = drive_config.open()?;
|
||||
|
||||
handle.volume_statistics()
|
||||
}
|
||||
|
||||
#[api(
|
||||
input: {
|
||||
properties: {
|
||||
@ -1120,6 +1144,11 @@ pub const SUBDIRS: SubdirMap = &sorted!([
|
||||
&Router::new()
|
||||
.put(&API_METHOD_CARTRIDGE_MEMORY)
|
||||
),
|
||||
(
|
||||
"volume-statistics",
|
||||
&Router::new()
|
||||
.put(&API_METHOD_VOLUME_STATISTICS)
|
||||
),
|
||||
(
|
||||
"read-label",
|
||||
&Router::new()
|
||||
|
Reference in New Issue
Block a user