mirror of
https://git.proxmox.com/git/proxmox
synced 2025-08-15 10:08:33 +00:00
tape: add functions to parse drive device activity
we use the VHF part from the DT Device Activity page for that. This is intended to query the drive for it's current state and activity. Currently only the activity is parsed and used. Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
8002011f7c
commit
175a9b3cd5
@ -276,3 +276,68 @@ pub struct Lp17VolumeStatistics {
|
|||||||
/// Volume serial number
|
/// Volume serial number
|
||||||
pub serial: String,
|
pub serial: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The DT Device Activity from DT Device Status LP page
|
||||||
|
#[api]
|
||||||
|
#[derive(Copy, Clone, Serialize, Deserialize)]
|
||||||
|
#[serde(rename_all = "kebab-case")]
|
||||||
|
pub enum DeviceActivity {
|
||||||
|
/// No activity
|
||||||
|
NoActivity,
|
||||||
|
/// Cleaning
|
||||||
|
Cleaning,
|
||||||
|
/// Loading
|
||||||
|
Loading,
|
||||||
|
/// Unloading
|
||||||
|
Unloading,
|
||||||
|
/// Other unspecified activity
|
||||||
|
Other,
|
||||||
|
/// Reading
|
||||||
|
Reading,
|
||||||
|
/// Writing
|
||||||
|
Writing,
|
||||||
|
/// Locating
|
||||||
|
Locating,
|
||||||
|
/// Rewinding
|
||||||
|
Rewinding,
|
||||||
|
/// Erasing
|
||||||
|
Erasing,
|
||||||
|
/// Formatting
|
||||||
|
Formatting,
|
||||||
|
/// Calibrating
|
||||||
|
Calibrating,
|
||||||
|
/// Other (DT)
|
||||||
|
OtherDT,
|
||||||
|
/// Updating microcode
|
||||||
|
MicrocodeUpdate,
|
||||||
|
/// Reading encrypted data
|
||||||
|
ReadingEncrypted,
|
||||||
|
/// Writing encrypted data
|
||||||
|
WritingEncrypted,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl TryFrom<u8> for DeviceActivity {
|
||||||
|
type Error = Error;
|
||||||
|
|
||||||
|
fn try_from(value: u8) -> Result<Self, Self::Error> {
|
||||||
|
Ok(match value {
|
||||||
|
0x00 => DeviceActivity::NoActivity,
|
||||||
|
0x01 => DeviceActivity::Cleaning,
|
||||||
|
0x02 => DeviceActivity::Loading,
|
||||||
|
0x03 => DeviceActivity::Unloading,
|
||||||
|
0x04 => DeviceActivity::Other,
|
||||||
|
0x05 => DeviceActivity::Reading,
|
||||||
|
0x06 => DeviceActivity::Writing,
|
||||||
|
0x07 => DeviceActivity::Locating,
|
||||||
|
0x08 => DeviceActivity::Rewinding,
|
||||||
|
0x09 => DeviceActivity::Erasing,
|
||||||
|
0x0A => DeviceActivity::Formatting,
|
||||||
|
0x0B => DeviceActivity::Calibrating,
|
||||||
|
0x0C => DeviceActivity::OtherDT,
|
||||||
|
0x0D => DeviceActivity::MicrocodeUpdate,
|
||||||
|
0x0E => DeviceActivity::ReadingEncrypted,
|
||||||
|
0x0F => DeviceActivity::WritingEncrypted,
|
||||||
|
other => bail!("invalid DT device activity value: {:x}", other),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user