diff --git a/attributes/default.rb b/attributes/default.rb index acdbfc1..dfbb1db 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -37,7 +37,7 @@ default[:pacemaker][:crm][:no_quorum_policy] = "ignore" # Values can be "disabled", "manual", "shared", "per_node" default[:pacemaker][:stonith][:mode] = "disabled" -default[:pacemaker][:stonith][:shared][:plugin] = "" +default[:pacemaker][:stonith][:shared][:agent] = "" # This can be either a string (containing a list of parameters) or a hash. # For instance: # default[:pacemaker][:stonith][:shared][:params] = 'hostname="foo" password="bar"' @@ -45,7 +45,7 @@ default[:pacemaker][:stonith][:shared][:plugin] = "" # default[:pacemaker][:stonith][:shared][:params] = {"hostname" => "foo", "password" => "bar"} default[:pacemaker][:stonith][:shared][:params] = {} -default[:pacemaker][:stonith][:per_node][:plugin] = "" +default[:pacemaker][:stonith][:per_node][:agent] = "" # This can be "all" or "self": # - if set to "all", then every node will configure the stonith resources for # all nodes in the cluster diff --git a/libraries/stonith.rb b/libraries/stonith.rb index aab6997..c5edfc2 100644 --- a/libraries/stonith.rb +++ b/libraries/stonith.rb @@ -1,24 +1,24 @@ module PacemakerStonithHelper - @@stonith_plugins = nil + @@stonith_agents = nil - def self.stonith_plugin_valid?(plugin) - if plugin.nil? || plugin.empty? + def self.stonith_agent_valid?(agent) + if agent.nil? || agent.empty? false else - if @@stonith_plugins.nil? + if @@stonith_agents.nil? out = %x{stonith -L} if $?.success? - @@stonith_plugins = out.split("\n") + @@stonith_agents = out.split("\n") end end - !@@stonith_plugins.nil? && @@stonith_plugins.include?(plugin) + !@@stonith_agents.nil? && @@stonith_agents.include?(agent) end end - def self.assert_stonith_plugin_valid(plugin) - unless stonith_plugin_valid? plugin - raise "STONITH plugin #{plugin} is not available!" + def self.assert_stonith_agent_valid(agent) + unless stonith_agent_valid? agent + raise "STONITH fencing agent #{agent} is not available!" end end end diff --git a/recipes/stonith.rb b/recipes/stonith.rb index 77ac7fb..88272b3 100644 --- a/recipes/stonith.rb +++ b/recipes/stonith.rb @@ -18,7 +18,7 @@ # limitations under the License. # -# FIXME: delete old resources when switching mode (or plugin!) +# FIXME: delete old resources when switching mode (or agent!) case node[:pacemaker][:stonith][:mode] when "disabled" @@ -26,14 +26,14 @@ when "manual" # nothing! when "shared" - plugin = node[:pacemaker][:stonith][:shared][:plugin] + agent = node[:pacemaker][:stonith][:shared][:agent] params = node[:pacemaker][:stonith][:shared][:params] # This needs to be done in the second phase of chef, because we need # cluster-glue to be installed first; hence ruby_block - ruby_block "Check if STONITH #{plugin} is available" do + ruby_block "Check if STONITH fencing agent #{agent} is available" do block do - PacemakerStonithHelper.assert_stonith_plugin_valid plugin + PacemakerStonithHelper.assert_stonith_agent_valid agent end end @@ -42,31 +42,31 @@ when "shared" elsif params.is_a?(String) primitive_params = ::Pacemaker::Resource.extract_hash("params #{params}", "params") else - message = "Unknown format for STONITH shared parameters: #{params.inspect}." + message = "Unknown format for shared fencing agent parameters: #{params.inspect}." Chef::Log.fatal(message) raise message end unless primitive_params.has_key?("hostlist") - message = "Missing hostlist parameter for STONITH shared!" + message = "Missing hostlist parameter for shared fencing agent!" Chef::Log.fatal(message) raise message end pacemaker_primitive "fencing" do - agent "stonith:#{plugin}" + agent "stonith:#{agent}" params primitive_params action :create end when "per_node" - plugin = node[:pacemaker][:stonith][:per_node][:plugin] + agent = node[:pacemaker][:stonith][:per_node][:agent] # This needs to be done in the second phase of chef, because we need # cluster-glue to be installed first; hence ruby_block - ruby_block "Check if STONITH #{plugin} is available" do + ruby_block "Check if STONITH fencing agent #{agent} is available" do block do - PacemakerStonithHelper.assert_stonith_plugin_valid plugin + PacemakerStonithHelper.assert_stonith_agent_valid agent end end @@ -83,20 +83,20 @@ when "per_node" elsif params.is_a?(String) primitive_params = ::Pacemaker::Resource.extract_hash("params #{params}", "params") else - message = "Unknown format for STONITH per-node parameters of #{node_name}: #{params.inspect}." + message = "Unknown format for per-node fencing agent parameters of #{node_name}: #{params.inspect}." Chef::Log.fatal(message) raise message end # Only set one of hostname / hostlist param if none of them are present; we # do not overwrite it as the user might have passed more information than - # just the hostname (some plugins accept hostname:data in hostlist) + # just the hostname (some agents accept hostname:data in hostlist) unless primitive_params.has_key?("hostname") || primitive_params.has_key?("hostlist") primitive_params["hostname"] = node_name end pacemaker_primitive stonith_resource do - agent "stonith:#{plugin}" + agent "stonith:#{agent}" params primitive_params action :create end