[pbs-devel] [PATCH] api: removable datastore: downgrade device already mounted error to info

Aaron Lauterer a.lauterer at proxmox.com
Wed Nov 27 11:42:35 CET 2024


pbs-datastore::datastore::is_datastore_mounted_at() verifies that the
mounted file system has the expected UUID. Therefore we don't have to
error out if we try to mount an already mounted removable datastore.

Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---
 src/api2/admin/datastore.rs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs
index cae7eb89..3f794e83 100644
--- a/src/api2/admin/datastore.rs
+++ b/src/api2/admin/datastore.rs
@@ -2448,10 +2448,11 @@ fn setup_mounted_device(datastore: &DataStoreConfig, tmp_mount_path: &str) -> Re
 pub fn do_mount_device(datastore: DataStoreConfig) -> Result<(), Error> {
     if let Some(uuid) = datastore.backing_device.as_ref() {
         if pbs_datastore::get_datastore_mount_status(&datastore) == Some(true) {
-            bail!(
+            info!(
                 "device is already mounted at '{}'",
                 datastore.absolute_path()
             );
+            return Ok(());
         }
         let tmp_mount_path = format!(
             "{}/{:x}",
-- 
2.39.5





More information about the pbs-devel mailing list