[pve-devel] [PATCH manager v4 2/2] Cleanup parsing proc/mounts on OSD destroy
Alwin Antreich
a.antreich at proxmox.com
Thu Feb 7 16:29:42 CET 2019
Instead of opening proc/mounts through IO::File directly for parsing,
the patch uses ProcFSTools. This way it also takes care of eventual
decoding.
Signed-off-by: Alwin Antreich <a.antreich at proxmox.com>
---
PVE/API2/Ceph/OSD.pm | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/PVE/API2/Ceph/OSD.pm b/PVE/API2/Ceph/OSD.pm
index c3858831..20ac9e65 100644
--- a/PVE/API2/Ceph/OSD.pm
+++ b/PVE/API2/Ceph/OSD.pm
@@ -411,9 +411,9 @@ __PACKAGE__->register_method ({
my $partitions_to_remove = [];
if ($param->{cleanup}) {
- if (my $fd = IO::File->new("/proc/mounts", "r")) {
- while (defined(my $line = <$fd>)) {
- my ($dev, $path, $fstype) = split(/\s+/, $line);
+ if (my $mp = PVE::ProcFSTools::parse_proc_mounts()) {
+ foreach my $line (@$mp) {
+ my ($dev, $path, $fstype) = @$line;
next if !($dev && $path && $fstype);
next if $dev !~ m|^/dev/|;
if ($path eq $mountpoint) {
@@ -424,7 +424,6 @@ __PACKAGE__->register_method ({
last;
}
}
- close($fd);
}
foreach my $path (qw(journal block block.db block.wal)) {
--
2.11.0
More information about the pve-devel
mailing list