[pve-devel] [PATCH proxmox-backup 4/5] api2: DatastoreMountInfo now also contains the name of the mount

Hannes Laimer h.laimer at proxmox.com
Tue Aug 18 10:40:22 CEST 2020


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

diff --git a/src/api2/node/disks/directory.rs b/src/api2/node/disks/directory.rs
index 0d9ddeef..7dbf9a29 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,
+    /// Id of the mount.
+    pub id: String,
     /// The mounted device.
     pub device: String,
     /// File system type
@@ -76,6 +78,8 @@ pub fn  list_datastore_mounts() -> Result<Vec<DatastoreMountInfo>, Error> {
         let item = item?;
         let name = item.file_name().to_string_lossy().to_string();
 
+        let id = String::from(MOUNT_NAME_REGEX.captures(&name).unwrap().get(1).map_or("", |m| m.as_str()));
+
         let unitfile = format!("{}/{}", basedir, name);
         let config = systemd::config::parse_systemd_mount(&unitfile)?;
         let data: SystemdMountSection = config.lookup("Mount", "Mount")?;
@@ -84,6 +88,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