[pve-devel] [PATCH storage v2 1/3] diskmanage: add mounted_paths

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Aug 17 13:35:05 CEST 2022


On July 15, 2022 1:58 pm, Aaron Lauterer wrote:
> returns a list of mounted paths with the backing devices
> 
> Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
> ---
> changes since v1: dropped limit to /dev path, returning all mounted
> paths now
> 
>  PVE/Diskmanage.pm | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/PVE/Diskmanage.pm b/PVE/Diskmanage.pm
> index 8ed7a8b..b149685 100644
> --- a/PVE/Diskmanage.pm
> +++ b/PVE/Diskmanage.pm
> @@ -499,6 +499,18 @@ sub mounted_blockdevs {
>      return $mounted;
>  }
>  

nit: a short comment here telling us about the returned data might be 
helpful - else I have to look at parse_proc_mounts or guess what the key 
and what the value represent..

> +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 = {};
> -- 
> 2.30.2
> 
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 





More information about the pve-devel mailing list