Skip to content

Commit

Permalink
Update pacemaker to 337f9c139b705135b4f65e72748b4c706323b695
Browse files Browse the repository at this point in the history
337f9c139b705135b4f65e72748b4c706323b695 Merge pull request redhat-openstack#52 from jistr/fence-agents
f62e67f3b48857822ab214bbf2bb704b18ce34af Add retry logic into fence agent manifests
021c273357da3cab541f13b2938c6097174b3582 Merge pull request redhat-openstack#50 from jistr/fence-agents
8f40e62acf78e4df54321f875eb86289288c7d9b Wrap fence_xvm boolean checks in str2bool
7311e5f3a7faa4c7eecdac6e74f94111cd40d37a Avoid using colons in stonith resource names
38fe2f724fe5b9f9b036d1ec33bb2b3c005f5dcc Change fence agents from classes to defined types
37fe18a1e5e17d31bd31100c0c780ecf320b324f Add features from stonith::xvm to stonith::fence_xvm
07ad3712de4601bd0724c1681e58b033bcb7872d Generate the new fence_xvm manifest
46507aa22b10479b65fd8e8fc5a7b6967b51ec78 Fix and reformat the fence agent generator

Change-Id: I404fb94d4dc0f22da946ac0af78f3fc2ebc0f205
  • Loading branch information
xbezdick committed Jun 15, 2015
1 parent 220278d commit 5ba30c9
Show file tree
Hide file tree
Showing 34 changed files with 3,758 additions and 3,418 deletions.
2 changes: 1 addition & 1 deletion Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ mod 'openstacklib',
:git => 'https://github.com/stackforge/puppet-openstacklib.git'

mod 'pacemaker',
:commit => '47c85172fedcf452acd004cc880a565e4a326c73',
:commit => '337f9c139b705135b4f65e72748b4c706323b695',
:git => 'https://github.com/redhat-openstack/puppet-pacemaker.git'

