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 <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2019-08-22 12:26:10 +02:00 committed by Thomas Lamprecht
parent 9b80367057
commit 385df8382d

View File

@ -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