]> git.proxmox.com Git - pve-storage.git/commitdiff
make use of the new ProcFSTools::parse_proc_mounts
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 13 Nov 2015 11:21:44 +0000 (12:21 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Sat, 14 Nov 2015 09:37:06 +0000 (10:37 +0100)
PVE/Storage/GlusterfsPlugin.pm
PVE/Storage/NFSPlugin.pm

index 3bae1009291fdfa15851c841b03a2ef56ff20038..a6ca950b6d42fdc5cb71c36b378fa48ce9cf5879 100644 (file)
@@ -70,12 +70,13 @@ my $get_active_server = sub {
 sub glusterfs_is_mounted {
     my ($volume, $mountpoint, $mountdata) = @_;
 
-    $mountdata = PVE::ProcFSTools::read_proc_mounts() if !$mountdata;
-
-    if ($mountdata =~ m|^\S+:$volume/?\s$mountpoint\sfuse.glusterfs|m) {
-       return $mountpoint;
-    }
+    $mountdata = PVE::ProcFSTools::parse_proc_mounts() if !$mountdata;
 
+    return $mountpoint if grep {
+       $_->[2] eq 'fuse.glusterfs' &&
+       $_->[0] eq $volume &&
+       $_->[1] eq $mountpoint
+    } @$mountdata;
     return undef;
 }
 
@@ -248,7 +249,7 @@ sub alloc_image {
 sub status {
     my ($class, $storeid, $scfg, $cache) = @_;
 
-    $cache->{mountdata} = PVE::ProcFSTools::read_proc_mounts()
+    $cache->{mountdata} = PVE::ProcFSTools::parse_proc_mounts()
        if !$cache->{mountdata};
 
     my $path = $scfg->{path};
@@ -263,7 +264,7 @@ sub status {
 sub activate_storage {
     my ($class, $storeid, $scfg, $cache) = @_;
 
-    $cache->{mountdata} = PVE::ProcFSTools::read_proc_mounts()
+    $cache->{mountdata} = PVE::ProcFSTools::parse_proc_mounts()
        if !$cache->{mountdata};
 
     my $path = $scfg->{path};
@@ -287,7 +288,7 @@ sub activate_storage {
 sub deactivate_storage {
     my ($class, $storeid, $scfg, $cache) = @_;
 
-    $cache->{mountdata} = PVE::ProcFSTools::read_proc_mounts()
+    $cache->{mountdata} = PVE::ProcFSTools::parse_proc_mounts()
        if !$cache->{mountdata};
 
     my $path = $scfg->{path};
index 52820555d7058efb7658f407197448e4ec9be626..047c3a4a4e1d7d380aa85ae5e033880741812550 100644 (file)
@@ -20,12 +20,12 @@ sub nfs_is_mounted {
     $server = "[$server]" if Net::IP::ip_is_ipv6($server);
     my $source = "$server:$export";
 
-    $mountdata = PVE::ProcFSTools::read_proc_mounts() if !$mountdata;
-
-    if ($mountdata =~ m|^\Q$source\E/?\s\Q$mountpoint\E\snfs|m) {
-       return $mountpoint;
-    } 
-
+    $mountdata = PVE::ProcFSTools::parse_proc_mounts() if !$mountdata;
+    return $mountpoint if grep {
+       $_->[2] eq 'nfs' &&
+       $_->[0] eq $source &&
+       $_->[1] eq $mountpoint
+    } @$mountdata;
     return undef;
 }
 
@@ -102,7 +102,7 @@ sub check_config {
 sub status {
     my ($class, $storeid, $scfg, $cache) = @_;
 
-    $cache->{mountdata} = PVE::ProcFSTools::read_proc_mounts()
+    $cache->{mountdata} = PVE::ProcFSTools::parse_proc_mounts()
        if !$cache->{mountdata};
 
     my $path = $scfg->{path};
@@ -117,7 +117,7 @@ sub status {
 sub activate_storage {
     my ($class, $storeid, $scfg, $cache) = @_;
 
-    $cache->{mountdata} = PVE::ProcFSTools::read_proc_mounts()
+    $cache->{mountdata} = PVE::ProcFSTools::parse_proc_mounts()
        if !$cache->{mountdata};
 
     my $path = $scfg->{path};
@@ -143,7 +143,7 @@ sub activate_storage {
 sub deactivate_storage {
     my ($class, $storeid, $scfg, $cache) = @_;
 
-    $cache->{mountdata} = PVE::ProcFSTools::read_proc_mounts()
+    $cache->{mountdata} = PVE::ProcFSTools::parse_proc_mounts()
        if !$cache->{mountdata};
 
     my $path = $scfg->{path};