]> git.proxmox.com Git - pve-storage.git/commitdiff
diskmanage: add mounted_paths
authorAaron Lauterer <a.lauterer@proxmox.com>
Fri, 19 Aug 2022 15:01:19 +0000 (17:01 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Tue, 13 Sep 2022 08:04:48 +0000 (10:04 +0200)
returns a list of mounted paths with the backing devices

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
PVE/Diskmanage.pm

index 8ed7a8b8e790dd9e1e7b4396eb4b246add12fc3c..81df67f9b20350b7e57c58769d5048a4207552d7 100644 (file)
@@ -499,6 +499,19 @@ sub mounted_blockdevs {
     return $mounted;
 }
 
+# returns hashmap of abs mount path -> first part of /proc/mounts (what)
+sub mounted_paths {
+    my $mounted = {};
+
+    my $mounts = PVE::ProcFSTools::parse_proc_mounts();
+
+    foreach my $mount (@$mounts) {
+       $mounted->{abs_path($mount->[1])} = $mount->[0];
+    };
+
+    return $mounted;
+}
+
 sub get_disks {
     my ($disks, $nosmart, $include_partitions) = @_;
     my $disklist = {};