]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cookbooks.git/commitdiff
Improves cephfs fuse detection in the cephfs recipe 163/head
authorWalter Huf <walter.huf@corvisa.com>
Fri, 17 Oct 2014 15:39:22 +0000 (10:39 -0500)
committerWalter Huf <walter.huf@corvisa.com>
Fri, 17 Oct 2014 17:23:59 +0000 (12:23 -0500)
Explicitly checks for Linux kernel version
Adds an option to override and explicitly force kernel or fuse mode

README.md
attributes/cephfs.rb
libraries/utils.rb
recipes/cephfs.rb
test/cookbooks/ceph_test/recipes/cephfs.rb
test/integration/aio/bats/ceph-running.bats

index 93529dc2a9992e5b8c83678ba99b40e4d7be425c..bfd307dca0dde316d93beae0d6e420c69c3b0357 100644 (file)
--- a/README.md
+++ b/README.md
@@ -118,6 +118,7 @@ Ceph Rados Gateway nodes should use the ceph-radosgw role
 
 * node['ceph']['config']['mds'] - a hash of settings to save in ceph.conf in the [mds] section, such as `'mds cache size' => '100000'`
 * node['ceph']['cephfs_mount'] - where the cephfs recipe should mount CephFS
+* node['ceph']['cephfs_use_fuse'] - whether the cephfs recipe should use the fuse cephfs client. It will default to heuristics based on the kernel version
 
 ### Ceph Rados Gateway
 
index a832d9d53d57f6aee7b40b909861572c8ffb474f..993b46d582cb0d96deed08ab81404faeb268a9b8 100644 (file)
@@ -1,4 +1,5 @@
 default['ceph']['cephfs_mount'] = '/ceph'
+default['ceph']['cephfs_use_fuse'] = nil  # whether the recipe's fuse mount uses cephfs-fuse instead of kernel client, defaults to heuristics
 
 case node['platform_family']
 when 'debian'
index 257472ffa424b3cdd47e8fa6e83947d2720282fd..bac924852401e671f2f997f9d00f62e66bcf40a3 100644 (file)
@@ -12,3 +12,24 @@ def debug_ext
     ''
   end
 end
+
+def cephfs_requires_fuse
+  # What kernel version supports the given Ceph version tunables
+  # http://ceph.com/docs/master/rados/operations/crush-map/
+  min_versions = {
+    'argonaut' => 3.6,
+    'bobtail' => 3.9,
+    'cuttlefish' => 3.9,
+    'dumpling' => 3.9,
+    'emperor' => 3.9,
+    'firefly' => 3.15
+  }
+  min_versions.default = 3.15
+
+  # If we are on linux and have a new-enough kernel, allow kernel mount
+  if node['os'] == 'linux' && Gem::Version.new(node['kernel']['release'].to_f) >= Gem::Version.new(min_versions[node['ceph']['version']])
+    false
+  else
+    true
+  end
+end
index 28ac60cb34c2e9b04a861768e31e988d63b1c11c..2e65dad6645a9a0f9ec35dfaf192d0120ed62bde 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-requires_fuse =
-  case node['platform']
-  when 'debian'
-    node['platform_version'].to_f < 7.0
-  when 'ubuntu'
-    node['platform_version'].to_f < 12.04
-  when 'redhat'
-    node['platform_version'].to_f < 7.0
-  when 'fedora'
-    node['platform_version'].to_f < 17.0
-  else
-    true
-end
-
 ceph_cephfs node['ceph']['cephfs_mount'] do
-  use_fuse requires_fuse
+  use_fuse node['ceph']['cephfs_use_fuse'] || cephfs_requires_fuse
   action [:mount, :enable]
 end
index c4589a80f005364ad21d06c696d0ffe372356468..b6e7f7c264a26a09eb8587890f4f6a827ca1a8f6 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-requires_fuse =
-  case node['platform']
-  when 'debian'
-    node['platform_version'].to_f < 7.0
-  when 'ubuntu'
-    node['platform_version'].to_f < 12.04
-  when 'redhat'
-    node['platform_version'].to_f < 7.0
-  when 'fedora'
-    node['platform_version'].to_f < 17.0
-  else
-    true
-end
-
 ceph_cephfs '/ceph' do
-  use_fuse requires_fuse
+  use_fuse cephfs_requires_fuse
   action [:mount, :enable]
 end
 ceph_cephfs '/ceph.fuse' do
@@ -48,7 +34,7 @@ file '/ceph/subdir/file' do
   content "It works\n"
 end
 
-unless requires_fuse
+unless cephfs_requires_fuse
   ceph_cephfs '/subceph' do
     use_fuse false
     cephfs_subdir '/subdir'
index 578d7e4b6f3f70582ae976ea2ef1918fec9f39d4..65789ec8acc8b9880bdc201facd194364a98e992 100644 (file)
@@ -7,7 +7,7 @@
 }
 
 @test "cephfs is mounted" {
-  mount | grep 'type ceph'
+  mount | grep -E 'type (fuse\.)?ceph'
 }
 
 @test "radosgw is running" {