[pve-devel] [PATCH pve-storage 1/1] api2: disks: add mounted boolean field
Hannes Laimer
h.laimer at proxmox.com
Wed Jun 8 09:09:59 CEST 2022
... and remove '(mounted)' from usage string
Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
---
PVE/API2/Disks.pm | 1 +
PVE/Diskmanage.pm | 7 +++----
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/PVE/API2/Disks.pm b/PVE/API2/Disks.pm
index b618057..bde6132 100644
--- a/PVE/API2/Disks.pm
+++ b/PVE/API2/Disks.pm
@@ -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 },
diff --git a/PVE/Diskmanage.pm b/PVE/Diskmanage.pm
index d67cc6b..253916b 100644
--- a/PVE/Diskmanage.pm
+++ b/PVE/Diskmanage.pm
@@ -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} =
--
2.30.2
More information about the pve-devel
mailing list