api: disks/directory: add 'name' property to list of mounts
so that we actually have the property that 'match_all' refers to for the templated API path. This is mostly for improving usage of the WIP pbs-shell, i.e., its `ls` command, it has no other functional/semantic impact. Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
2de1b06a06
commit
8eef31724f
@ -35,6 +35,8 @@ const BASE_MOUNT_DIR: &str = "/mnt/datastore/";
|
||||
pub struct DatastoreMountInfo {
|
||||
/// The path of the mount unit.
|
||||
pub unitfile: String,
|
||||
/// The name of the mount
|
||||
pub name: String,
|
||||
/// The mount path.
|
||||
pub path: String,
|
||||
/// The mounted device.
|
||||
@ -83,8 +85,15 @@ pub fn list_datastore_mounts() -> Result<Vec<DatastoreMountInfo>, Error> {
|
||||
let config = systemd::config::parse_systemd_mount(&unitfile)?;
|
||||
let data: SystemdMountSection = config.lookup("Mount", "Mount")?;
|
||||
|
||||
let name = data
|
||||
.Where
|
||||
.strip_prefix(BASE_MOUNT_DIR)
|
||||
.unwrap_or_else(|| &data.Where)
|
||||
.to_string();
|
||||
|
||||
list.push(DatastoreMountInfo {
|
||||
unitfile,
|
||||
name,
|
||||
device: data.What,
|
||||
path: data.Where,
|
||||
filesystem: data.Type,
|
||||
|
Loading…
Reference in New Issue
Block a user