[pve-devel] [PATCH storage 01/14] Disks: return correct journal disk candidates

Fabian Ebner f.ebner at proxmox.com
Tue Jan 26 12:45:17 CET 2021


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 at proxmox.com>
---
 PVE/API2/Disks.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/PVE/API2/Disks.pm b/PVE/API2/Disks.pm
index 807e9b2..c0456be 100644
--- a/PVE/API2/Disks.pm
+++ b/PVE/API2/Disks.pm
@@ -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 '') {
-- 
2.20.1





More information about the pve-devel mailing list