mirror of
https://git.proxmox.com/git/proxmox-backup
synced 2025-08-15 04:51:00 +00:00
tape: drive status: make some depend on the activity
when the tape drive has an activity (and the tape is in motion), certain calls block until the operation is finished. Since we cannot predict how long it's going to be and it can be quite long in certain cases, skip those calls when the drive is doing anything. If we cannot determine the activity, try to do the queries. We have to extend the check for a loaded drive in the UI, since the position is not available during any activity. Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
1d6b1e0258
commit
4ebb08a5f0
@ -962,10 +962,18 @@ impl SgTape {
|
|||||||
let drive_status = self.read_drive_status()?;
|
let drive_status = self.read_drive_status()?;
|
||||||
|
|
||||||
let drive_activity = read_device_activity(&mut self.file).ok();
|
let drive_activity = read_device_activity(&mut self.file).ok();
|
||||||
let alert_flags = self
|
|
||||||
.tape_alert_flags()
|
// some operations block when the tape moves, which can take up to 2 hours
|
||||||
|
// (e.g. for calibrating) so skip those queries while it's doing that
|
||||||
|
let is_moving = !matches!(drive_activity, None | Some(DeviceActivity::NoActivity));
|
||||||
|
|
||||||
|
let alert_flags = if !is_moving {
|
||||||
|
self.tape_alert_flags()
|
||||||
.map(|flags| format!("{:?}", flags))
|
.map(|flags| format!("{:?}", flags))
|
||||||
.ok();
|
.ok()
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
let mut status = LtoDriveAndMediaStatus {
|
let mut status = LtoDriveAndMediaStatus {
|
||||||
vendor: self.info().vendor.clone(),
|
vendor: self.info().vendor.clone(),
|
||||||
@ -993,10 +1001,12 @@ impl SgTape {
|
|||||||
status.write_protect = Some(drive_status.write_protect);
|
status.write_protect = Some(drive_status.write_protect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !is_moving {
|
||||||
let position = self.position()?;
|
let position = self.position()?;
|
||||||
|
|
||||||
status.file_number = Some(position.logical_file_id);
|
status.file_number = Some(position.logical_file_id);
|
||||||
status.block_number = Some(position.logical_object_number);
|
status.block_number = Some(position.logical_object_number);
|
||||||
|
}
|
||||||
|
|
||||||
if let Ok(mam) = self.cartridge_memory() {
|
if let Ok(mam) = self.cartridge_memory() {
|
||||||
match mam_extract_media_usage(&mam) {
|
match mam_extract_media_usage(&mam) {
|
||||||
@ -1010,6 +1020,7 @@ impl SgTape {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !is_moving {
|
||||||
if let Ok(volume_stats) = self.volume_statistics() {
|
if let Ok(volume_stats) = self.volume_statistics() {
|
||||||
let passes = std::cmp::max(
|
let passes = std::cmp::max(
|
||||||
volume_stats.beginning_of_medium_passes,
|
volume_stats.beginning_of_medium_passes,
|
||||||
@ -1027,6 +1038,7 @@ impl SgTape {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Ok(status)
|
Ok(status)
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ Ext.define('PBS.TapeManagement.DriveStatus', {
|
|||||||
onLoad: function() {
|
onLoad: function() {
|
||||||
let me = this;
|
let me = this;
|
||||||
let statusgrid = me.lookup('statusgrid');
|
let statusgrid = me.lookup('statusgrid');
|
||||||
let online = statusgrid.getObjectValue('file-number') !== undefined;
|
let online = statusgrid.getObjectValue('file-number') !== undefined || statusgrid.getObjectValue('manufactured');
|
||||||
let vm = me.getViewModel();
|
let vm = me.getViewModel();
|
||||||
vm.set('online', online);
|
vm.set('online', online);
|
||||||
let title = online ? gettext('Status') : gettext('Status (No Tape loaded)');
|
let title = online ? gettext('Status') : gettext('Status (No Tape loaded)');
|
||||||
|
Loading…
Reference in New Issue
Block a user