]> git.proxmox.com Git - pve-storage.git/commitdiff
Disks: return correct journal disk candidates
authorFabian Ebner <f.ebner@proxmox.com>
Tue, 26 Jan 2021 11:45:17 +0000 (12:45 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 6 Feb 2021 12:52:20 +0000 (13:52 +0100)
Previously any GPT initialized disk without an osdid (i.e. equal to -1) would
be included in the list of journal disk candidates, for example a ZFS disk. But
the OSD creation API call will fail for those. To fix it, re-use the condition
from the corresponding check in that API call (in PVE/API2/Ceph/OSD.pm).
Now, included disks are unused disks, those with usage 'partitions' and GPT, and
those with usage 'LVM'.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
PVE/API2/Disks.pm

index 807e9b2dc73292331780caeab46d9f3d41dd844f..c0456be6916e7725beaf53e48ce8dc343f3be3c1 100644 (file)
@@ -137,7 +137,10 @@ __PACKAGE__->register_method ({
            my $entry = $disks->{$disk};
            if ($type eq 'journal_disks') {
                next if $entry->{osdid} >= 0;
-               next if !($entry->{gpt} || !$entry->{used} || $entry->{used} eq 'LVM');
+               if (my $usage = $entry->{used}) {
+                   next if !($usage eq 'partitions' && $entry->{gpt}
+                       || $usage eq 'LVM');
+               }
            } elsif ($type eq 'unused') {
                next if $entry->{used};
            } elsif ($type ne '') {