mod 'puppet',
Expand Down
61 changes: 34 additions & 27 deletions pacemaker/agent_generator/agent_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,35 +56,39 @@ def generate
puts <<-eos
# generated by agent_generator.rb, manual changes will be lost
class pacemaker::stonith::#{@parser.getAgentName} (
define pacemaker::stonith::#{@parser.getAgentName} (
#{getManifestParameters}
) {
$real_address = "$(corosync-cfgtool -a $(crm_node -n))"
#{getVariableValues}
$pcmk_host_value_chunk = $pcmk_host_list ? {
undef => '$(/usr/sbin/crm_node -n)',
default => "${pcmk_host_list}",
}
# $title can be a mac address, remove the colons for pcmk resource name
$safe_title = regsubst($title, ':', '', 'G')
if($ensure == absent) {
exec {
"Removing stonith::#{@parser.getAgentName}":
command => "/usr/sbin/pcs stonith delete stonith-#{@parser.getAgentName}-${real_address}",
onlyif => "/usr/sbin/pcs stonith show stonith-#{@parser.getAgentName}-${real_address} > /dev/null 2>&1",
exec { "Delete stonith-#{@parser.getAgentName}-${safe_title}":
command => "/usr/sbin/pcs stonith delete stonith-#{@parser.getAgentName}-${safe_title}",
onlyif => "/usr/sbin/pcs stonith show stonith-#{@parser.getAgentName}-${safe_title} > /dev/null 2>&1",
require => Class["pacemaker::corosync"],
}
} else {
#{getVariableValues}
$pcmk_host_value_chunk = $pcmk_host_list ? {
'' => '$(/usr/sbin/crm_node -n)',
default => "${pcmk_host_list}",
}
package {
"#{@parser.getPackageName}": ensure => installed,
} -> exec {
"Creating stonith::#{@parser.getAgentName}":
command => "/usr/sbin/pcs stonith create stonith-#{@parser.getAgentName}-${real_address} #{@parser.getAgentName} pcmk_host_list=\\"${pcmk_host_value_chunk}\\" #{getChunks} op monitor interval=${interval}",
unless => "/usr/sbin/pcs stonith show stonith-#{@parser.getAgentName}-${real_address} > /dev/null 2>&1",
} ->
exec { "Create stonith-#{@parser.getAgentName}-${safe_title}":
command => "/usr/sbin/pcs stonith create stonith-#{@parser.getAgentName}-${safe_title} #{@parser.getAgentName} pcmk_host_list=\\"${pcmk_host_value_chunk}\\" #{getChunks} op monitor interval=${interval}",
unless => "/usr/sbin/pcs stonith show stonith-#{@parser.getAgentName}-${safe_title} > /dev/null 2>&1",
tries => $tries,
try_sleep => $try_sleep,
require => Class["pacemaker::corosync"],
} -> exec {
"Adding non-local constraint stonith::#{@parser.getAgentName} ${real_address}":
command => "/usr/sbin/pcs constraint location stonith-#{@parser.getAgentName}-${real_address} avoids ${pcmk_host_value_chunk}"
} ->
exec { "Add non-local constraint for stonith-#{@parser.getAgentName}-${safe_title}":
command => "/usr/sbin/pcs constraint location stonith-#{@parser.getAgentName}-${safe_title} avoids ${pcmk_host_value_chunk}",
tries => $tries,
try_sleep => $try_sleep,
}
}
}
Expand All @@ -94,24 +98,27 @@ class pacemaker::stonith::#{@parser.getAgentName} (
def getManifestParameters
text = ""
@parser.getParameters.each { |p|
text += "\t$#{p['name']} = undef,\n"
text += " $#{p['name']} = undef,\n"
}

text += "\n"
text += "\t$interval = \"60s\",\n"
text += "\t$ensure = present,\n"
text += "\t$pcmk_host_value = undef,\n"
text += " $interval = \"60s\",\n"
text += " $ensure = present,\n"
text += " $pcmk_host_list = undef,\n"
text += "\n"
text += " $tries = undef,\n"
text += " $try_sleep = undef,"

return text
end

def getVariableValues
text = ""
@parser.getParameters.each { |p|
text += "\t$#{p['name']}_chunk = $#{p['name']} ? {\n"
text += "\t\tundef => \"\",\n"
text += "\t\tdefault => \"#{p['name']}=\\\"${#{p['name']}}\\\"\",\n"
text += "\t}\n"
text += " $#{p['name']}_chunk = $#{p['name']} ? {\n"
text += " undef => \"\",\n"
text += " default => \"#{p['name']}=\\\"${#{p['name']}}\\\"\",\n"
text += " }\n"
}

return text
Expand Down
86 changes: 86 additions & 0 deletions pacemaker/agent_generator/src_xml/fence_xvm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?xml version="1.0" ?>
<resource-agent name="fence_xvm" shortdesc="Fence agent for virtual machines">
<longdesc>fence_xvm is an I/O Fencing agent which can be used withvirtual machines.</longdesc>
<parameters>
<parameter name="debug">
<getopt mixed="-d" />
<content type="boolean" />
<shortdesc lang="en">Specify (stdin) or increment (command line) debug level</shortdesc>
</parameter>
<parameter name="ip_family">
<getopt mixed="-i" />
<content type="string" default="auto" />
<shortdesc lang="en">IP Family ([auto], ipv4, ipv6)</shortdesc>
</parameter>
<parameter name="multicast_address">
<getopt mixed="-a" />
<content type="string" />
<shortdesc lang="en">Multicast address (default=225.0.0.12 / ff05::3:1)</shortdesc>
</parameter>
<parameter name="ipport">
<getopt mixed="-p" />
<content type="string" default="1229" />
<shortdesc lang="en">TCP, Multicast, or VMChannel IP port (default=1229)</shortdesc>
</parameter>
<parameter name="retrans">
<getopt mixed="-r" />
<content type="string" default="20" />
<shortdesc lang="en">Multicast retransmit time (in 1/10sec; default=20)</shortdesc>
</parameter>
<parameter name="auth">
<getopt mixed="-C" />
<content type="string" default="sha256" />
<shortdesc lang="en">Authentication (none, sha1, [sha256], sha512)</shortdesc>
</parameter>
<parameter name="hash">
<getopt mixed="-c" />
<content type="string" default="sha256" />
<shortdesc lang="en">Packet hash strength (none, sha1, [sha256], sha512)</shortdesc>
</parameter>
<parameter name="key_file">
<getopt mixed="-k" />
<content type="string" default="/etc/cluster/fence_xvm.key" />
<shortdesc lang="en">Shared key file (default=/etc/cluster/fence_xvm.key)</shortdesc>
</parameter>
<parameter name="port">
<getopt mixed="-H" />
<content type="string" />
<shortdesc lang="en">Virtual Machine (domain name) to fence</shortdesc>
</parameter>
<parameter name="use_uuid">
<getopt mixed="-u" />
<content type="string" default="0" />
<shortdesc lang="en">Treat [domain] as UUID instead of domain name. This is provided for compatibility with older fence_xvmd installations.</shortdesc>
</parameter>
<parameter name="action">
<getopt mixed="-o" />
<content type="string" default="reboot" />
<shortdesc lang="en">Fencing action (null, off, on, [reboot], status, list, monitor, metadata)</shortdesc>
</parameter>
<parameter name="timeout">
<getopt mixed="-t" />
<content type="string" default="30" />
<shortdesc lang="en">Fencing timeout (in seconds; default=30)</shortdesc>
</parameter>
<parameter name="delay">
<getopt mixed="-w" />
<content type="string" default="0" />
<shortdesc lang="en">Fencing delay (in seconds; default=0)</shortdesc>
</parameter>
<parameter name="domain">
<!-- DEPRECATED; FOR COMPATIBILITY ONLY -->
<content type="string" />
<shortdesc lang="en">Virtual Machine (domain name) to fence (deprecated; use port)</shortdesc>
</parameter>
</parameters>
<actions>
<action name="null" />
<action name="on" />
<action name="off" />
<action name="reboot" />
<action name="metadata" />
<action name="status" />
<action name="monitor" />
<action name="list" />
</actions>
</resource-agent>
3 changes: 2 additions & 1 deletion pacemaker/agent_generator/variables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ cmd_pkg_map=(
"fence_virt:fence-virt"
"fence_vmware_soap:fence-agents-vmware-soap"
"fence_wti:fence-agents-wti"
# not generating fence_xvm for now, it would overwrite the existing one

# These have manual changes and need to be updated manually:
# "fence_xvm:fence-virt"
)
Loading

0 comments on commit 5ba30c9

Please sign in to comment.