api2: disks: add mounted boolean field

... and remove '(mounted)' from usage string

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
This commit is contained in:
Hannes Laimer
2022-06-08 07:09:59 +00:00
committed by Wolfgang Bumiller
parent a1528ffe8f
commit 76c98d2353
2 changed files with 4 additions and 4 deletions

View File

@ -125,6 +125,7 @@ __PACKAGE__->register_method ({
},
used => { type => 'string', optional => 1 },
gpt => { type => 'boolean' },
mounted => { type => 'boolean' },
size => { type => 'integer'},
osdid => { type => 'integer'},
vendor => { type => 'string', optional => 1 },

View File

@ -605,6 +605,7 @@ sub get_disks {
size => $sysdata->{size},
serial => $data->{serial},
gpt => $data->{gpt},
mounted => exists $mounted->{$devpath},
rpm => $data->{rpm},
type => $type,
wwn => $data->{wwn},
@ -650,10 +651,7 @@ sub get_disks {
}
my $fstype = $info->{fstype};
if (defined($fstype)) {
return "${fstype} (mounted)" if $mounted->{$devpath};
return "${fstype}";
}
return "${fstype}" if defined($fstype);
return 'mounted' if $mounted->{$devpath};
return if !$is_partition;
@ -693,6 +691,7 @@ sub get_disks {
$partitions->{$part}->{devpath} = "$partpath/$part";
$partitions->{$part}->{parent} = "$devpath";
$partitions->{$part}->{mounted} = exists $mounted->{"$partpath/$part"};
$partitions->{$part}->{gpt} = $data->{gpt};
$partitions->{$part}->{type} = 'partition';
$partitions->{$part}->{size} =