[pve-devel] [PATCH storage] cephfs: make is_mounted check less strict

Dominik Csapak d.csapak at proxmox.com
Wed Jul 3 09:42:13 CEST 2019


checking '$server:$subdir' is too strict to work in all cirumcstances,
e.g. adding/removing a monitor would mean that it is not the same
anymore, same if one is adding/removing the ports from the config

check only if the subdir is the same and if it is a cephfs
this way, it still returns true if someone changes the config

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/Storage/CephFSPlugin.pm | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/PVE/Storage/CephFSPlugin.pm b/PVE/Storage/CephFSPlugin.pm
index 53491ed..c18f8c9 100644
--- a/PVE/Storage/CephFSPlugin.pm
+++ b/PVE/Storage/CephFSPlugin.pm
@@ -20,16 +20,14 @@ sub cephfs_is_mounted {
 
     my $cmd_option = PVE::CephConfig::ceph_connect_option($scfg, $storeid);
     my $configfile = $cmd_option->{ceph_conf};
-    my $server = $cmd_option->{mon_host} // PVE::CephConfig::get_monaddr_list($configfile);
 
     my $subdir = $scfg->{subdir} // '/';
     my $mountpoint = $scfg->{path};
-    my $source = "$server:$subdir";
 
     $mountdata = PVE::ProcFSTools::parse_proc_mounts() if !$mountdata;
     return $mountpoint if grep {
 	$_->[2] =~ m#^ceph|fuse\.ceph-fuse# &&
-	$_->[0] =~ m#^\Q$source\E|ceph-fuse$# &&
+	$_->[0] =~ m#\Q:$subdir\E$|^ceph-fuse$# &&
 	$_->[1] eq $mountpoint
     } @$mountdata;
 
-- 
2.20.1





More information about the pve-devel mailing list