[pve-devel] [PATCH v4 proxmox-backup 09/10] api2: add name of mount-point to DatastoreMountInfo

Hannes Laimer h.laimer at proxmox.com
Tue Sep 15 11:54:19 CEST 2020


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

diff --git a/src/api2/node/disks/directory.rs b/src/api2/node/disks/directory.rs
index 0d9ddeef..38a0ba74 100644
--- a/src/api2/node/disks/directory.rs
+++ b/src/api2/node/disks/directory.rs
@@ -34,6 +34,8 @@ pub struct DatastoreMountInfo {
     pub unitfile: String,
     /// The mount path.
     pub path: String,
+    /// The name of the mount.
+    pub id: String,
     /// The mounted device.
     pub device: String,
     /// File system type
@@ -76,6 +78,7 @@ pub fn  list_datastore_mounts() -> Result<Vec<DatastoreMountInfo>, Error> {
         let item = item?;
         let name = item.file_name().to_string_lossy().to_string();
 
+        let id = MOUNT_NAME_REGEX.captures(&name).unwrap().get(1).unwrap().as_str().to_string();
         let unitfile = format!("{}/{}", basedir, name);
         let config = systemd::config::parse_systemd_mount(&unitfile)?;
         let data: SystemdMountSection = config.lookup("Mount", "Mount")?;
@@ -84,6 +87,7 @@ pub fn  list_datastore_mounts() -> Result<Vec<DatastoreMountInfo>, Error> {
             unitfile,
             device: data.What,
             path: data.Where,
+            id,
             filesystem: data.Type,
             options: data.Options,
         });
-- 
2.20.1






More information about the pve-devel mailing list