From: Tommi Virtanen Date: Wed, 25 Jul 2012 21:57:44 +0000 (-0700) Subject: Crowbar: use all "Storage" disks for OSD. X-Git-Tag: eval1~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0c077c2f519ba5f2124595e27472f858ca72ef83;p=ceph-cookbooks.git Crowbar: use all "Storage" disks for OSD. Verify that the disk has not been taken by Swift already. Once all disks have been prepared, trigger a hotplug event, to activate them, and ultimately get OSDs using them. --- diff --git a/recipes/bootstrap_osd.rb b/recipes/bootstrap_osd.rb index 5a4336a..ede1317 100644 --- a/recipes/bootstrap_osd.rb +++ b/recipes/bootstrap_osd.rb @@ -38,4 +38,46 @@ else rm -f '/var/lib/ceph/bootstrap-osd/#{cluster}.keyring.raw' EOH end + + if is_crowbar? + ruby_block "select new disks for ceph osd" do + block do + do_trigger = false + node["crowbar"]["disks"].each do |disk, data| + use = true + + if node["swift"] + node["swift"]["devs"].each do |num| + if num["name"].match(disk) + puts "Disk: #{disk} is being used for swift, skipping" + use = false + end + end + end + + if node["crowbar"]["disks"][disk]["usage"] == "Storage" and use == true + puts "Disk: #{disk} should be used for ceph" + + system 'ceph-disk-prepare', \ + "/dev/#{disk}" + raise 'ceph-disk-prepare failed' unless $?.exitstatus == 0 + + do_trigger = true + + node["crowbar"]["disks"][disk]["usage"] = "ceph-osd" + node.save + end + end + + if do_trigger + system 'udevadm', \ + "trigger", \ + "--subsystem-match=block", \ + "--action=add" + raise 'udevadm trigger failed' unless $?.exitstatus == 0 + end + + end + end + end end