[pve-devel] [PATCH manager 02/10] correctly remove partitions for ceph bluestore osds
Dominik Csapak
d.csapak at proxmox.com
Mon Jul 31 11:28:34 CEST 2017
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 at proxmox.com>
---
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 d6db3567..fc76bfb2 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -384,25 +384,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";
@@ -411,8 +415,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);
+ }
}
};
--
2.11.0
More information about the pve-devel
mailing list