From 385df8382d474b128c59ce3dce7f52a40c37b181 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Thu, 22 Aug 2019 12:26:10 +0200 Subject: [PATCH] fix #2341: ceph: osd create: allow db/wal on partioned disks It was intended that for partitioned disks, we create one and use it. Instead the code died always when the disk was used and not of type 'LVM' We now check correctly the 2 cases: * used for partitions and has gpt * used and lvm The remaining api call handles those two cases correctly Signed-off-by: Dominik Csapak --- PVE/API2/Ceph/OSD.pm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/PVE/API2/Ceph/OSD.pm b/PVE/API2/Ceph/OSD.pm index 78ad3734..5f70cf58 100644 --- a/PVE/API2/Ceph/OSD.pm +++ b/PVE/API2/Ceph/OSD.pm @@ -313,10 +313,13 @@ __PACKAGE__->register_method ({ my $name = $d->{name}; my $info = $disklist->{$name}; die "unable to get device info for '$d->{dev}' for type $type\n" if !$disklist->{$name}; - die "device '$d->{dev}' is not GPT partitioned\n" - if $info->{used} && $info->{used} eq 'partitions' && !$info->{gpt}; - die "device '$d->{dev}' is already in use and has no LVM on it\n" - if $info->{used} && $info->{used} ne 'LVM'; + if (my $usage = $info->{used}) { + if ($usage eq 'partitions') { + die "device '$d->{dev}' is not GPT partitioned\n" if !$info->{gpt}; + } elsif ($usage ne 'LVM') { + die "device '$d->{dev}' is already in use and has no LVM on it\n"; + } + } } # get necessary ceph infos