[pbs-devel] [PATCH proxmox-backup v8 22/23] api: node: include removable datastores in directory list

Hannes Laimer h.laimer at proxmox.com
Fri Apr 19 17:56:05 CEST 2024


Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
---
 src/api2/node/disks/directory.rs | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/api2/node/disks/directory.rs b/src/api2/node/disks/directory.rs
index a34ed676..1b0473ed 100644
--- a/src/api2/node/disks/directory.rs
+++ b/src/api2/node/disks/directory.rs
@@ -59,7 +59,7 @@ pub struct DatastoreMountInfo {
         }
     },
     returns: {
-        description: "List of systemd datastore mount units.",
+        description: "List of removable-datastore devices and systemd datastore mount units.",
         type: Array,
         items: {
             type: DatastoreMountInfo,
@@ -102,6 +102,26 @@ pub fn list_datastore_mounts() -> Result<Vec<DatastoreMountInfo>, Error> {
         });
     }
 
+    let (config, _digest) = pbs_config::datastore::config()?;
+    let store_list: Vec<DataStoreConfig> = config.convert_to_typed_array("datastore")?;
+
+    for item in store_list
+        .into_iter()
+        .filter(|store| store.backing_device.is_some())
+    {
+        list.push(DatastoreMountInfo {
+            unitfile: "datastore config".to_string(),
+            name: item.name,
+            device: format!(
+                "/dev/disk/by-uuid/{}",
+                item.backing_device.unwrap_or("none".to_string())
+            ),
+            path: item.path,
+            filesystem: None,
+            options: None,
+        });
+    }
+
     Ok(list)
 }
 
-- 
2.39.2





More information about the pbs-devel mailing list