[pve-devel] [PATCH storage 06/14] Diskmanage: collect partitions in hash
Fabian Ebner
f.ebner at proxmox.com
Tue Jan 26 12:45:22 CET 2021
Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
PVE/Diskmanage.pm | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/PVE/Diskmanage.pm b/PVE/Diskmanage.pm
index 6d96e77..a06f8ae 100644
--- a/PVE/Diskmanage.pm
+++ b/PVE/Diskmanage.pm
@@ -615,7 +615,6 @@ sub get_disks {
my $db_count = 0;
my $wal_count = 0;
- my $found_partitions;
my $found_lvm;
my $found_mountpoints;
my $found_zfs;
@@ -627,10 +626,15 @@ sub get_disks {
# e.g. from /dev/cciss/c0d0 get /dev/cciss
$partpath =~ s/\/[^\/]+$//;
+ my $partitions = {};
+
dir_glob_foreach("$sysdir", "$dev.+", sub {
my ($part) = @_;
- $found_partitions = 1;
+ $partitions->{$part}->{devpath} = "$partpath/$part";
+ $partitions->{$part}->{gpt} = $data->{gpt};
+ $partitions->{$part}->{size} =
+ get_sysdir_size("$sysdir/$part") // 0;
if (my $mp = $mounted->{"$partpath/$part"}) {
$found_mountpoints = 1;
@@ -674,7 +678,7 @@ sub get_disks {
$used = 'LVM' if $found_lvm && !$used;
$used = 'ZFS' if $found_zfs && !$used;
$used = 'Device Mapper' if $found_dm && !$used;
- $used = 'partitions' if $found_partitions && !$used;
+ $used = 'partitions' if scalar(keys %{$partitions}) && !$used;
# multipath, software raid, etc.
# this check comes in last, to show more specific info
--
2.20.1
More information about the pve-devel
mailing list