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 <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2017-07-31 15:15:24 +02:00 committed by Fabian Grünbichler
parent 8d64bd8c3b
commit bb7d5aa955

View File

@ -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);
}
}
};