From bb7d5aa95513d58297afd934830fb0c3d7d404b4 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Mon, 31 Jul 2017 15:15:24 +0200 Subject: [PATCH] correctly remove partitions for ceph bluestore osds we now have to remove 5 types of partitions: data/metadata journal block block.db block.wal this patch fixes the detection of block/block.db/block.wal generalizes it Signed-off-by: Dominik Csapak --- PVE/API2/Ceph.pm | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm index cdf6cfcb..f3f313cd 100644 --- a/PVE/API2/Ceph.pm +++ b/PVE/API2/Ceph.pm @@ -386,25 +386,29 @@ __PACKAGE__->register_method ({ warn $@ if $@; }; - my $journal_part; - my $data_part; + my $partitions_to_remove = []; if ($param->{cleanup}) { - my $jpath = "$mountpoint/journal"; - $journal_part = abs_path($jpath); - if (my $fd = IO::File->new("/proc/mounts", "r")) { while (defined(my $line = <$fd>)) { my ($dev, $path, $fstype) = split(/\s+/, $line); next if !($dev && $path && $fstype); next if $dev !~ m|^/dev/|; if ($path eq $mountpoint) { - $data_part = abs_path($dev); + my $data_part = abs_path($dev); + push @$partitions_to_remove, $data_part; last; } } close($fd); } + + foreach my $path (qw(journal block block.db block.wal)) { + my $part = abs_path("$mountpoint/$path"); + if ($part) { + push @$partitions_to_remove, $part; + } + } } print "Unmount OSD $osdsection from $mountpoint\n"; @@ -413,8 +417,9 @@ __PACKAGE__->register_method ({ warn $err; } elsif ($param->{cleanup}) { #be aware of the ceph udev rules which can remount. - &$remove_partition($data_part); - &$remove_partition($journal_part); + foreach my $part (@$partitions_to_remove) { + $remove_partition->($part); + } } };