[pve-devel] [PATCH manager v4 2/2] Cleanup parsing proc/mounts on OSD destroy
Thomas Lamprecht
t.lamprecht at proxmox.com
Fri Feb 8 15:29:43 CET 2019
Am 2/7/19 um 4:29 PM schrieb Alwin Antreich:
> 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)) {
>
applied, thanks! Moved a hunk from 1/2 to this one, see reply to 1/2 for details.
More information about the pve-devel
mailing list