]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cookbooks.git/commitdiff
Crowbar: use all "Storage" disks for OSD.
authorTommi Virtanen <tv@inktank.com>
Wed, 25 Jul 2012 21:57:44 +0000 (14:57 -0700)
committerTommi Virtanen <tv@inktank.com>
Wed, 25 Jul 2012 22:58:00 +0000 (15:58 -0700)
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.

recipes/bootstrap_osd.rb

index 5a4336aa49b8a8b477d36480ec46cabaec0b9f41..ede131784718735de18f860fca2395cc5bb955fd 100644 (file)
@@ -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