]> git.proxmox.com Git - pve-storage.git/commitdiff
Fix #2705: cephfs: mount fails with bad option
authorAlwin Antreich <a.antreich@proxmox.com>
Fri, 24 Apr 2020 15:29:47 +0000 (17:29 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 25 Apr 2020 09:15:23 +0000 (11:15 +0200)
dmesg: libceph: bad option at 'conf=/etc/pve/ceph.conf'

After the upgrade to PVE 6 with Ceph Luminous, the mount.ceph helper
doesn't understand the conf= option yet. And the CephFS mount with the
kernel client fails. After upgrading to Ceph Nautilus the option exists
in the mount.ceph helper.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
PVE/CephConfig.pm
PVE/Storage/CephFSPlugin.pm
PVE/Storage/RBDPlugin.pm

index 685bdaee829c6298fe5a1444f39947b4840267e2..1e95a90135ae2fced246392ff858ea3b24988add 100644 (file)
@@ -255,4 +255,33 @@ sub ceph_remove_keyfile {
     }
 }
 
+my $ceph_version_parser = sub {
+    my $ceph_version = shift;
+    # FIXME this is the same as pve-manager PVE::Ceph::Tools get_local_version
+    if ($ceph_version =~ /^ceph.*\s(\d+(?:\.\d+)+(?:-pve\d+)?)\s+(?:\(([a-zA-Z0-9]+)\))?/) {
+       my ($version, $buildcommit) = ($1, $2);
+       my $subversions = [ split(/\.|-/, $version) ];
+
+       return ($subversions, $version, $buildcommit);
+    }
+    warn "Could not parse Ceph version: '$ceph_version'\n";
+};
+
+sub ceph_version {
+    my ($cache) = @_;
+
+    my $version_string = $cache;
+    if (!defined($version_string)) {
+       run_command('ceph --version', outfunc => sub {
+           $version_string = shift;
+       });
+    }
+    return undef if !defined($version_string);
+    # subversion is an array ref. with the version parts from major to minor
+    # version is the filtered version string
+    my ($subversions, $version) = $ceph_version_parser->($version_string);
+
+    return wantarray ? ($subversions, $version) : $version;
+}
+
 1;
index 4aa9e9630be1a1c42579a0f316ca7b51566dd284..54689aeecb21000e730a1d08b1ea1b93723247e0 100644 (file)
@@ -80,6 +80,7 @@ EOF
 sub cephfs_mount {
     my ($scfg, $storeid) = @_;
 
+    my ($subversions) = PVE::CephConfig::ceph_version();
     my $mountpoint = $scfg->{path};
     my $subdir = $scfg->{subdir} // '/';
 
@@ -98,7 +99,10 @@ sub cephfs_mount {
     } else {
        push @opts, "name=$cmd_option->{userid}";
        push @opts, "secretfile=$secretfile" if defined($secretfile);
-       push @opts, "conf=$configfile" if defined($configfile);
+       
+       # FIXME: remove subversion check in PVE 7.0, not needed for >= Nautilus
+       # Luminous doesn't know the conf option
+       push @opts, "conf=$configfile" if defined($configfile) && @$subversions[0] > 12;
     }
 
     push @opts, $scfg->{options} if $scfg->{options};
index 0a33ec01bb912bdb5db5b31ecfc6ca7b01d08308..73717216c916fff55fb39aaf819ca24e9581969a 100644 (file)
@@ -77,7 +77,7 @@ my $librados_connect = sub {
 my $krbd_feature_update = sub {
     my ($scfg, $storeid, $name) = @_;
 
-    my ($versionparts) = ceph_version();
+    my ($versionparts) = PVE::CephConfig::ceph_version();
     return 1 if $versionparts->[0] < 10;
 
     my (@disable, @enable);
@@ -123,35 +123,6 @@ my $krbd_feature_update = sub {
     }
 };
 
-my $ceph_version_parser = sub {
-    my $ceph_version = shift;
-    # FIXME this is the same as pve-manager PVE::Ceph::Tools get_local_version
-    if ($ceph_version =~ /^ceph.*\s(\d+(?:\.\d+)+(?:-pve\d+)?)\s+(?:\(([a-zA-Z0-9]+)\))?/) {
-       my ($version, $buildcommit) = ($1, $2);
-       my $subversions = [ split(/\.|-/, $version) ];
-
-       return ($subversions, $version, $buildcommit);
-    }
-    warn "Could not parse Ceph version: '$ceph_version'\n";
-};
-
-sub ceph_version {
-    my ($cache) = @_;
-
-    my $version_string = $cache;
-    if (!defined($version_string)) {
-       run_command('ceph --version', outfunc => sub {
-           $version_string = shift;
-       });
-    }
-    return undef if !defined($version_string);
-    # subversion is an array ref. with the version parts from major to minor
-    # version is the filtered version string
-    my ($subversions, $version) = $ceph_version_parser->($version_string);
-
-    return wantarray ? ($subversions, $version) : $version;
-}
-
 sub run_rbd_command {
     my ($cmd, %args) = @_;