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

Aaron Lauterer a.lauterer at proxmox.com
Thu Jul 14 13:37:13 CEST 2022



On 7/14/22 13:13, Dominik Csapak wrote:
> comment inline
> 
> On 7/13/22 12:47, Aaron Lauterer wrote:
>> returns similar values as mounted_blockdevs, but uses the mounted path
>> as key and the blockdev path as value
>>
>> Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
>> ---
>> used for the Directory check in patch 2
>>
>>   PVE/Diskmanage.pm | 13 +++++++++++++
>>   1 file changed, 13 insertions(+)
>>
>> diff --git a/PVE/Diskmanage.pm b/PVE/Diskmanage.pm
>> index 8ed7a8b..c5c20de 100644
>> --- a/PVE/Diskmanage.pm
>> +++ b/PVE/Diskmanage.pm
>> @@ -499,6 +499,19 @@ sub mounted_blockdevs {
>>       return $mounted;
>>   }
>> +sub mounted_paths {
>> +    my $mounted = {};
>> +
>> +    my $mounts = PVE::ProcFSTools::parse_proc_mounts();
>> +
>> +    foreach my $mount (@$mounts) {
>> +    next if $mount->[0] !~ m|^/dev/|;
> 
> does it really make sense here to filter by /dev/ ?
> for 'mounted_blockdevs' it makes sense since we want to have
> the mounted 'block devices' but here we talk about 'paths'
> and /sys,/proc, etc are paths too, so you could simply omit that check

Good point.
> 
>> +    $mounted->{abs_path($mount->[1])} = $mount->[0];
>> +    };
>> +
>> +    return $mounted;
>> +}
>> +
>>   sub get_disks {
>>       my ($disks, $nosmart, $include_partitions) = @_;
>>       my $disklist = {};





More information about the pve-devel mailing list