mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-09 07:06:14 +00:00
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:
parent
8d64bd8c3b
commit
bb7d5aa955
@ -386,25 +386,29 @@ __PACKAGE__->register_method ({
|
|||||||
warn $@ if $@;
|
warn $@ if $@;
|
||||||
};
|
};
|
||||||
|
|
||||||
my $journal_part;
|
my $partitions_to_remove = [];
|
||||||
my $data_part;
|
|
||||||
|
|
||||||
if ($param->{cleanup}) {
|
if ($param->{cleanup}) {
|
||||||
my $jpath = "$mountpoint/journal";
|
|
||||||
$journal_part = abs_path($jpath);
|
|
||||||
|
|
||||||
if (my $fd = IO::File->new("/proc/mounts", "r")) {
|
if (my $fd = IO::File->new("/proc/mounts", "r")) {
|
||||||
while (defined(my $line = <$fd>)) {
|
while (defined(my $line = <$fd>)) {
|
||||||
my ($dev, $path, $fstype) = split(/\s+/, $line);
|
my ($dev, $path, $fstype) = split(/\s+/, $line);
|
||||||
next if !($dev && $path && $fstype);
|
next if !($dev && $path && $fstype);
|
||||||
next if $dev !~ m|^/dev/|;
|
next if $dev !~ m|^/dev/|;
|
||||||
if ($path eq $mountpoint) {
|
if ($path eq $mountpoint) {
|
||||||
$data_part = abs_path($dev);
|
my $data_part = abs_path($dev);
|
||||||
|
push @$partitions_to_remove, $data_part;
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close($fd);
|
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";
|
print "Unmount OSD $osdsection from $mountpoint\n";
|
||||||
@ -413,8 +417,9 @@ __PACKAGE__->register_method ({
|
|||||||
warn $err;
|
warn $err;
|
||||||
} elsif ($param->{cleanup}) {
|
} elsif ($param->{cleanup}) {
|
||||||
#be aware of the ceph udev rules which can remount.
|
#be aware of the ceph udev rules which can remount.
|
||||||
&$remove_partition($data_part);
|
foreach my $part (@$partitions_to_remove) {
|
||||||
&$remove_partition($journal_part);
|
$remove_partition->($part);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user