change location resource's 'node' attribute to 'loc'

This commit is contained in:
Robert 2013-04-18 10:34:14 +09:00
parent 03cdb29d34
commit a844499723
4 changed files with 18 additions and 15 deletions

View File

@ -1,7 +1,7 @@
default['pacemaker']['nodes'] = ['node1', 'node2']
default['pacemaker']['primitive']['drbd']['agent'] = "ocf:linbit:drbd"
default['pacemaker']['primitive']['drbd']['params']['drbd_resource'] = "pair"
default['pacemaker']['primitive']['drbd']['params']['drbd_resource'] = "r0"
default['pacemaker']['primitive']['drbd']['op']['monitor']['interval'] = "5s"
default['pacemaker']['primitive']['drbd']['op']['monitor']['role'] = "Master"
default['pacemaker']['primitive']['drbd']['active'] = ["node1", "node2"]
@ -14,7 +14,8 @@ default['pacemaker']['primitive']['cinder-volume']['active'] = ["node1", "node2"
default['pacemaker']['primitive']['clvm']['agent'] = "ocf:lvm2:clvmd"
default['pacemaker']['primitive']['clvm']['params']['daemon_timeout'] = "30"
default['pacemaker']['primitive']['clvm']['op']['monitor']['interval'] = "10s"
default['pacemaker']['primitive']['clvm']['op']['monitor']['interval'] = "5s"
default['pacemaker']['primitive']['clvm']['op']['monitor']['on-fail'] = "restart"
default['pacemaker']['primitive']['clvm']['active'] = ["node1", "node2"]
# Temporary attribute for vip resource.
@ -37,12 +38,12 @@ default['pacemaker']['primitive']['st-node2']['active'] = ["node1"]
default['pacemaker']['location']['l-st-node1']['rsc_name'] = "st-node1"
default['pacemaker']['location']['l-st-node1']['priority'] = "-inf"
default['pacemaker']['location']['l-st-node1']['node'] = "node1"
default['pacemaker']['location']['l-st-node1']['loc'] = "node1"
default['pacemaker']['location']['l-st-node1']['active'] = ["node2"]
default['pacemaker']['location']['l-st-node2']['rsc_name'] = "st-node2"
default['pacemaker']['location']['l-st-node2']['priority'] = "-inf"
default['pacemaker']['location']['l-st-node2']['node'] = "node2"
default['pacemaker']['location']['l-st-node2']['loc'] = "node2"
default['pacemaker']['location']['l-st-node2']['active'] = ["node1"]
default['pacemaker']['ms']['drbd-cluster']['rsc_name'] = "drbd"

View File

@ -23,10 +23,10 @@ action :create do
name = new_resource.name
rsc = new_resource.rsc
priority = new_resource.priority
node = new_resource.node
loc = new_resource.loc
unless resource_exists?(name)
cmd = "crm configure location #{name} #{rsc} #{priority}: #{node}"
cmd = "crm configure location #{name} #{rsc} #{priority}: #{loc}"
e = execute "configure location #{name}" do
command cmd

View File

@ -42,17 +42,19 @@ node['pacemaker']['nodes'].each do |node|
end
end
node['pacemaker']['primitive'].each do |name, attr|
Chef::Log.debug "Pacemaker::primitive #{name}"
Chef::Log.debug "Attrs: #{attr}"
# Get cinder-volume's myip which might have been set by 'ktc-cinder' cookbook.
if node['pacemaker']['primitive'].include?('vip') and node['cinder']['services']['volume']['myip']
node.default['pacemaker']['primitive']['vip']['params']['ip'] = node['cinder']['services']['volume']['myip']
end
node['pacemaker']['primitive'].each do |name, attr|
pacemaker_primitive name do
agent attr['agent']
params attr['params']
meta attr['meta']
op attr['op']
action :create
only_if attr['active'].include?(node.name)
only_if { attr['active'].include?(node.name) }
end
end
@ -60,9 +62,9 @@ node['pacemaker']['location'].each do |name, attr|
pacemaker_location name do
rsc attr['rsc_name']
priority attr['priority']
node attr['node']
loc attr['loc']
action :create
only_if attr['active'].include?(node.name)
only_if { attr['active'].include?(node.name) }
end
end
@ -71,7 +73,7 @@ node['pacemaker']['ms'].each do |name, attr|
rsc attr['rsc_name']
meta attr['meta']
action :create
only_if attr['active'].include?(node.name)
only_if { attr['active'].include?(node.name) }
end
end
@ -80,7 +82,7 @@ node['pacemaker']['clone'].each do |name, attr|
rsc attr['rsc_name']
meta attr['meta']
action :create
only_if attr['active'].include?(node.name)
only_if { attr['active'].include?(node.name) }
end
end

View File

@ -24,4 +24,4 @@ default_action :create
attribute :name, :kind_of => String, :name_attribute => true
attribute :rsc, :kind_of => String
attribute :priority, :kind_of => String
attribute :node, :kind_of => String
attribute :loc, :kind_of => String