Fix OCF script for VPNaaS plugin

Pacemaker is unable to find VPN agent's pid on Ubuntu 14.04,
fix get_worker_pid() function to support it

Change-Id: Ie802dbe728e47fa5c9ef38026113c951f920153d
Closes-bug: #1436837
This commit is contained in:
Sergey Kolekonov 2015-03-26 16:15:15 +03:00
parent 86ae537c11
commit 3bd0f64154
3 changed files with 13 additions and 4 deletions

View File

@ -285,7 +285,16 @@ END
}
get_worker_pid() {
pid=`pgrep -u ${OCF_RESKEY_user} -fol ${OCF_RESKEY_binary} | grep -E "python\s+\/usr\/bin" | awk '{print $1}'`
local options
local pid
# FIXME: Remove if condition and set 'falo' statically once Fuel
# discontinue support of Ubuntu 12.04 and CentOs 6.x where -a was not defined.
if pgrep -V | awk 'match($0, /[0-9]\.[0-9].*/) {if (substr($0, RSTART, RLENGTH) < 3.3) {exit 1}}'; then
options='falo'
else
options='flo'
fi
pid=`pgrep -u ${OCF_RESKEY_user} -${options} ${OCF_RESKEY_binary} | awk '/python \/usr\/bin/ {print $1}'`
echo $pid
}

View File

@ -24,7 +24,7 @@ class vpnaas::ha {
mode => '0644',
owner => root,
group => root,
source => 'puppet:///modules/vpnaas/ocf/neutron-agent-vpn'
source => 'puppet:///modules/vpnaas/ocf/ocf-neutron-vpn-agent'
}
class {'vpnaas::common':}
@ -49,7 +49,7 @@ class vpnaas::ha {
}
cluster::corosync::cs_service {'vpn':
ocf_script => 'neutron-agent-vpn',
ocf_script => 'ocf-neutron-vpn-agent',
csr_parameters => {
'debug' => $debug,
'syslog' => $syslog,

View File

@ -34,6 +34,6 @@ class vpnaas::params {
$openswan_package = 'openswan'
$vpn_agent_ocf_file = '/etc/puppet/modules/cluster/files/ocf/neutron-agent-vpn'
$vpn_agent_ocf_file = '/etc/puppet/modules/cluster/files/ocf/ocf-neutron-vpn-agent'
$cleanup_script_file = '/etc/puppet/modules/cluster/files/q-agent-cleanup.py'
}