public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup 1/2] api2/tape/drive: add missing locks for some drive actions
@ 2021-02-08 10:10 Dominik Csapak
  2021-02-08 10:10 ` [pbs-devel] [PATCH proxmox-backup 2/2] ui: tape/window/LabelMedia: change to POST Dominik Csapak
  2021-02-09  7:46 ` [pbs-devel] applied: [PATCH proxmox-backup 1/2] api2/tape/drive: add missing locks for some drive actions Dietmar Maurer
  0 siblings, 2 replies; 3+ messages in thread
From: Dominik Csapak @ 2021-02-08 10:10 UTC (permalink / raw)
  To: pbs-devel

else a backup/restore can easily be disrupted

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/api2/tape/drive.rs | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/api2/tape/drive.rs b/src/api2/tape/drive.rs
index 29321601..76f15df5 100644
--- a/src/api2/tape/drive.rs
+++ b/src/api2/tape/drive.rs
@@ -84,8 +84,11 @@ use crate::{
 pub async fn load_media(drive: String, label_text: String) -> Result<(), Error> {
 
     let (config, _digest) = config::drive::config()?;
+    let lock_guard = lock_tape_device(&config, &drive)?;
 
     tokio::task::spawn_blocking(move || {
+        let _lock_guard = lock_guard; // keep lock guard
+
         let (mut changer, _) = required_media_changer(&config, &drive)?;
         changer.load_media(&label_text)
     }).await?
@@ -110,8 +113,11 @@ pub async fn load_media(drive: String, label_text: String) -> Result<(), Error>
 pub async fn load_slot(drive: String, source_slot: u64) -> Result<(), Error> {
 
     let (config, _digest) = config::drive::config()?;
+    let lock_guard = lock_tape_device(&config, &drive)?;
 
     tokio::task::spawn_blocking(move || {
+        let _lock_guard = lock_guard; // keep lock guard
+
         let (mut changer, _) = required_media_changer(&config, &drive)?;
         changer.load_media_from_slot(source_slot)
     }).await?
@@ -138,8 +144,11 @@ pub async fn load_slot(drive: String, source_slot: u64) -> Result<(), Error> {
 pub async fn export_media(drive: String, label_text: String) -> Result<u64, Error> {
 
     let (config, _digest) = config::drive::config()?;
+    let lock_guard = lock_tape_device(&config, &drive)?;
 
     tokio::task::spawn_blocking(move || {
+        let _lock_guard = lock_guard; // keep lock guard
+
         let (mut changer, changer_name) = required_media_changer(&config, &drive)?;
         match changer.export_media(&label_text)? {
             Some(slot) => Ok(slot),
@@ -170,8 +179,11 @@ pub async fn unload(
 ) -> Result<(), Error> {
 
     let (config, _digest) = config::drive::config()?;
+    let lock_guard = lock_tape_device(&config, &drive)?;
 
     tokio::task::spawn_blocking(move || {
+        let _lock_guard = lock_guard; // keep lock guard
+
         let (mut changer, _) = required_media_changer(&config, &drive)?;
         changer.unload_media(target_slot)
     }).await?
-- 
2.20.1





^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pbs-devel] [PATCH proxmox-backup 2/2] ui: tape/window/LabelMedia: change to POST
  2021-02-08 10:10 [pbs-devel] [PATCH proxmox-backup 1/2] api2/tape/drive: add missing locks for some drive actions Dominik Csapak
@ 2021-02-08 10:10 ` Dominik Csapak
  2021-02-09  7:46 ` [pbs-devel] applied: [PATCH proxmox-backup 1/2] api2/tape/drive: add missing locks for some drive actions Dietmar Maurer
  1 sibling, 0 replies; 3+ messages in thread
From: Dominik Csapak @ 2021-02-08 10:10 UTC (permalink / raw)
  To: pbs-devel

this changed in the backend

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/tape/window/LabelMedia.js | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/www/tape/window/LabelMedia.js b/www/tape/window/LabelMedia.js
index ec7fca5d..563f59f0 100644
--- a/www/tape/window/LabelMedia.js
+++ b/www/tape/window/LabelMedia.js
@@ -8,6 +8,8 @@ Ext.define('PBS.TapeManagement.LabelMediaWindow', {
     title: gettext('Label Media'),
     submitText: gettext('OK'),
 
+    method: 'POST',
+
     showProgress: true,
 
     items: [
-- 
2.20.1





^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pbs-devel] applied: [PATCH proxmox-backup 1/2] api2/tape/drive: add missing locks for some drive actions
  2021-02-08 10:10 [pbs-devel] [PATCH proxmox-backup 1/2] api2/tape/drive: add missing locks for some drive actions Dominik Csapak
  2021-02-08 10:10 ` [pbs-devel] [PATCH proxmox-backup 2/2] ui: tape/window/LabelMedia: change to POST Dominik Csapak
@ 2021-02-09  7:46 ` Dietmar Maurer
  1 sibling, 0 replies; 3+ messages in thread
From: Dietmar Maurer @ 2021-02-09  7:46 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Dominik Csapak

applied both patches




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-09  7:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-08 10:10 [pbs-devel] [PATCH proxmox-backup 1/2] api2/tape/drive: add missing locks for some drive actions Dominik Csapak
2021-02-08 10:10 ` [pbs-devel] [PATCH proxmox-backup 2/2] ui: tape/window/LabelMedia: change to POST Dominik Csapak
2021-02-09  7:46 ` [pbs-devel] applied: [PATCH proxmox-backup 1/2] api2/tape/drive: add missing locks for some drive actions Dietmar Maurer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal