Add alloc_ct for LVM VG when missing

This commit is contained in:
Daniel Berteaud 2022-01-21 13:46:06 +01:00
parent 849170c10b
commit 5afabbfaad
1 changed files with 4 additions and 0 deletions

View File

@ -43,6 +43,10 @@ EOF
my $json;
if (defined $vg){
%{$json} = get_volume_group_information($vg);
# Depending on LVM version, alloc_ct might not be present
if (not defined $json->{alloc_ct}){
$json->{alloc_ct} = sprintf("%.1f", 100 * $json->{alloc_pe_size} / $json->{vg_size});
}
} elsif (defined $lv) {
%{$json} = get_lv_info($lv);
} else{