Diskmanage: also check for filesystem type when determining usage

Like this, a non-ZFS filesystem living on a whole disk will also be detected
when it is not mounted.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fabian Ebner
2021-01-26 12:45:20 +01:00
committed by Thomas Lamprecht
parent b6bbc2ab28
commit 59c03cd970
8 changed files with 50 additions and 5 deletions

View File

@ -157,7 +157,7 @@ sub get_smart_data {
}
sub get_lsblk_info() {
my $cmd = [$LSBLK, '--json', '-o', 'path,parttype'];
my $cmd = [$LSBLK, '--json', '-o', 'path,parttype,fstype'];
my $output = "";
my $res = {};
eval {
@ -174,7 +174,10 @@ sub get_lsblk_info() {
my $list = $parsed->{blockdevices} // [];
$res = { map {
$_->{path} => { parttype => $_->{parttype} }
$_->{path} => {
parttype => $_->{parttype},
fstype => $_->{fstype}
}
} @{$list} };
return $res;
@ -564,6 +567,14 @@ sub get_disks {
$used = 'ZFS' if $zfshash->{$devpath};
if (defined($lsblk_info->{$devpath})) {
my $fstype = $lsblk_info->{$devpath}->{fstype};
if (defined($fstype)) {
$used = $fstype;
$used .= ' (mounted)' if $mounted->{$devpath};
}
}
# we replaced cciss/ with cciss! above
# but in the result we need cciss/ again
# because the caller might want to check the