diff --git a/src/api2/types/tape/drive.rs b/src/api2/types/tape/drive.rs index f42e3da0..d1d09ed1 100644 --- a/src/api2/types/tape/drive.rs +++ b/src/api2/types/tape/drive.rs @@ -197,4 +197,11 @@ pub struct LinuxDriveAndMediaStatus { /// Total Bytes Written in Medium Life #[serde(skip_serializing_if="Option::is_none")] pub bytes_written: Option, + /// Number of mounts for the current volume (i.e., Thread Count) + #[serde(skip_serializing_if="Option::is_none")] + pub volume_mounts: Option, + /// Count of the total number of times the medium has passed over + /// the head. + #[serde(skip_serializing_if="Option::is_none")] + pub medium_passes: Option, } diff --git a/src/bin/proxmox-tape.rs b/src/bin/proxmox-tape.rs index 23ea17dc..33d10c47 100644 --- a/src/bin/proxmox-tape.rs +++ b/src/bin/proxmox-tape.rs @@ -598,6 +598,8 @@ fn status( .column(ColumnConfig::new("manufactured").renderer(render_epoch)) .column(ColumnConfig::new("bytes-written").renderer(render_bytes_human_readable)) .column(ColumnConfig::new("bytes-read").renderer(render_bytes_human_readable)) + .column(ColumnConfig::new("medium-passes")) + .column(ColumnConfig::new("volume-mounts")) ; format_and_print_result_full(&mut data, &info.returns, &output_format, &options); diff --git a/src/tape/drive/linux_tape.rs b/src/tape/drive/linux_tape.rs index 1e2187e3..ed088dc2 100644 --- a/src/tape/drive/linux_tape.rs +++ b/src/tape/drive/linux_tape.rs @@ -225,6 +225,8 @@ impl LinuxTapeHandle { manufactured: None, bytes_read: None, bytes_written: None, + medium_passes: None, + volume_mounts: None, }; if drive_status.tape_is_ready() { @@ -237,6 +239,16 @@ impl LinuxTapeHandle { status.bytes_read = Some(usage.bytes_read); status.bytes_written = Some(usage.bytes_written); } + + if let Ok(volume_stats) = self.volume_statistics() { + + status.medium_passes = Some(std::cmp::max( + volume_stats.beginning_of_medium_passes, + volume_stats.middle_of_tape_passes, + )); + + status.volume_mounts = Some(volume_stats.volume_mounts); + } } Ok(status) diff --git a/src/tape/drive/volume_statistics.rs b/src/tape/drive/volume_statistics.rs index 85c2acc0..cf84ea9c 100644 --- a/src/tape/drive/volume_statistics.rs +++ b/src/tape/drive/volume_statistics.rs @@ -60,32 +60,32 @@ struct LpParameterHeader { #[derive(Default, Serialize, Deserialize)] pub struct Lp17VolumeStatistics { - volume_mounts: u64, - volume_datasets_written: u64, - volume_recovered_write_data_errors: u64, - volume_unrecovered_write_data_errors: u64, - volume_write_servo_errors: u64, - volume_unrecovered_write_servo_errors: u64, - volume_datasets_read: u64, - volume_recovered_read_errors: u64, - volume_unrecovered_read_errors: u64, - last_mount_unrecovered_write_errors: u64, - last_mount_unrecovered_read_errors: u64, - last_mount_bytes_written: u64, - last_mount_bytes_read: u64, - lifetime_bytes_written: u64, - lifetime_bytes_read: u64, - last_load_write_compression_ratio: u64, - last_load_read_compression_ratio: u64, - medium_mount_time: u64, - medium_ready_time: u64, - total_native_capacity: u64, - total_used_native_capacity: u64, - write_protect: bool, - worm: bool, - beginning_of_medium_passes: u64, - middle_of_tape_passes: u64, - serial: String, + pub volume_mounts: u64, + pub volume_datasets_written: u64, + pub volume_recovered_write_data_errors: u64, + pub volume_unrecovered_write_data_errors: u64, + pub volume_write_servo_errors: u64, + pub volume_unrecovered_write_servo_errors: u64, + pub volume_datasets_read: u64, + pub volume_recovered_read_errors: u64, + pub volume_unrecovered_read_errors: u64, + pub last_mount_unrecovered_write_errors: u64, + pub last_mount_unrecovered_read_errors: u64, + pub last_mount_bytes_written: u64, + pub last_mount_bytes_read: u64, + pub lifetime_bytes_written: u64, + pub lifetime_bytes_read: u64, + pub last_load_write_compression_ratio: u64, + pub last_load_read_compression_ratio: u64, + pub medium_mount_time: u64, + pub medium_ready_time: u64, + pub total_native_capacity: u64, + pub total_used_native_capacity: u64, + pub write_protect: bool, + pub worm: bool, + pub beginning_of_medium_passes: u64, + pub middle_of_tape_passes: u64, + pub serial: String, } //impl Default for Lp17VolumeStatistics {