From 4dc4decfad5cb993eb44fb80cd6fd2eb3037d407 Mon Sep 17 00:00:00 2001 From: Walter Huf Date: Wed, 22 Jan 2014 12:18:14 -0600 Subject: [PATCH] Adds automatic mounting of CephFS --- attributes/cephfs.rb | 1 + recipes/cephfs.rb | 45 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 attributes/cephfs.rb create mode 100644 recipes/cephfs.rb diff --git a/attributes/cephfs.rb b/attributes/cephfs.rb new file mode 100644 index 0000000..1147528 --- /dev/null +++ b/attributes/cephfs.rb @@ -0,0 +1 @@ +default["ceph"]["cephfs_mount"] = "/ceph" diff --git a/recipes/cephfs.rb b/recipes/cephfs.rb new file mode 100644 index 0000000..d4d5862 --- /dev/null +++ b/recipes/cephfs.rb @@ -0,0 +1,45 @@ +# +# Author:: Kyle Bader +# Cookbook Name:: ceph +# Recipe:: cephfs +# +# Copyright 2011, DreamHost Web Hosting +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +include_recipe "ceph::conf" + +name = "cephfs" +client_name = "cephfs.#{node['hostname']}" +filename = "/etc/ceph/ceph.client.#{client_name}.secret" + +ceph_client name do + filename filename + caps ({"mon" => "allow r", "osd" => "allow rw", "mds" => "allow"}) + as_keyring false +end + +mons = get_mon_addresses() +mons = mons.join(",") +mons = mons + ":/" +if not mons.empty? + directory node['ceph']['cephfs_mount'] + mount node['ceph']['cephfs_mount'] do + fstype "ceph" + device mons + options "_netdev,name=#{client_name},secretfile=#{filename}" + dump 0 + pass 0 + action [:mount, :enable] + end +end