]> git.proxmox.com Git - pve-storage.git/commitdiff
api2: disks: add mounted boolean field
authorHannes Laimer <h.laimer@proxmox.com>
Wed, 8 Jun 2022 07:09:59 +0000 (07:09 +0000)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 15 Jun 2022 08:17:10 +0000 (10:17 +0200)
... and remove '(mounted)' from usage string

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
PVE/API2/Disks.pm
PVE/Diskmanage.pm

index b6180572cdbd0cd54f14bba841ac51e16020948d..bde613286c9bf93a3b09f14b87c9bc73a804f1f6 100644 (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 },
index d67cc6b2ab255661afc8c5dd00f66e19a1db5cbc..253916b2fdb837fd9aab4bbd7854e1c77081237c 100644 (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} =