]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cookbooks.git/commitdiff
Add OSD deployment when not using crowbar
authorAlexandre Marangone <alexandre.marangone@inktank.com>
Fri, 15 Mar 2013 19:32:16 +0000 (12:32 -0700)
committerAlexandre Marangone <alexandre.marangone@inktank.com>
Wed, 20 Mar 2013 20:12:45 +0000 (13:12 -0700)
Also installs cryptsetup in case dmcrypt is being used

Signed-off-by: Alexandre Marangone <alexandre.marangone@inktank.com>
recipes/osd.rb

index c4767ba4833fe03f81bcdfe29b9f27babc9cb753..3e0139cf64b40825b905885abf69ad206493bae2 100644 (file)
@@ -26,6 +26,19 @@ package 'gdisk' do
   action :upgrade
 end
 
+if !search(:node,"hostname:#{node['hostname']} AND dmcrypt:true").empty?
+    package 'cryptsetup' do
+      action :upgrade
+    end
+end
+
+service "ceph-osd-all" do
+  provider Chef::Provider::Service::Upstart
+  service_name "ceph-osd-all"
+  supports :restart => true
+  action :enable
+end
+
 mons = get_mon_nodes("ceph_bootstrap_osd_key:*")
 
 if mons.empty? then
@@ -87,5 +100,32 @@ else
 
       end
     end
+  else
+    # Calling ceph-disk-prepare is sufficient for deploying an OSD
+    # After ceph-disk-prepare finishes, the new device will be caught
+    # by udev which will run ceph-disk-activate on it (udev will map
+    # the devices if dm-crypt is used).
+    # IMPORTANT:
+    #  - Always use the default path for OSD (i.e. /var/lib/ceph/
+    # osd/$cluster-$id)
+    #  - $cluster should always be ceph
+    #  - The --dmcrypt option will be available starting w/ Cuttlefish
+    node["ceph"]["osd_devices"].each_with_index do |osd_device,index|
+      dmcrypt = ""
+      if osd_device["encrypted"] == true
+        dmcrypt = "--dmcrypt"
+      end
+      execute "Creating Ceph OSD on #{osd_device['device']}" do
+        command "ceph-disk-prepare #{dmcrypt} #{osd_device['device']}"
+        action :run
+        notifies :start, "service[ceph-osd-all]", :immediately
+      end
+      # we add this status to the node env
+      # so that we can implement recreate
+      # and/or delete functionalities in the
+      # future.
+      node.normal["ceph"]["osd_devices"][index]["status"] == "deployed"
+      node.save
+    end
   end
 end