tape: add volume_mounts and medium_passes to LinuxDriveAndMediaStatus

This commit is contained in:
Dietmar Maurer 2021-01-05 13:43:17 +01:00
parent f8ccbfdedd
commit b40ab10d38
4 changed files with 47 additions and 26 deletions

View File

@ -197,4 +197,11 @@ pub struct LinuxDriveAndMediaStatus {
/// Total Bytes Written in Medium Life
#[serde(skip_serializing_if="Option::is_none")]
pub bytes_written: Option<u64>,
/// Number of mounts for the current volume (i.e., Thread Count)
#[serde(skip_serializing_if="Option::is_none")]
pub volume_mounts: Option<u64>,
/// 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<u64>,
}

View File

@ -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);

View File

@ -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)

View File

@ -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 {