Upstart and SYSV Init support
- Handles different service names between upstart and sysvinit. - Create mon_dir/(upstart|sysvinit) depending on service to be used. Signed-off-by: Alexandre Marangone <alexandre.marangone@inktank.com>
This commit is contained in:
parent
57c6e08276
commit
d1e074afd0
@ -118,3 +118,12 @@ def have_quorum?()
|
|||||||
state = JSON.parse(mon_status)['state']
|
state = JSON.parse(mon_status)['state']
|
||||||
return QUORUM_STATES.include?(state)
|
return QUORUM_STATES.include?(state)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def service_type()
|
||||||
|
case node['platform']
|
||||||
|
when 'ubuntu'
|
||||||
|
return "upstart"
|
||||||
|
else
|
||||||
|
return "sysvinit"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@ -19,11 +19,21 @@ require 'json'
|
|||||||
include_recipe "ceph::default"
|
include_recipe "ceph::default"
|
||||||
include_recipe "ceph::conf"
|
include_recipe "ceph::conf"
|
||||||
|
|
||||||
service "ceph-mon-all-starter" do
|
service_type = service_type()
|
||||||
provider Chef::Provider::Service::Upstart
|
service "ceph_mon" do
|
||||||
action [:enable]
|
case service_type
|
||||||
|
when "upstart"
|
||||||
|
service_name "ceph-mon-all-starter"
|
||||||
|
provider Chef::Provider::Service::Upstart
|
||||||
|
action :enable
|
||||||
|
when "sysvinit"
|
||||||
|
service_name "ceph"
|
||||||
|
provider Chef::Provider::Service::Init
|
||||||
|
end
|
||||||
|
supports :restart => true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# TODO cluster name
|
# TODO cluster name
|
||||||
cluster = 'ceph'
|
cluster = 'ceph'
|
||||||
|
|
||||||
@ -43,11 +53,11 @@ ceph-authtool "$KR" --create-keyring --name=mon. --add-key='#{node["ceph"]["moni
|
|||||||
ceph-mon --mkfs -i #{node['hostname']} --keyring "$KR"
|
ceph-mon --mkfs -i #{node['hostname']} --keyring "$KR"
|
||||||
rm -f -- "$KR"
|
rm -f -- "$KR"
|
||||||
touch /var/lib/ceph/mon/ceph-#{node['hostname']}/done
|
touch /var/lib/ceph/mon/ceph-#{node['hostname']}/done
|
||||||
touch /var/lib/ceph/mon/ceph-#{node['hostname']}/upstart
|
touch /var/lib/ceph/mon/ceph-#{node['hostname']}/#{service_type}
|
||||||
EOH
|
EOH
|
||||||
creates '/var/lib/ceph/mon/ceph-#{node["hostname"]}/done'
|
creates '/var/lib/ceph/mon/ceph-#{node["hostname"]}/done'
|
||||||
creates '/var/lib/ceph/mon/ceph-#{node["hostname"]}/upstart'
|
creates "/var/lib/ceph/mon/ceph-#{node["hostname"]}/#{service_type}"
|
||||||
notifies :start, "service[ceph-mon-all-starter]", :immediately
|
notifies :start, "service[ceph_mon]", :immediately
|
||||||
end
|
end
|
||||||
|
|
||||||
ruby_block "tell ceph-mon about its peers" do
|
ruby_block "tell ceph-mon about its peers" do
|
||||||
|
@ -44,11 +44,18 @@ if !search(:node,"hostname:#{node['hostname']} AND dmcrypt:true").empty?
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
service "ceph-osd-all" do
|
service_type = service_type()
|
||||||
provider Chef::Provider::Service::Upstart
|
service "ceph_osd" do
|
||||||
service_name "ceph-osd-all"
|
case service_type
|
||||||
|
when "sysvinit"
|
||||||
|
service_name "ceph"
|
||||||
|
provider Chef::Provider::Service::Init
|
||||||
|
when "upstart"
|
||||||
|
service_name "ceph-osd-all"
|
||||||
|
provider Chef::Provider::Service::Upstart
|
||||||
|
action :enable
|
||||||
|
end
|
||||||
supports :restart => true
|
supports :restart => true
|
||||||
action :enable
|
|
||||||
end
|
end
|
||||||
|
|
||||||
mons = get_mon_nodes("ceph_bootstrap_osd_key:*")
|
mons = get_mon_nodes("ceph_bootstrap_osd_key:*")
|
||||||
@ -130,7 +137,7 @@ 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']}"
|
command "ceph-disk-prepare #{dmcrypt} #{osd_device['device']}"
|
||||||
action :run
|
action :run
|
||||||
notifies :start, "service[ceph-osd-all]", :immediately
|
notifies :start, "service[ceph_osd]", :immediately
|
||||||
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user