From 4de6002558a6c7f9366fd61c7cecb31a6de78721 Mon Sep 17 00:00:00 2001 From: Aaron Lauterer Date: Fri, 19 Aug 2022 17:01:19 +0200 Subject: [PATCH] diskmanage: add mounted_paths returns a list of mounted paths with the backing devices Signed-off-by: Aaron Lauterer Reviewed-by: Dominik Csapak Tested-by: Dominik Csapak --- PVE/Diskmanage.pm | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/PVE/Diskmanage.pm b/PVE/Diskmanage.pm index 8ed7a8b..81df67f 100644 --- a/PVE/Diskmanage.pm +++ b/PVE/Diskmanage.pm @@ -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 = {};