/// Estimated tape wearout factor (assuming max. 16000 end-to-end passes)
#[serde(skip_serializing_if = "Option::is_none")]
pub medium_wearout: Option<f64>,
+ /// Current device activity
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub drive_activity: Option<DeviceActivity>,
}
#[api()]
use proxmox_sys::error::SysResult;
use pbs_api_types::{
- Lp17VolumeStatistics, LtoDriveAndMediaStatus, LtoTapeDrive, MamAttribute, TapeDensity,
+ DeviceActivity, Lp17VolumeStatistics, LtoDriveAndMediaStatus, LtoTapeDrive, MamAttribute,
+ TapeDensity,
};
use crate::linux_list_drives::open_lto_tape_device;
pub fn get_drive_and_media_status(&mut self) -> Result<LtoDriveAndMediaStatus, Error> {
let drive_status = self.read_drive_status()?;
+ let drive_activity = read_device_activity(&mut self.file).ok();
let alert_flags = self
.tape_alert_flags()
.map(|flags| format!("{:?}", flags))
medium_passes: None,
medium_wearout: None,
volume_mounts: None,
+ drive_activity,
};
if self.test_unit_ready().is_ok() {
if (key === 'bytes-read' || key === 'bytes-written') {
val = Proxmox.Utils.format_size(val);
}
+ if (key === 'drive-activity') {
+ val = PBS.Utils.renderDriveActivity(val);
+ }
list.push({ key: key, value: val });
}
}).show();
},
+ tapeDriveActivities: {
+ 'no-activity': gettext('No Activity'),
+ 'cleaning': gettext('Cleaning'),
+ 'loading': gettext('Loading'),
+ 'unloading': gettext('Unloading'),
+ 'other': gettext('Other Activity'),
+ 'reading': gettext('Reading data'),
+ 'writing': gettext('Writing data'),
+ 'locating': gettext('Locating'),
+ 'rewinding': gettext('Rewinding'),
+ 'erasing': gettext('Erasing'),
+ 'formatting': gettext('Formatting'),
+ 'calibrating': gettext('Calibrating'),
+ 'other-dt': gettext('Other DT Activity'),
+ 'microcode-update': gettext('Updating Microcode'),
+ 'reading-encrypted': gettext('Reading encrypted data'),
+ 'writing-encrypted': gettext('Writing encrypted data'),
+ },
+
+ renderDriveActivity: function(value) {
+ if (!value) {
+ return Proxmox.Utils.unknownText;
+ }
+ return PBS.Utils.tapeDriveActivities[value] ?? value;
+ },
+
renderDriveState: function(value, md) {
if (!value) {
return gettext('Idle');
header: gettext('Compression'),
renderer: Proxmox.Utils.format_boolean,
},
+ 'drive-activity': {
+ header: gettext('Drive Activity'),
+ renderer: PBS.Utils.renderDriveActivity,
+ },
'file-number': {
header: gettext('Tape Position'),
renderer: function(value, mD, r, rI, cI, store) {