Merge "Launch agent via corosync on controllers"
This commit is contained in:
commit
3a32bd1a9c
|
@ -4,3 +4,4 @@
|
|||
requires:
|
||||
- name: 'network:neutron:core:ml2'
|
||||
- name: 'hypervisor:vmware'
|
||||
message: 'The VMware DVS plugin requires vCenter as the hypervisor option.'
|
|
@ -21,12 +21,6 @@ $vsphere_login = $computes['vc_user']
|
|||
$vsphere_password = $computes['vc_password']
|
||||
|
||||
$neutron = hiera_hash('neutron_config', {})
|
||||
$physnet = $neutron["predefined_networks"]["admin_internal_net"]["L2"]["physnet"]
|
||||
|
||||
$vmware_dvs = hiera_hash('fuel-plugin-vmware-dvs', {})
|
||||
$vds = $vmware_dvs['vmware_dvs_net_maps']
|
||||
$network_maps = "${physnet}:${vds}"
|
||||
|
||||
$py_root = '/usr/lib/python2.7/dist-packages'
|
||||
$ml2_driver_path = 'neutron/plugins/ml2/drivers/mech_vmware_dvs'
|
||||
$ml2_plugin_path = 'neutron/cmd/eventlet/plugins/dvs_neutron_agent.py'
|
||||
|
@ -37,7 +31,6 @@ class {'::vmware_dvs':
|
|||
vsphere_hostname => $vsphere_hostname,
|
||||
vsphere_login => $vsphere_login,
|
||||
vsphere_password => $vsphere_password,
|
||||
network_maps => $network_maps,
|
||||
driver_path => $driver_path,
|
||||
plugin_path => $plugin_path,
|
||||
}
|
||||
|
|
|
@ -0,0 +1,349 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
#
|
||||
# OpenStack VMware DVS Service
|
||||
#
|
||||
# Description: Manages an OpenStack VMware DVS Service process as an HA resource
|
||||
#
|
||||
# Authors: Igor Gajsin
|
||||
# Mainly inspired by the OVS Service resource agent written by Emilien Macchi
|
||||
#
|
||||
# Support: openstack@lists.launchpad.net
|
||||
# License: Apache Software License (ASL) 2.0
|
||||
#
|
||||
#
|
||||
# See usage() function below for more details ...
|
||||
#
|
||||
# OCF instance parameters:
|
||||
# OCF_RESKEY_binary
|
||||
# OCF_RESKEY_config
|
||||
# OCF_RESKEY_plugin_config
|
||||
# OCF_RESKEY_user
|
||||
# OCF_RESKEY_pid
|
||||
# OCF_RESKEY_additional_parameters
|
||||
#######################################################################
|
||||
# Initialization:
|
||||
|
||||
: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
|
||||
. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
|
||||
: ${OCF_FUEL_FUNCTIONS_DIR=${OCF_ROOT}/resource.d/fuel}
|
||||
. ${OCF_FUEL_FUNCTIONS_DIR}/ocf-fuel-funcs
|
||||
|
||||
#######################################################################
|
||||
|
||||
# Fill in some defaults if no values are specified
|
||||
|
||||
OCF_RESKEY_binary_default="neutron-dvs-agent"
|
||||
OCF_RESKEY_config_default="/etc/neutron/neutron.conf"
|
||||
OCF_RESKEY_plugin_config_default="/etc/neutron/plugin.ini"
|
||||
OCF_RESKEY_user_default="neutron"
|
||||
OCF_RESKEY_pid_default="${HA_RSCTMP}/${__SCRIPT_NAME}/${__SCRIPT_NAME}.pid"
|
||||
OCF_RESKEY_log_file_default="/var/log/neutron/vmware-dvs-agent-vcenter-sn.log"
|
||||
OCF_RESKEY_debug_default='false'
|
||||
|
||||
: ${HA_LOGTAG="ocf-neutron-dvs-agent"}
|
||||
: ${HA_LOGFACILITY="daemon"}
|
||||
: ${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}}
|
||||
: ${OCF_RESKEY_config=${OCF_RESKEY_config_default}}
|
||||
: ${OCF_RESKEY_plugin_config=${OCF_RESKEY_plugin_config_default}}
|
||||
: ${OCF_RESKEY_user=${OCF_RESKEY_user_default}}
|
||||
: ${OCF_RESKEY_pid=${OCF_RESKEY_pid_default}}
|
||||
: ${OCF_RESKEY_log_file=${OCF_RESKEY_log_file_default}}
|
||||
: ${OCF_RESKEY_debug=${OCF_RESKEY_debug_default}}
|
||||
|
||||
#######################################################################
|
||||
|
||||
usage() {
|
||||
cat <<UEND
|
||||
usage: $0 (start|stop|validate-all|meta-data|status|monitor)
|
||||
|
||||
$0 manages an OpenStack VMware DVS Service (${OCF_RESKEY_binary}) process as an HA resource
|
||||
|
||||
The 'start' operation starts the networking service.
|
||||
The 'stop' operation stops the networking service.
|
||||
The 'validate-all' operation reports whether the parameters are valid
|
||||
The 'meta-data' operation reports this RA's meta-data information
|
||||
The 'status' operation reports whether the networking service is running
|
||||
The 'monitor' operation reports whether the networking service seems to be working
|
||||
|
||||
UEND
|
||||
}
|
||||
|
||||
meta_data() {
|
||||
cat <<END
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
|
||||
<resource-agent name="neutron-dvs-agent">
|
||||
<version>1.0</version>
|
||||
|
||||
<longdesc lang="en">
|
||||
Resource agent for the OpenStack Neutron VMware DVS Service (${OCF_RESKEY_binary})
|
||||
May manage a neutron-dvs-agent instance or a clone set that
|
||||
creates a distributed neutron-dvs-agent cluster.
|
||||
</longdesc>
|
||||
<shortdesc lang="en">Manages the OpenStack OVS Service (${OCF_RESKEY_binary})</shortdesc>
|
||||
<parameters>
|
||||
|
||||
<parameter name="binary" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
Location of the OpenStack VMware DVS agent binary (${OCF_RESKEY_binary})
|
||||
</longdesc>
|
||||
<shortdesc lang="en">OpenStack VMware DVS agent binary (${OCF_RESKEY_binary})</shortdesc>
|
||||
<content type="string" default="${OCF_RESKEY_binary_default}" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="config" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
Location of the OpenStack Neutron Service (neutron-server) configuration file
|
||||
</longdesc>
|
||||
<shortdesc lang="en">OpenStack Neutron Server (neutron-server) config file</shortdesc>
|
||||
<content type="string" default="${OCF_RESKEY_config_default}" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="plugin_config" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
Location of the OpenStack VMware DVS agent (${OCF_RESKEY_binary}) configuration file
|
||||
</longdesc>
|
||||
<shortdesc lang="en">OpenStack VMware DVS agent (${OCF_RESKEY_binary}) config file</shortdesc>
|
||||
<content type="string" default="${OCF_RESKEY_plugin_config_default}" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="user" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
User running OpenStack VMware DVS Service (${OCF_RESKEY_binary})
|
||||
</longdesc>
|
||||
<shortdesc lang="en">OpenStack VMware DVS Service (${OCF_RESKEY_binary}) user</shortdesc>
|
||||
<content type="string" default="${OCF_RESKEY_user_default}" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="pid" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
The pid file to use for this OpenStack VMware DVS Service (${OCF_RESKEY_binary}) instance
|
||||
</longdesc>
|
||||
<shortdesc lang="en">OpenStack VMware DVS Service (${OCF_RESKEY_binary}) pid file</shortdesc>
|
||||
<content type="string" default="${OCF_RESKEY_pid_default}" />
|
||||
</parameter>
|
||||
|
||||
|
||||
<parameter name="additional_parameters" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
Additional parameters to pass on to the OpenStack VMware DVS Service (${OCF_RESKEY_binary})
|
||||
</longdesc>
|
||||
<shortdesc lang="en">Additional parameters for neutron-dvs-agent</shortdesc>
|
||||
<content type="string" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="log_file" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
The log file to use for this OpenStack VMware DVS Service (${OCF_RESKEY_binary}) instance
|
||||
</longdesc>
|
||||
<shortdesc lang="en">OpenStack VMware DVS Service (${OCF_RESKEY_binary}) log file</shortdesc>
|
||||
<content type="string" default="${OCF_RESKEY_log_file_default}" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="debug" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
The debug flag for OpenStack Vmware DVS Service (${OCF_RESKEY_binary}) instance
|
||||
</longdesc>
|
||||
<shortdesc lang="en">OpenStack Metadata Service (${OCF_RESKEY_binary}) debug flag</shortdesc>
|
||||
<content type="string" default="${OCF_RESKEY_debug_default}" />
|
||||
</parameter>
|
||||
|
||||
</parameters>
|
||||
|
||||
<actions>
|
||||
<action name="start" timeout="20" />
|
||||
<action name="stop" timeout="20" />
|
||||
<action name="status" timeout="20" />
|
||||
<action name="monitor" timeout="30" interval="20" />
|
||||
<action name="validate-all" timeout="5" />
|
||||
<action name="meta-data" timeout="5" />
|
||||
</actions>
|
||||
</resource-agent>
|
||||
END
|
||||
}
|
||||
|
||||
get_worker_pid() {
|
||||
local options
|
||||
local pid
|
||||
options='falo'
|
||||
pid=`pgrep -u ${OCF_RESKEY_user} -${options} ${OCF_RESKEY_binary} | awk '{print $1}'`
|
||||
echo $pid
|
||||
}
|
||||
|
||||
#######################################################################
|
||||
# Functions invoked by resource manager actions
|
||||
|
||||
neutron_dvs_agent_validate() {
|
||||
local rc
|
||||
|
||||
check_binary $OCF_RESKEY_binary
|
||||
check_binary netstat
|
||||
|
||||
# A config file on shared storage that is not available
|
||||
# during probes is OK.
|
||||
if [ ! -f $OCF_RESKEY_config ]; then
|
||||
if ! ocf_is_probe; then
|
||||
ocf_log err "Config $OCF_RESKEY_config doesn't exist"
|
||||
return $OCF_ERR_INSTALLED
|
||||
fi
|
||||
ocf_log_warn "Config $OCF_RESKEY_config not available during a probe"
|
||||
fi
|
||||
|
||||
getent passwd $OCF_RESKEY_user >/dev/null 2>&1
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
ocf_log err "User $OCF_RESKEY_user doesn't exist"
|
||||
return $OCF_ERR_INSTALLED
|
||||
fi
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
|
||||
neutron_dvs_agent_status() {
|
||||
local pid
|
||||
local f_pid
|
||||
local rc
|
||||
|
||||
# check and make PID file dir
|
||||
local PID_DIR="$( dirname ${OCF_RESKEY_pid} )"
|
||||
if [ ! -d "${PID_DIR}" ] ; then
|
||||
ocf_log debug "Create pid file dir: ${PID_DIR} and chown to ${OCF_RESKEY_user}"
|
||||
mkdir -p "${PID_DIR}"
|
||||
chown -R ${OCF_RESKEY_user} "${PID_DIR}"
|
||||
chmod 755 "${PID_DIR}"
|
||||
fi
|
||||
|
||||
pid=`get_worker_pid`
|
||||
if [ "xxx$pid" == "xxx" ] ; then
|
||||
ocf_log warn "OpenStack Neutron agent '$OCF_RESKEY_binary' not running."
|
||||
return $OCF_NOT_RUNNING
|
||||
fi
|
||||
#ocf_log debug "PID='$pid'"
|
||||
|
||||
# Check PID file and create if need
|
||||
if [ ! -f $OCF_RESKEY_pid ] ; then
|
||||
ocf_log warn "OpenStack Neutron agent (${OCF_RESKEY_binary}) was run, but no PID file found."
|
||||
ocf_log warn "Writing PID='$pid' to '$OCF_RESKEY_pid' for '${OCF_RESKEY_binary}' worker..."
|
||||
echo $pid > $OCF_RESKEY_pid
|
||||
return $OCF_SUCCESS
|
||||
fi
|
||||
|
||||
# compare PID from file with PID from `pgrep...`
|
||||
f_pid=`cat $OCF_RESKEY_pid | tr '\n' ' ' | awk '{print $1}'`
|
||||
if [ "xxx$pid" == "xxx$f_pid" ]; then
|
||||
return $OCF_SUCCESS
|
||||
fi
|
||||
|
||||
# at this point we have PID file and PID from it
|
||||
# defferents with PID from `pgrep...`
|
||||
if [ ! -d "/proc/$f_pid" ] || [ "xxx$f_pid" == "xxx" ] ; then
|
||||
# process with PID from PID-file not found
|
||||
ocf_log warn "Old PID file $OCF_RESKEY_pid found, but no running processes with PID=$f_pid found."
|
||||
ocf_log warn "PID-file will be re-created (with PID=$pid)."
|
||||
echo $pid > $OCF_RESKEY_pid
|
||||
return $OCF_SUCCESS
|
||||
fi
|
||||
|
||||
# at this point we have alien PID-file and running prosess with this PID.
|
||||
ocf_log warn "Another daemon (with PID=$f_pid) running with PID file '$OCF_RESKEY_pid'. My PID=$pid"
|
||||
return $OCF_ERR_GENERIC
|
||||
}
|
||||
|
||||
|
||||
neutron_dvs_agent_monitor() {
|
||||
neutron_dvs_agent_status
|
||||
rc=$?
|
||||
return $rc
|
||||
}
|
||||
|
||||
|
||||
neutron_dvs_agent_start() {
|
||||
local rc
|
||||
|
||||
neutron_dvs_agent_status
|
||||
rc=$?
|
||||
if [ $rc -eq $OCF_SUCCESS ]; then
|
||||
ocf_log info "OpenStack VMware DVS agent (${OCF_RESKEY_binary}) already running"
|
||||
return $OCF_SUCCESS
|
||||
fi
|
||||
|
||||
# run and detach to background neutron-dvs-agent as daemon.
|
||||
# Don't use ocf_run as we're sending the tool's output
|
||||
su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} --config-file=$OCF_RESKEY_config \
|
||||
--config-file=$OCF_RESKEY_plugin_config --log-file=$OCF_RESKEY_log_file $OCF_RESKEY_additional_parameters \
|
||||
>> /dev/null"' 2>&1 & echo \$! > $OCF_RESKEY_pid'
|
||||
ocf_log debug "Create pid file: ${OCF_RESKEY_pid} with content $(cat ${OCF_RESKEY_pid})"
|
||||
|
||||
# Spin waiting for the server to come up.
|
||||
# Let the CRM/LRM time us out if required
|
||||
while true; do
|
||||
neutron_dvs_agent_monitor
|
||||
rc=$?
|
||||
[ $rc -eq $OCF_SUCCESS ] && break
|
||||
if [ $rc -ne $OCF_NOT_RUNNING ]; then
|
||||
ocf_log err "OpenStack (${OCF_RESKEY_binary}) start failed"
|
||||
exit $OCF_ERR_GENERIC
|
||||
fi
|
||||
sleep 3
|
||||
done
|
||||
|
||||
ocf_log info "OpenStack VMware DVS agent (${OCF_RESKEY_binary}) started"
|
||||
return $OCF_SUCCESS
|
||||
}
|
||||
|
||||
neutron_dvs_agent_stop() {
|
||||
local rc
|
||||
local pid
|
||||
local shutdown_timeout=15
|
||||
if [ -n "$OCF_RESKEY_CRM_meta_timeout" ]; then
|
||||
shutdown_timeout=$(( ($OCF_RESKEY_CRM_meta_timeout/1000) ))
|
||||
fi
|
||||
|
||||
neutron_dvs_agent_status
|
||||
rc=$?
|
||||
if [ $rc -eq $OCF_NOT_RUNNING ]; then
|
||||
ocf_log info "OpenStack VMware DVS agent (${OCF_RESKEY_binary}) already stopped"
|
||||
return $OCF_SUCCESS
|
||||
fi
|
||||
|
||||
# Try SIGTERM
|
||||
|
||||
pid=`get_worker_pid`
|
||||
proc_stop "${pid}" "${OCF_RESKEY_binary}" $shutdown_timeout
|
||||
rc=$?
|
||||
if [ "${rc}" -eq "${OCF_ERR_GENERIC}" ]; then
|
||||
ocf_log err "OpenStack VMware DVS agent (${OCF_RESKEY_binary}) couldn't be stopped"
|
||||
exit $OCF_ERR_GENERIC
|
||||
fi
|
||||
|
||||
ocf_log debug "Delete pid file: ${OCF_RESKEY_pid} with content $(cat ${OCF_RESKEY_pid})"
|
||||
rm -f $OCF_RESKEY_pid
|
||||
|
||||
return $OCF_SUCCESS
|
||||
}
|
||||
|
||||
#######################################################################
|
||||
|
||||
case "$1" in
|
||||
meta-data) meta_data
|
||||
exit $OCF_SUCCESS;;
|
||||
usage|help) usage
|
||||
exit $OCF_SUCCESS;;
|
||||
esac
|
||||
|
||||
# Anything except meta-data and help must pass validation
|
||||
neutron_dvs_agent_validate || exit $?
|
||||
umask 0022
|
||||
|
||||
# What kind of method was invoked?
|
||||
case "$1" in
|
||||
start) neutron_dvs_agent_start;;
|
||||
stop) neutron_dvs_agent_stop;;
|
||||
status) neutron_dvs_agent_status;;
|
||||
monitor) neutron_dvs_agent_monitor;;
|
||||
validate-all) ;;
|
||||
*) usage
|
||||
exit $OCF_ERR_UNIMPLEMENTED;;
|
||||
esac
|
|
@ -7,9 +7,10 @@
|
|||
raise(Puppet::ParseError, 'Shoud have 5 arguments!') if args.size < 4 or args[0] == ""
|
||||
vcenter = args[0]['computes']
|
||||
physnet = args[1]["predefined_networks"]["admin_internal_net"]["L2"]["physnet"]
|
||||
dvSwitch = args[2]["vmware_dvs_net_maps"]
|
||||
netmaps = args[2]["vmware_dvs_net_maps"]
|
||||
current_node = args[3].split(".")[0]
|
||||
controllersp = args[4].any? {|role| role.include?("controller")}
|
||||
primaryp = args[4].any? {|role| role.include?("primary")}
|
||||
agents = []
|
||||
vcenter.each {|vc|
|
||||
if (vc["target_node"] == "controllers" and controllersp) or current_node == vc["target_node"]
|
||||
|
@ -18,7 +19,16 @@
|
|||
agent["vsphere_hostname"] = vc["vc_host"]
|
||||
agent["vsphere_login"] = vc["vc_user"]
|
||||
agent["vsphere_password"] = vc["vc_password"]
|
||||
agent["network_maps"] = physnet + ":" + dvSwitch
|
||||
cluster = vc["vc_cluster"]
|
||||
if netmaps.include? ':'
|
||||
netmaps = netmaps.split(";").collect{|k| k.split(":")}
|
||||
vds = netmaps.select{|x| x[0] == cluster}.collect{|x| x[1]}[0]
|
||||
else
|
||||
vds = netmaps
|
||||
end
|
||||
agent["network_maps"] = physnet + ":" + vds
|
||||
agent["ha_enabled"] = controllersp
|
||||
agent["primary"] = primaryp
|
||||
agents.push(agent)
|
||||
end
|
||||
}
|
||||
|
|
|
@ -44,24 +44,39 @@ define vmware_dvs::agent(
|
|||
$network_maps = 'physnet1:dvSwitch1',
|
||||
$neutron_url_timeout = '3600',
|
||||
$py_root = '/usr/lib/python2.7/dist-packages',
|
||||
$ha_enabled = true,
|
||||
$primary = false,
|
||||
)
|
||||
{
|
||||
|
||||
$neutron_conf = '/etc/neutron/neutron.conf'
|
||||
$ml2_conf = '/etc/neutron/plugin.ini'
|
||||
$ocf_dvs_name = 'ocf-neutron-dvs-agent'
|
||||
$ocf_dvs_res = "/usr/lib/ocf/resource.d/fuel/${ocf_dvs_name}"
|
||||
$agent_config = "/etc/neutron/plugins/ml2/vmware_dvs-${host}.ini"
|
||||
$agent_name = "neutron-plugin-vmware-dvs-agent-${host}"
|
||||
$agent_init = "/etc/init/${agent_name}.conf"
|
||||
$agent_initd = "/etc/init.d/${agent_name}"
|
||||
$agent_log = "/var/log/neutron/vmware-dvs-agent-${host}.log"
|
||||
$ocf_pid_dir = '/var/run/resource-agents/ocf-neutron-dvs-agent'
|
||||
$ocf_pid = "${ocf_pid_dir}/${agent_name}.pid"
|
||||
|
||||
nova_config {'neutron/url_timeout': value => $neutron_url_timeout}
|
||||
|
||||
file {"${py_root}/nova.patch":
|
||||
source => 'puppet:///modules/vmware_dvs/nova.patch',
|
||||
notify => Exec['apply-nova-patch'],
|
||||
if ! defined(Nova_config['neutron/url_timeout']) {
|
||||
nova_config {'neutron/url_timeout': value => $neutron_url_timeout}
|
||||
}
|
||||
exec {'apply-nova-patch':
|
||||
path => '/usr/bin:/usr/sbin:/bin:/sbin',
|
||||
command => "patch -d ${py_root} -N -p1 < ${py_root}/nova.patch",
|
||||
refreshonly => true,
|
||||
|
||||
if ! defined(File["${py_root}/nova.patch"]) {
|
||||
file {"${py_root}/nova.patch":
|
||||
source => 'puppet:///modules/vmware_dvs/nova.patch',
|
||||
notify => Exec['apply-nova-patch'],
|
||||
}
|
||||
}
|
||||
if ! defined(Exec['apply-nova-patch']) {
|
||||
exec {'apply-nova-patch':
|
||||
path => '/usr/bin:/usr/sbin:/bin:/sbin',
|
||||
command => "patch -d ${py_root} -N -p1 < ${py_root}/nova.patch",
|
||||
refreshonly => true,
|
||||
}
|
||||
}
|
||||
|
||||
file {$agent_config:
|
||||
|
@ -78,9 +93,55 @@ define vmware_dvs::agent(
|
|||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0644',
|
||||
}->
|
||||
exec {"start_${agent_name}":
|
||||
path => '/usr/sbin:/sbin:/usr/bin:/bin',
|
||||
command => "service ${agent_name} restart",
|
||||
}
|
||||
|
||||
file {$agent_initd:
|
||||
ensure => present,
|
||||
content => template('vmware_dvs/agent_init.d.erb'),
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0755',
|
||||
}
|
||||
|
||||
if $ha_enabled {
|
||||
if ! defined(File[$ocf_dvs_res]) {
|
||||
file {$ocf_dvs_res:
|
||||
source => "puppet:///modules/vmware_dvs/${ocf_dvs_name}",
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0755',
|
||||
}
|
||||
}
|
||||
|
||||
service {$agent_name: }
|
||||
|
||||
cluster::corosync::cs_service{$agent_name:
|
||||
ocf_script => $ocf_dvs_name,
|
||||
csr_complex_type => 'clone',
|
||||
csr_ms_metadata => {
|
||||
'interleave' => true
|
||||
},
|
||||
csr_parameters => {
|
||||
'plugin_config' => $ml2_conf,
|
||||
'additional_parameters' => "--config-file=${agent_config}",
|
||||
'log_file' => $agent_log,
|
||||
'pid' => $ocf_pid,
|
||||
},
|
||||
csr_mon_intr => '20',
|
||||
csr_mon_timeout => '10',
|
||||
csr_timeout => '80',
|
||||
service_name => $agent_name,
|
||||
package_name => $agent_name,
|
||||
service_title => $agent_name,
|
||||
primary => $primary,
|
||||
hasrestart => false,
|
||||
}
|
||||
}
|
||||
else {
|
||||
exec {"start_${agent_name}":
|
||||
path => '/usr/sbin:/sbin:/usr/bin:/bin',
|
||||
command => "service ${agent_name} restart",
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -40,7 +40,6 @@ class vmware_dvs(
|
|||
$vsphere_hostname = '192.168.0.1',
|
||||
$vsphere_login = 'administrator@vsphere.loc',
|
||||
$vsphere_password = 'StrongPassword!',
|
||||
$network_maps = 'physnet2:dvSwitch1',
|
||||
$driver_path = 'neutron/plugins/ml2/drivers/mech_vmware_dvs',
|
||||
$plugin_path = 'neutron/cmd/eventlet/plugins/dvs_neutron_agent.py',
|
||||
)
|
||||
|
@ -53,7 +52,6 @@ class vmware_dvs(
|
|||
'ml2_vmware/vsphere_hostname': value => $vsphere_hostname;
|
||||
'ml2_vmware/vsphere_login': value => $vsphere_login;
|
||||
'ml2_vmware/vsphere_password': value => $vsphere_password;
|
||||
'ml2_vmware/network_maps': value => $network_maps;
|
||||
} ->
|
||||
package { ['python-suds','python-mech-vmware-dvs']:
|
||||
ensure => present,
|
||||
|
@ -68,11 +66,18 @@ class vmware_dvs(
|
|||
}
|
||||
|
||||
file {'neutron-dvs-agent':
|
||||
path => '/usr/local/bin/neutron-dvs-agent',
|
||||
path => '/usr/bin/neutron-dvs-agent',
|
||||
source => 'puppet:///modules/vmware_dvs/neutron-dvs-agent',
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0755',
|
||||
require => Package['python-mech-vmware-dvs'],
|
||||
}
|
||||
|
||||
file {'/etc/neutron/plugin.ini':
|
||||
ensure => 'link',
|
||||
target => '/etc/neutron/plugins/ml2/ml2_conf.ini',
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,143 @@
|
|||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: neutron-vmware-dvs-agent
|
||||
# Required-Start: $network $local_fs $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs
|
||||
# Should-Start: mysql postgresql rabbitmq-server keystone
|
||||
# Should-Stop: mysql postgresql rabbitmq-server keystone
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Neutron VMware DVS Agent
|
||||
# Description: Agent to use within neutron vmware dvs driver
|
||||
### END INIT INFO
|
||||
|
||||
# Authors: Igor Gajsin <igajsin@mirantis.com>
|
||||
|
||||
DESC="Openstack Neutron VMware DVS Plugin Agent"
|
||||
PROJECT_NAME=neutron
|
||||
NAME=${PROJECT_NAME}-vmware-dvs-agent
|
||||
CONFIG_FILE=<%= @agent_config %>
|
||||
|
||||
DAEMON=/usr/local/bin/neutron-dvs-agent
|
||||
DAEMON_ARGS="--config-file=/etc/neutron/neutron.conf --config-file=/etc/neutron/plugins/ml2/ml2_conf.ini"
|
||||
#!/bin/sh
|
||||
# The content after this line comes from openstack-pkg-tools
|
||||
# and has been automatically added to a .init.in script, which
|
||||
# contains only the descriptive part for the daemon. Everything
|
||||
# else is standardized as a single unique script.
|
||||
|
||||
# Author: Thomas Goirand <zigo@debian.org>
|
||||
|
||||
# PATH should only include /usr/* if it runs after the mountnfs.sh script
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
|
||||
if [ -z "${DAEMON}" ] ; then
|
||||
DAEMON=/usr/bin/${NAME}
|
||||
fi
|
||||
PIDFILE=/var/run/${PROJECT_NAME}/${NAME}.pid
|
||||
if [ -z "${SCRIPTNAME}" ] ; then
|
||||
SCRIPTNAME=/etc/init.d/${NAME}
|
||||
fi
|
||||
if [ -z "${SYSTEM_USER}" ] ; then
|
||||
SYSTEM_USER=${PROJECT_NAME}
|
||||
fi
|
||||
if [ -z "${SYSTEM_USER}" ] ; then
|
||||
SYSTEM_GROUP=${PROJECT_NAME}
|
||||
fi
|
||||
if [ "${SYSTEM_USER}" != "root" ] ; then
|
||||
STARTDAEMON_CHUID="--chuid ${SYSTEM_USER}:${SYSTEM_GROUP}"
|
||||
fi
|
||||
if [ -z "${CONFIG_FILE}" ] ; then
|
||||
CONFIG_FILE=/etc/${PROJECT_NAME}/${PROJECT_NAME}.conf
|
||||
fi
|
||||
LOGFILE=/var/log/${PROJECT_NAME}/${NAME}.log
|
||||
if [ -z "${NO_OPENSTACK_CONFIG_FILE_DAEMON_ARG}" ] ; then
|
||||
DAEMON_ARGS="${DAEMON_ARGS} --config-file=${CONFIG_FILE}"
|
||||
fi
|
||||
|
||||
# Exit if the package is not installed
|
||||
[ -x $DAEMON ] || exit 0
|
||||
|
||||
# If ran as root, create /var/lock/X, /var/run/X, /var/lib/X and /var/log/X as needed
|
||||
if [ `whoami` = "root" ] ; then
|
||||
for i in lock run log lib ; do
|
||||
mkdir -p /var/$i/${PROJECT_NAME}
|
||||
chown ${SYSTEM_USER} /var/$i/${PROJECT_NAME}
|
||||
done
|
||||
fi
|
||||
|
||||
# This defines init_is_upstart which we use later on (+ more...)
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
# Manage log options: logfile and/or syslog, depending on user's choosing
|
||||
[ -r /etc/default/openstack ] && . /etc/default/openstack
|
||||
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
||||
[ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog"
|
||||
[ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=$LOGFILE"
|
||||
|
||||
do_start() {
|
||||
start-stop-daemon --start --quiet --background ${STARTDAEMON_CHUID} --make-pidfile --pidfile ${PIDFILE} --chdir /var/lib/${PROJECT_NAME} --startas $DAEMON \
|
||||
--test > /dev/null || return 1
|
||||
start-stop-daemon --start --quiet --background ${STARTDAEMON_CHUID} --make-pidfile --pidfile ${PIDFILE} --chdir /var/lib/${PROJECT_NAME} --startas $DAEMON \
|
||||
-- $DAEMON_ARGS || return 2
|
||||
}
|
||||
|
||||
do_stop() {
|
||||
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
|
||||
RETVAL=$?
|
||||
rm -f $PIDFILE
|
||||
return "$RETVAL"
|
||||
}
|
||||
|
||||
do_systemd_start() {
|
||||
exec $DAEMON $DAEMON_ARGS
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
init_is_upstart > /dev/null 2>&1 && exit 1
|
||||
log_daemon_msg "Starting $DESC" "$NAME"
|
||||
do_start
|
||||
case $? in
|
||||
0|1) log_end_msg 0 ;;
|
||||
2) log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
stop)
|
||||
init_is_upstart > /dev/null 2>&1 && exit 0
|
||||
log_daemon_msg "Stopping $DESC" "$NAME"
|
||||
do_stop
|
||||
case $? in
|
||||
0|1) log_end_msg 0 ;;
|
||||
2) log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
status)
|
||||
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
|
||||
;;
|
||||
systemd-start)
|
||||
do_systemd_start
|
||||
;;
|
||||
restart|force-reload)
|
||||
init_is_upstart > /dev/null 2>&1 && exit 1
|
||||
log_daemon_msg "Restarting $DESC" "$NAME"
|
||||
do_stop
|
||||
case $? in
|
||||
0|1)
|
||||
do_start
|
||||
case $? in
|
||||
0) log_end_msg 0 ;;
|
||||
1) log_end_msg 1 ;; # Old process is still running
|
||||
*) log_end_msg 1 ;; # Failed to start
|
||||
esac
|
||||
;;
|
||||
*) log_end_msg 1 ;; # Failed to stop
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload|systemd-start}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
|
@ -3,7 +3,7 @@ name: fuel-plugin-vmware-dvs
|
|||
# Human-readable name for your plugin
|
||||
title: Neutron VMware DVS ML2 plugin
|
||||
# Plugin version
|
||||
version: '2.1.4'
|
||||
version: '2.1.8'
|
||||
# Description
|
||||
description: Enable to use plugin vmware_dvs for Neutron
|
||||
# Required fuel version
|
||||
|
|
Loading…
Reference in New Issue