Merge pull request #44 from Youscribe/fix_osd_status

refactor osd_device status saving
This commit is contained in:
Alexandre Marangone 2013-07-09 14:18:12 -07:00
commit e3ceb7d27a

View File

@ -106,7 +106,7 @@ else
# - The --dmcrypt option will be available starting w/ Cuttlefish # - The --dmcrypt option will be available starting w/ Cuttlefish
unless node["ceph"]["osd_devices"].nil? unless node["ceph"]["osd_devices"].nil?
node["ceph"]["osd_devices"].each_with_index do |osd_device,index| node["ceph"]["osd_devices"].each_with_index do |osd_device,index|
if not osd_device["status"].nil? unless osd_device["status"]
next next
end end
dmcrypt = "" dmcrypt = ""
@ -116,14 +116,20 @@ else
execute "Creating Ceph OSD on #{osd_device['device']}" do execute "Creating Ceph OSD on #{osd_device['device']}" do
command "ceph-disk-prepare #{dmcrypt} #{osd_device['device']} #{osd_device['journal']}" command "ceph-disk-prepare #{dmcrypt} #{osd_device['device']} #{osd_device['journal']}"
action :run action :run
notifies :create, "ruby_block[save osd_device status]"
end end
# we add this status to the node env # we add this status to the node env
# so that we can implement recreate # so that we can implement recreate
# and/or delete functionalities in the # and/or delete functionalities in the
# future. # future.
ruby_block "save osd_device status" do
block do
node.normal["ceph"]["osd_devices"][index]["status"] = "deployed" node.normal["ceph"]["osd_devices"][index]["status"] = "deployed"
node.save node.save
end end
action :nothing
end
end
service "ceph_osd" do service "ceph_osd" do
case service_type case service_type
when "upstart" when "upstart"