tape: update changer status cache after load/unload
This commit is contained in:
parent
cd44fb8d84
commit
cbd9899389
@ -162,7 +162,9 @@ pub async fn transfer(
|
||||
let mut changer_config: ScsiTapeChanger = config.lookup("changer", &name)?;
|
||||
|
||||
tokio::task::spawn_blocking(move || {
|
||||
changer_config.transfer(from, to)
|
||||
changer_config.transfer(from, to)?;
|
||||
let _ = changer_config.status(false); // update status cache
|
||||
Ok(())
|
||||
}).await?
|
||||
}
|
||||
|
||||
|
@ -156,6 +156,8 @@ pub fn load_media(
|
||||
let (mut changer, _) = required_media_changer(&config, &drive)?;
|
||||
changer.load_media(&label_text)?;
|
||||
|
||||
let _ = changer.status(); // update status cache
|
||||
|
||||
Ok(())
|
||||
},
|
||||
)?;
|
||||
@ -261,6 +263,9 @@ pub fn unload(
|
||||
|
||||
let (mut changer, _) = required_media_changer(&config, &drive)?;
|
||||
changer.unload_media(target_slot)?;
|
||||
|
||||
let _ = changer.status(); // update status cache
|
||||
|
||||
Ok(())
|
||||
},
|
||||
)?;
|
||||
@ -419,6 +424,7 @@ pub fn eject_media(
|
||||
move |_worker, config| {
|
||||
if let Some((mut changer, _)) = media_changer(&config, &drive)? {
|
||||
changer.unload_media(None)?;
|
||||
let _ = changer.status(); // update status cache
|
||||
} else {
|
||||
let mut drive = open_drive(&config, &drive)?;
|
||||
drive.eject_media()?;
|
||||
@ -861,6 +867,8 @@ pub fn update_inventory(
|
||||
continue;
|
||||
}
|
||||
|
||||
let _ = changer.status(); // update status cache
|
||||
|
||||
let mut drive = open_drive(&config, &drive)?;
|
||||
match drive.read_label() {
|
||||
Err(err) => {
|
||||
@ -879,6 +887,7 @@ pub fn update_inventory(
|
||||
}
|
||||
}
|
||||
changer.unload_media(None)?;
|
||||
let _ = changer.status(); // update status cache
|
||||
}
|
||||
Ok(())
|
||||
},
|
||||
|
@ -395,7 +395,15 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
|
||||
}).show();
|
||||
},
|
||||
|
||||
reload: async function() {
|
||||
reload: function() {
|
||||
this.reload_full(true);
|
||||
},
|
||||
|
||||
reload_no_cache: function() {
|
||||
this.reload_full(false);
|
||||
},
|
||||
|
||||
reload_full: async function(use_cache) {
|
||||
let me = this;
|
||||
let view = me.getView();
|
||||
let vm = me.getViewModel();
|
||||
@ -409,7 +417,11 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
|
||||
Proxmox.Utils.setErrorMask(me.lookup('content'));
|
||||
let status_fut = PBS.Async.api2({
|
||||
timeout: 5*60*1000,
|
||||
method: 'GET',
|
||||
url: `/api2/extjs/tape/changer/${encodeURIComponent(changer)}/status`,
|
||||
params: {
|
||||
cache: use_cache,
|
||||
},
|
||||
});
|
||||
let drives_fut = PBS.Async.api2({
|
||||
timeout: 5*60*1000,
|
||||
@ -554,7 +566,7 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
|
||||
{
|
||||
text: gettext('Reload'),
|
||||
xtype: 'proxmoxButton',
|
||||
handler: 'reload',
|
||||
handler: 'reload_no_cache',
|
||||
selModel: false,
|
||||
},
|
||||
'-',
|
||||
|
Loading…
Reference in New Issue
Block a user