From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 2/4] tape: add drive activity to drive status api
Date: Mon, 13 May 2024 12:49:24 +0200 [thread overview]
Message-ID: <20240513104926.3113394-3-d.csapak@proxmox.com> (raw)
In-Reply-To: <20240513104926.3113394-1-d.csapak@proxmox.com>
and show it in the gui for single drives. Adds the known values for the
activity to the UI.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
pbs-api-types/src/tape/drive.rs | 3 +++
pbs-tape/src/sg_tape.rs | 5 ++++-
www/Utils.js | 29 +++++++++++++++++++++++++++++
www/tape/DriveStatus.js | 4 ++++
4 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/pbs-api-types/src/tape/drive.rs b/pbs-api-types/src/tape/drive.rs
index de569980a..caa6b3b3e 100644
--- a/pbs-api-types/src/tape/drive.rs
+++ b/pbs-api-types/src/tape/drive.rs
@@ -216,6 +216,9 @@ pub struct LtoDriveAndMediaStatus {
/// 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()]
diff --git a/pbs-tape/src/sg_tape.rs b/pbs-tape/src/sg_tape.rs
index 85be6b071..d185dd1ac 100644
--- a/pbs-tape/src/sg_tape.rs
+++ b/pbs-tape/src/sg_tape.rs
@@ -31,7 +31,8 @@ use proxmox_io::{ReadExt, WriteExt};
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;
@@ -960,6 +961,7 @@ impl SgTape {
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))
@@ -983,6 +985,7 @@ impl SgTape {
medium_passes: None,
medium_wearout: None,
volume_mounts: None,
+ drive_activity,
};
if self.test_unit_ready().is_ok() {
diff --git a/www/Utils.js b/www/Utils.js
index 1d7351a32..df03a4c87 100644
--- a/www/Utils.js
+++ b/www/Utils.js
@@ -659,6 +659,9 @@ Ext.define('PBS.Utils', {
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 });
}
@@ -692,6 +695,32 @@ Ext.define('PBS.Utils', {
}).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');
diff --git a/www/tape/DriveStatus.js b/www/tape/DriveStatus.js
index 2c55fc97f..a392202ca 100644
--- a/www/tape/DriveStatus.js
+++ b/www/tape/DriveStatus.js
@@ -348,6 +348,10 @@ Ext.define('PBS.TapeManagement.DriveStatusGrid', {
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) {
--
2.39.2
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
next prev parent reply other threads:[~2024-05-13 10:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-13 10:49 [pbs-devel] [PATCH proxmox-backup 0/4] tape: improve UX by showing device activity Dominik Csapak
2024-05-13 10:49 ` [pbs-devel] [PATCH proxmox-backup 1/4] tape: add functions to parse drive " Dominik Csapak
2024-05-13 10:49 ` Dominik Csapak [this message]
2024-05-13 10:49 ` [pbs-devel] [PATCH proxmox-backup 3/4] tape: drive status: make some depend on the activity Dominik Csapak
2024-05-13 10:49 ` [pbs-devel] [PATCH proxmox-backup 4/4] tape: include drive activity in status Dominik Csapak
2024-05-14 8:32 ` [pbs-devel] applied: [PATCH proxmox-backup 0/4] tape: improve UX by showing device activity Dietmar Maurer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240513104926.3113394-3-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox