[pve-devel] [PATCH manager 2/2] fix #2341: ceph: osd create: allow db/wal on partioned disks

Dominik Csapak d.csapak at proxmox.com
Thu Aug 22 12:26:10 CEST 2019


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 <d.csapak at proxmox.com>
---
 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
-- 
2.20.1





More information about the pve-devel mailing list