Add systemd init support for deploy from source

systemd is used instead of upstart by default since Ubuntu 15.10
(Wily).  This adds systemd init file support for nova services
that are deployed from source.

Change-Id: I784e6b9908222995c56c9f3c06cc54f0254d4761
This commit is contained in:
Corey Bryant 2016-06-23 20:40:02 +00:00 committed by James Page
parent 7491779846
commit 21b20ccf14
24 changed files with 918 additions and 273 deletions

View File

@ -8,6 +8,7 @@ from charmhelpers.core.host import (
add_user_to_group,
lsb_release,
mkdir,
service,
service_running,
service_stop,
service_restart,
@ -42,13 +43,15 @@ from charmhelpers.contrib.hahelpers.cluster import (
from charmhelpers.contrib.openstack.utils import (
configure_installation_source,
get_os_codename_install_source,
git_install_requested,
git_clone_and_install,
git_default_repos,
git_src_dir,
git_generate_systemd_init_files,
git_install_requested,
git_pip_venv_dir,
git_src_dir,
get_hostname,
make_assess_status_func,
os_release,
pause_unit,
resume_unit,
)
@ -171,6 +174,7 @@ BASE_GIT_PACKAGES = [
'libxml2-dev',
'libxslt1-dev',
'libyaml-dev',
'openstack-pkg-tools',
'python-dev',
'python-pip',
'python-setuptools',
@ -189,6 +193,7 @@ GIT_PACKAGE_BLACKLIST = [
'neutron-plugin-cisco',
'neutron-plugin-metering-agent',
'neutron-plugin-openvswitch-agent',
'neutron-openvswitch-agent',
'neutron-vpn-agent',
'python-neutron-fwaas',
'python-oslo.config',
@ -863,6 +868,8 @@ def git_pre_install():
'/var/lib/neutron',
'/var/lib/neutron/lock',
'/var/log/neutron',
'/var/lib/nova',
'/var/log/nova',
]
logs = [
@ -890,6 +897,11 @@ def git_pre_install():
add_group('neutron', system_group=True)
add_user_to_group('neutron', 'neutron')
adduser('nova', shell='/bin/bash', system_user=True)
subprocess.check_call(['usermod', '--home', '/var/lib/nova', 'nova'])
add_group('nova', system_group=True)
add_user_to_group('nova', 'nova')
for d in dirs:
mkdir(d, owner='neutron', group='neutron', perms=0755, force=False)
@ -930,6 +942,8 @@ def git_post_install(projects_yaml):
render('git/neutron_sudoers',
'/etc/sudoers.d/neutron_sudoers', {}, perms=0o440)
render('git/nova_sudoers',
'/etc/sudoers.d/nova_sudoers', {}, perms=0o440)
render('git/cron.d/neutron-dhcp-agent-netns-cleanup',
'/etc/cron.d/neutron-dhcp-agent-netns-cleanup', {}, perms=0o755)
render('git/cron.d/neutron-l3-agent-netns-cleanup',
@ -937,269 +951,331 @@ def git_post_install(projects_yaml):
render('git/cron.d/neutron-lbaas-agent-netns-cleanup',
'/etc/cron.d/neutron-lbaas-agent-netns-cleanup', {}, perms=0o755)
service_name = 'quantum-gateway'
user_name = 'neutron'
bin_dir = os.path.join(git_pip_venv_dir(projects_yaml), 'bin')
neutron_api_context = {
'service_description': 'Neutron API server',
'service_name': service_name,
'process_name': 'neutron-server',
'executable_name': os.path.join(bin_dir, 'neutron-server'),
}
neutron_dhcp_agent_context = {
'service_description': 'Neutron DHCP Agent',
'service_name': service_name,
'process_name': 'neutron-dhcp-agent',
'executable_name': os.path.join(bin_dir, 'neutron-dhcp-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/dhcp_agent.ini'],
'log_file': '/var/log/neutron/dhcp-agent.log',
}
neutron_l3_agent_context = {
'service_description': 'Neutron L3 Agent',
'service_name': service_name,
'process_name': 'neutron-l3-agent',
'executable_name': os.path.join(bin_dir, 'neutron-l3-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/l3_agent.ini',
'/etc/neutron/fwaas_driver.ini'],
'log_file': '/var/log/neutron/l3-agent.log',
}
neutron_lbaas_agent_context = {
'service_description': 'Neutron LBaaS Agent',
'service_name': service_name,
'user_name': user_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-lbaas-agent',
'executable_name': os.path.join(bin_dir, 'neutron-lbaas-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/lbaas_agent.ini'],
'log_file': '/var/log/neutron/lbaas-agent.log',
}
neutron_metadata_agent_context = {
'service_description': 'Neutron Metadata Agent',
'service_name': service_name,
'user_name': user_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-metadata-agent',
'executable_name': os.path.join(bin_dir, 'neutron-metadata-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/metadata_agent.ini'],
'log_file': '/var/log/neutron/metadata-agent.log',
}
neutron_metering_agent_context = {
'service_description': 'Neutron Metering Agent',
'service_name': service_name,
'user_name': user_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-metering-agent',
'executable_name': os.path.join(bin_dir, 'neutron-metering-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/metering_agent.ini'],
'log_file': '/var/log/neutron/metering-agent.log',
}
neutron_ovs_cleanup_context = {
'service_description': 'Neutron OVS cleanup',
'service_name': service_name,
'user_name': user_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-ovs-cleanup',
'executable_name': os.path.join(bin_dir, 'neutron-ovs-cleanup'),
'config_file': '/etc/neutron/neutron.conf',
'log_file': '/var/log/neutron/ovs-cleanup.log',
}
neutron_plugin_bigswitch_context = {
'service_description': 'Neutron BigSwitch Plugin Agent',
'service_name': service_name,
'user_name': user_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-restproxy-agent',
'executable_name': os.path.join(bin_dir, 'neutron-restproxy-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/bigswitch/restproxy.ini'],
'log_file': '/var/log/neutron/bigswitch-agent.log',
}
neutron_plugin_ibm_context = {
'service_description': 'Neutron IBM SDN Plugin Agent',
'service_name': service_name,
'user_name': user_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-ibm-agent',
'executable_name': os.path.join(bin_dir, 'neutron-ibm-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/ibm/sdnve_neutron_plugin.ini'],
'log_file': '/var/log/neutron/ibm-agent.log',
}
neutron_plugin_linuxbridge_context = {
'service_description': 'Neutron Linux Bridge Plugin Agent',
'service_name': service_name,
'user_name': user_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-linuxbridge-agent',
'executable_name': os.path.join(bin_dir, 'neutron-linuxbridge-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/ml2/ml2_conf.ini'],
'log_file': '/var/log/neutron/linuxbridge-agent.log',
}
neutron_plugin_mlnx_context = {
'service_description': 'Neutron MLNX Plugin Agent',
'service_name': service_name,
'user_name': user_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-mlnx-agent',
'executable_name': os.path.join(bin_dir, 'neutron-mlnx-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/mlnx/mlnx_conf.ini'],
'log_file': '/var/log/neutron/mlnx-agent.log',
}
neutron_plugin_nec_context = {
'service_description': 'Neutron NEC Plugin Agent',
'service_name': service_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-nec-agent',
'executable_name': os.path.join(bin_dir, 'neutron-nec-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/nec/nec.ini'],
'log_file': '/var/log/neutron/nec-agent.log',
}
neutron_plugin_oneconvergence_context = {
'service_description': 'Neutron One Convergence Plugin Agent',
'service_name': service_name,
'user_name': user_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-nvsd-agent',
'executable_name': os.path.join(bin_dir, 'neutron-nvsd-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/oneconvergence/nvsdplugin.ini'],
'log_file': '/var/log/neutron/nvsd-agent.log',
}
neutron_plugin_openflow_context = {
'service_description': 'Neutron OpenFlow Plugin Agent',
'service_name': service_name,
'user_name': user_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-ofagent-agent',
'executable_name': os.path.join(bin_dir, 'neutron-ofagent-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/ml2/ml2_conf_ofa.ini'],
'log_file': '/var/log/neutron/openflow-agent.log',
}
neutron_plugin_openvswitch_context = {
'service_description': 'Neutron OpenvSwitch Plugin Agent',
'service_name': service_name,
'user_name': user_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-openvswitch-agent',
'executable_name': os.path.join(bin_dir, 'neutron-openvswitch-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/ml2/ml2_conf.ini'],
'log_file': '/var/log/neutron/openvswitch-agent.log',
}
neutron_plugin_ryu_context = {
'service_description': 'Neutron RYU Plugin Agent',
'service_name': service_name,
'user_name': user_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-ryu-agent',
'executable_name': os.path.join(bin_dir, 'neutron-ryu-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/ryu/ryu.ini'],
'log_file': '/var/log/neutron/ryu-agent.log',
}
neutron_plugin_sriov_context = {
'service_description': 'Neutron SRIOV SDN Plugin Agent',
'service_name': service_name,
'user_name': user_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-sriov-nic-agent',
'executable_name': os.path.join(bin_dir, 'neutron-sriov-nic-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/ml2/ml2_conf_sriov'],
'log_file': '/var/log/neutron/sriov-agent.log',
}
neutron_vpn_agent_context = {
'service_description': 'Neutron VPN Agent',
'service_name': service_name,
'process_name': 'neutron-vpn-agent',
'executable_name': os.path.join(bin_dir, 'neutron-vpn-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/vpn_agent.ini',
'/etc/neutron/l3_agent.ini',
'/etc/neutron/fwaas_driver.ini'],
'log_file': '/var/log/neutron/vpn_agent.log',
}
# Use systemd init units/scripts from ubuntu wily onward
if lsb_release()['DISTRIB_RELEASE'] >= '15.10':
templates_dir = os.path.join(charm_dir(), 'templates/git')
daemons = ['neutron-dhcp-agent', 'neutron-l3-agent',
'neutron-lbaas-agent', 'neutron-lbaasv2-agent',
'neutron-linuxbridge-agent', 'neutron-linuxbridge-cleanup',
'neutron-macvtap-agent', 'neutron-metadata-agent',
'neutron-metering-agent', 'neutron-openvswitch-agent',
'neutron-ovs-cleanup', 'neutron-server',
'neutron-sriov-nic-agent', 'neutron-vpn-agent',
'nova-api-metadata']
for daemon in daemons:
neutron_context = {
'daemon_path': os.path.join(bin_dir, daemon),
}
filename = daemon
if daemon == 'neutron-sriov-nic-agent':
filename = 'neutron-sriov-agent'
elif daemon == 'neutron-openvswitch-agent':
if os_release('neutron-common') < 'mitaka':
filename = 'neutron-plugin-openvswitch-agent'
template_file = 'git/{}.init.in.template'.format(filename)
init_in_file = '{}.init.in'.format(filename)
render(template_file, os.path.join(templates_dir, init_in_file),
neutron_context, perms=0o644)
git_generate_systemd_init_files(templates_dir)
# NOTE(coreycb): Needs systemd support
templates_dir = 'hooks/charmhelpers/contrib/openstack/templates'
templates_dir = os.path.join(charm_dir(), templates_dir)
render('git/upstart/neutron-agent.upstart',
'/etc/init/neutron-dhcp-agent.conf',
neutron_dhcp_agent_context, perms=0o644)
render('git/upstart/neutron-agent.upstart',
'/etc/init/neutron-l3-agent.conf',
neutron_l3_agent_context, perms=0o644)
render('git.upstart',
'/etc/init/neutron-lbaas-agent.conf',
neutron_lbaas_agent_context, perms=0o644,
templates_dir=templates_dir)
render('git.upstart',
'/etc/init/neutron-metadata-agent.conf',
neutron_metadata_agent_context, perms=0o644,
templates_dir=templates_dir)
render('git.upstart',
'/etc/init/neutron-metering-agent.conf',
neutron_metering_agent_context, perms=0o644,
templates_dir=templates_dir)
render('git.upstart',
'/etc/init/neutron-ovs-cleanup.conf',
neutron_ovs_cleanup_context, perms=0o644,
templates_dir=templates_dir)
render('git.upstart',
'/etc/init/neutron-plugin-bigswitch-agent.conf',
neutron_plugin_bigswitch_context, perms=0o644,
templates_dir=templates_dir)
render('git.upstart',
'/etc/init/neutron-plugin-ibm-agent.conf',
neutron_plugin_ibm_context, perms=0o644,
templates_dir=templates_dir)
render('git.upstart',
'/etc/init/neutron-plugin-linuxbridge-agent.conf',
neutron_plugin_linuxbridge_context, perms=0o644,
templates_dir=templates_dir)
render('git.upstart',
'/etc/init/neutron-plugin-mlnx-agent.conf',
neutron_plugin_mlnx_context, perms=0o644,
templates_dir=templates_dir)
render('git.upstart',
'/etc/init/neutron-plugin-nec-agent.conf',
neutron_plugin_nec_context, perms=0o644,
templates_dir=templates_dir)
render('git.upstart',
'/etc/init/neutron-plugin-oneconvergence-agent.conf',
neutron_plugin_oneconvergence_context, perms=0o644,
templates_dir=templates_dir)
render('git.upstart',
'/etc/init/neutron-plugin-openflow-agent.conf',
neutron_plugin_openflow_context, perms=0o644,
templates_dir=templates_dir)
render('git.upstart',
'/etc/init/neutron-plugin-openvswitch-agent.conf',
neutron_plugin_openvswitch_context, perms=0o644,
templates_dir=templates_dir)
render('git.upstart',
'/etc/init/neutron-plugin-ryu-agent.conf',
neutron_plugin_ryu_context, perms=0o644,
templates_dir=templates_dir)
render('git.upstart',
'/etc/init/neutron-plugin-sriov-agent.conf',
neutron_plugin_sriov_context, perms=0o644,
templates_dir=templates_dir)
render('git/upstart/neutron-server.upstart',
'/etc/init/neutron-server.conf',
neutron_api_context, perms=0o644)
render('git/upstart/neutron-agent.upstart',
'/etc/init/neutron-vpn-agent.conf',
neutron_vpn_agent_context, perms=0o644)
for daemon in daemons:
filename = daemon
if daemon == 'neutron-openvswitch-agent':
if os_release('neutron-common') < 'mitaka':
filename = 'neutron-plugin-openvswitch-agent'
service('enable', filename)
else:
service_name = 'quantum-gateway'
user_name = 'neutron'
neutron_api_context = {
'service_description': 'Neutron API server',
'service_name': service_name,
'process_name': 'neutron-server',
'executable_name': os.path.join(bin_dir, 'neutron-server'),
}
neutron_dhcp_agent_context = {
'service_description': 'Neutron DHCP Agent',
'service_name': service_name,
'process_name': 'neutron-dhcp-agent',
'executable_name': os.path.join(bin_dir, 'neutron-dhcp-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/dhcp_agent.ini'],
'log_file': '/var/log/neutron/dhcp-agent.log',
}
neutron_l3_agent_context = {
'service_description': 'Neutron L3 Agent',
'service_name': service_name,
'process_name': 'neutron-l3-agent',
'executable_name': os.path.join(bin_dir, 'neutron-l3-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/l3_agent.ini',
'/etc/neutron/fwaas_driver.ini'],
'log_file': '/var/log/neutron/l3-agent.log',
}
neutron_lbaas_agent_context = {
'service_description': 'Neutron LBaaS Agent',
'service_name': service_name,
'user_name': user_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-lbaas-agent',
'executable_name': os.path.join(bin_dir, 'neutron-lbaas-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/lbaas_agent.ini'],
'log_file': '/var/log/neutron/lbaas-agent.log',
}
neutron_metadata_agent_context = {
'service_description': 'Neutron Metadata Agent',
'service_name': service_name,
'user_name': user_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-metadata-agent',
'executable_name': os.path.join(bin_dir, 'neutron-metadata-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/metadata_agent.ini'],
'log_file': '/var/log/neutron/metadata-agent.log',
}
neutron_metering_agent_context = {
'service_description': 'Neutron Metering Agent',
'service_name': service_name,
'user_name': user_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-metering-agent',
'executable_name': os.path.join(bin_dir, 'neutron-metering-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/metering_agent.ini'],
'log_file': '/var/log/neutron/metering-agent.log',
}
neutron_ovs_cleanup_context = {
'service_description': 'Neutron OVS cleanup',
'service_name': service_name,
'user_name': user_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-ovs-cleanup',
'executable_name': os.path.join(bin_dir, 'neutron-ovs-cleanup'),
'config_file': '/etc/neutron/neutron.conf',
'log_file': '/var/log/neutron/ovs-cleanup.log',
}
neutron_plugin_bigswitch_context = {
'service_description': 'Neutron BigSwitch Plugin Agent',
'service_name': service_name,
'user_name': user_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-restproxy-agent',
'executable_name': os.path.join(bin_dir,
'neutron-restproxy-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/bigswitch/restproxy.ini'],
'log_file': '/var/log/neutron/bigswitch-agent.log',
}
neutron_plugin_ibm_context = {
'service_description': 'Neutron IBM SDN Plugin Agent',
'service_name': service_name,
'user_name': user_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-ibm-agent',
'executable_name': os.path.join(bin_dir, 'neutron-ibm-agent'),
'config_files':
['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/ibm/sdnve_neutron_plugin.ini'],
'log_file': '/var/log/neutron/ibm-agent.log',
}
neutron_plugin_linuxbridge_context = {
'service_description': 'Neutron Linux Bridge Plugin Agent',
'service_name': service_name,
'user_name': user_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-linuxbridge-agent',
'executable_name': os.path.join(bin_dir,
'neutron-linuxbridge-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/ml2/ml2_conf.ini'],
'log_file': '/var/log/neutron/linuxbridge-agent.log',
}
neutron_plugin_mlnx_context = {
'service_description': 'Neutron MLNX Plugin Agent',
'service_name': service_name,
'user_name': user_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-mlnx-agent',
'executable_name': os.path.join(bin_dir, 'neutron-mlnx-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/mlnx/mlnx_conf.ini'],
'log_file': '/var/log/neutron/mlnx-agent.log',
}
neutron_plugin_nec_context = {
'service_description': 'Neutron NEC Plugin Agent',
'service_name': service_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-nec-agent',
'executable_name': os.path.join(bin_dir, 'neutron-nec-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/nec/nec.ini'],
'log_file': '/var/log/neutron/nec-agent.log',
}
neutron_plugin_oneconvergence_context = {
'service_description': 'Neutron One Convergence Plugin Agent',
'service_name': service_name,
'user_name': user_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-nvsd-agent',
'executable_name': os.path.join(bin_dir, 'neutron-nvsd-agent'),
'config_files':
['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/oneconvergence/nvsdplugin.ini'],
'log_file': '/var/log/neutron/nvsd-agent.log',
}
neutron_plugin_openflow_context = {
'service_description': 'Neutron OpenFlow Plugin Agent',
'service_name': service_name,
'user_name': user_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-ofagent-agent',
'executable_name': os.path.join(bin_dir, 'neutron-ofagent-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/ml2/ml2_conf_ofa.ini'],
'log_file': '/var/log/neutron/openflow-agent.log',
}
neutron_plugin_openvswitch_context = {
'service_description': 'Neutron OpenvSwitch Plugin Agent',
'service_name': service_name,
'user_name': user_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-openvswitch-agent',
'executable_name': os.path.join(bin_dir,
'neutron-openvswitch-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/ml2/ml2_conf.ini'],
'log_file': '/var/log/neutron/openvswitch-agent.log',
}
neutron_plugin_ryu_context = {
'service_description': 'Neutron RYU Plugin Agent',
'service_name': service_name,
'user_name': user_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-ryu-agent',
'executable_name': os.path.join(bin_dir, 'neutron-ryu-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/ryu/ryu.ini'],
'log_file': '/var/log/neutron/ryu-agent.log',
}
neutron_plugin_sriov_context = {
'service_description': 'Neutron SRIOV SDN Plugin Agent',
'service_name': service_name,
'user_name': user_name,
'start_dir': '/var/lib/neutron',
'process_name': 'neutron-sriov-nic-agent',
'executable_name': os.path.join(bin_dir,
'neutron-sriov-nic-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/ml2/ml2_conf_sriov'],
'log_file': '/var/log/neutron/sriov-agent.log',
}
neutron_vpn_agent_context = {
'service_description': 'Neutron VPN Agent',
'service_name': service_name,
'process_name': 'neutron-vpn-agent',
'executable_name': os.path.join(bin_dir, 'neutron-vpn-agent'),
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/vpn_agent.ini',
'/etc/neutron/l3_agent.ini',
'/etc/neutron/fwaas_driver.ini'],
'log_file': '/var/log/neutron/vpn_agent.log',
}
service_name = 'nova-compute'
nova_user = 'nova'
start_dir = '/var/lib/nova'
nova_conf = '/etc/nova/nova.conf'
nova_api_metadata_context = {
'service_description': 'Nova Metadata API server',
'service_name': service_name,
'user_name': nova_user,
'start_dir': start_dir,
'process_name': 'nova-api-metadata',
'executable_name': os.path.join(bin_dir, 'nova-api-metadata'),
'config_files': [nova_conf],
}
templates_dir = 'hooks/charmhelpers/contrib/openstack/templates'
templates_dir = os.path.join(charm_dir(), templates_dir)
render('git/upstart/neutron-agent.upstart',
'/etc/init/neutron-dhcp-agent.conf',
neutron_dhcp_agent_context, perms=0o644)
render('git/upstart/neutron-agent.upstart',
'/etc/init/neutron-l3-agent.conf',
neutron_l3_agent_context, perms=0o644)
render('git.upstart',
'/etc/init/neutron-lbaas-agent.conf',
neutron_lbaas_agent_context, perms=0o644,
templates_dir=templates_dir)
render('git.upstart',
'/etc/init/neutron-metadata-agent.conf',
neutron_metadata_agent_context, perms=0o644,
templates_dir=templates_dir)
render('git.upstart',
'/etc/init/neutron-metering-agent.conf',
neutron_metering_agent_context, perms=0o644,
templates_dir=templates_dir)
render('git.upstart',
'/etc/init/neutron-ovs-cleanup.conf',
neutron_ovs_cleanup_context, perms=0o644,
templates_dir=templates_dir)
render('git.upstart',
'/etc/init/neutron-plugin-bigswitch-agent.conf',
neutron_plugin_bigswitch_context, perms=0o644,
templates_dir=templates_dir)
render('git.upstart',
'/etc/init/neutron-plugin-ibm-agent.conf',
neutron_plugin_ibm_context, perms=0o644,
templates_dir=templates_dir)
render('git.upstart',
'/etc/init/neutron-plugin-linuxbridge-agent.conf',
neutron_plugin_linuxbridge_context, perms=0o644,
templates_dir=templates_dir)
render('git.upstart',
'/etc/init/neutron-plugin-mlnx-agent.conf',
neutron_plugin_mlnx_context, perms=0o644,
templates_dir=templates_dir)
render('git.upstart',
'/etc/init/neutron-plugin-nec-agent.conf',
neutron_plugin_nec_context, perms=0o644,
templates_dir=templates_dir)
render('git.upstart',
'/etc/init/neutron-plugin-oneconvergence-agent.conf',
neutron_plugin_oneconvergence_context, perms=0o644,
templates_dir=templates_dir)
render('git.upstart',
'/etc/init/neutron-plugin-openflow-agent.conf',
neutron_plugin_openflow_context, perms=0o644,
templates_dir=templates_dir)
if os_release('neutron-common') < 'mitaka':
render('git.upstart',
'/etc/init/neutron-plugin-openvswitch-agent.conf',
neutron_plugin_openvswitch_context, perms=0o644,
templates_dir=templates_dir)
else:
render('git.upstart',
'/etc/init/neutron-openvswitch-agent.conf',
neutron_plugin_openvswitch_context, perms=0o644,
templates_dir=templates_dir)
render('git.upstart',
'/etc/init/neutron-plugin-ryu-agent.conf',
neutron_plugin_ryu_context, perms=0o644,
templates_dir=templates_dir)
render('git.upstart',
'/etc/init/neutron-plugin-sriov-agent.conf',
neutron_plugin_sriov_context, perms=0o644,
templates_dir=templates_dir)
render('git/upstart/neutron-server.upstart',
'/etc/init/neutron-server.conf',
neutron_api_context, perms=0o644)
render('git/upstart/neutron-agent.upstart',
'/etc/init/neutron-vpn-agent.conf',
neutron_vpn_agent_context, perms=0o644)
render('git.upstart',
'/etc/init/nova-api-metadata.conf',
nova_api_metadata_context, perms=0o644,
templates_dir=templates_dir)
def get_optional_interfaces():

View File

@ -0,0 +1,24 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: neutron-dhcp-agent
# Required-Start: $network $local_fs $remote_fs $syslog
# Required-Stop: $remote_fs
# Should-Start: mysql postgresql rabbitmq-server keystone neutron-ovs-cleanup
# Should-Stop: mysql postgresql rabbitmq-server keystone
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Neutron DHCP agent
# Description: Provide DHCP agent for neutron
### END INIT INFO
# Author: Mehdi Abaakouk <sileht@sileht.net>
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="OpenStack Neutron DHCP agent"
PROJECT_NAME=neutron
NAME=${PROJECT_NAME}-dhcp-agent
DAEMON={{ daemon_path }}
# --config-file=/etc/neutron/neutron.conf will be appended
# to DAEMON_ARGS later by openstack-pkg-tools
DAEMON_ARGS="--config-file=/etc/neutron/dhcp_agent.ini"

View File

@ -0,0 +1,25 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: neutron-l3-agent
# Required-Start: $network $local_fs $remote_fs $syslog
# Required-Stop: $remote_fs
# Should-Start: mysql postgresql rabbitmq-server keystone openvswitch-switch neutron-ovs-cleanup
# Should-Stop: mysql postgresql rabbitmq-server keystone openvswitch-switch
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Neutron L3 agent
# Description: Provide L3 agent for neutron
### END INIT INFO
# Authors: Mehdi Abaakouk <sileht@sileht.net>
# 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
DESC="OpenStack Neutron L3 agent"
PROJECT_NAME=neutron
NAME=${PROJECT_NAME}-l3-agent
DAEMON={{ daemon_path }}
# --config-file=/etc/neutron/neutron.conf will be appended
# to DAEMON_ARGS later by openstack-pkg-tools
DAEMON_ARGS="--config-file=/etc/neutron/l3_agent.ini --config-file=/etc/neutron/fwaas_driver.ini"

View File

@ -0,0 +1,24 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: neutron-lbaas-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 LBaaS agent
# Description: Provide LBaaS agent for neutron
### END INIT INFO
# 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
DESC="OpenStack Neutron LBaaS agent"
PROJECT_NAME=neutron
NAME=${PROJECT_NAME}-lbaas-agent
DAEMON={{ daemon_path }}
# --config-file=/etc/neutron/neutron.conf will be happened
# to DAEMON_ARGS later by openstack-pkg-tools
DAEMON_ARGS="--config-file=/etc/neutron/lbaas_agent.ini"

View File

@ -0,0 +1,24 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: neutron-lbaasv2-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 LBaaS v2 agent
# Description: Provide LBaaS v2 agent for neutron
### END INIT INFO
# Author: Corey Bryant <corey.bryant@canonical.com>
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="OpenStack Neutron LBaaSv2 agent"
PROJECT_NAME=neutron
NAME=${PROJECT_NAME}-lbaasv2-agent
DAEMON={{ daemon_path }}
# --config-file=/etc/neutron/neutron.conf will be happened
# to DAEMON_ARGS later by openstack-pkg-tools
DAEMON_ARGS="--config-file=/etc/neutron/lbaas_agent.ini"

View File

@ -0,0 +1,24 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: neutron-linuxbridge-agent
# Required-Start: $network $local_fs $remote_fs $syslog
# Required-Stop: $remote_fs
# Should-Start: mysql postgresql rabbitmq-server keystone neutron-linuxbridge-cleanup
# Should-Stop: mysql postgresql rabbitmq-server keystone
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Neutron LinuxBridge Agent
# Description: Agent to use within neutron linuxbridge client
### END INIT INFO
# Author: Ghe Rivero <ghe.rivero@stackops.com>
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Openstack Neutron LinuxBridge Agent"
PROJECT_NAME=neutron
NAME=${PROJECT_NAME}-linuxbridge-agent
DAEMON={{ daemon_path }}
# --config-file=/etc/neutron/neutron.conf will be appended
# to DAEMON_ARGS later by openstack-pkg-tools
DAEMON_ARGS="--config-file=/etc/neutron/plugins/ml2/linuxbridge_agent.ini"

View File

@ -0,0 +1,19 @@
[Unit]
Description=Openstack Neutron Linux Bridge Agent
After=mysql.service postgresql.service rabbitmq-server.service keystone.service
Requires=neutron-linuxbridge-cleanup.service
[Service]
User=neutron
Group=neutron
WorkingDirectory=/var/lib/neutron
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p /var/lock/neutron /var/log/neutron /var/lib/neutron
ExecStartPre=/bin/chown neutron:neutron /var/lock/neutron /var/log/neutron /var/lib/neutron
ExecStart=/etc/init.d/neutron-linuxbridge-agent systemd-start
Restart=on-failure
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,19 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: neutron-linuxbridge-cleanup
# Required-Start: $network $local_fs $remote_fs $syslog
# Required-Stop: $remote_fs
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Neutron Linux Bridge Cleanup
# Description: Linux Bridge Cleanup for OpenStack Neutron
### END INIT INFO
# Authors: Corey Bryant <corey.bryant@canonical.com>
DESC="OpenStack Neutron Linux bridge cleanup"
PROJECT_NAME=neutron
NAME=${PROJECT_NAME}-linuxbridge-cleanup
DAEMON={{ daemon_path }}

View File

@ -0,0 +1,17 @@
[Unit]
Description=OpenStack Neutron Linux bridge cleanup
[Service]
type=oneshot
User=neutron
Group=neutron
WorkingDirectory=/var/lib/neutron
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p /var/lock/neutron /var/log/neutron /var/lib/neutron
ExecStartPre=/bin/chown neutron:neutron /var/lock/neutron /var/log/neutron /var/lib/neutron
ExecStart=/etc/init.d/neutron-linuxbridge-cleanup systemd-start
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,24 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: neutron-macvtap-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 Macvtap L2 agent
# Description: Provide Macvtap L2 agent for Neutron
### END INIT INFO
# Author: Corey Bryant <corey.bryant@canonical.com>
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="OpenStack Neutron Macvtap L2 agent"
PROJECT_NAME=neutron
NAME=${PROJECT_NAME}-macvtap-agent
DAEMON={{ daemon_path }}
# --config-file=/etc/neutron/neutron.conf will be appended
# to DAEMON_ARGS later by openstack-pkg-tools
DAEMON_ARGS="--config-file=/etc/neutron/plugins/ml2/macvtap_agent.ini"

View File

@ -0,0 +1,24 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: neutron-metadata-agent
# Required-Start: $network $local_fs $remote_fs $syslog
# Required-Stop: $remote_fs
# Should-Start: mysql postgresql rabbitmq-server keystone openvswitch-switch
# Should-Stop: mysql postgresql rabbitmq-server keystone openvswitch-switch
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Neutron Metadata Agent agent
# Description: Provide Metadata agent for neutron
### END INIT INFO
# 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
DESC="OpenStack Neutron Metadata Agent"
PROJECT_NAME=neutron
NAME=${PROJECT_NAME}-metadata-agent
DAEMON={{ daemon_path }}
# --config-file=/etc/neutron/neutron.conf will be appended
# to DAEMON_ARGS later by openstack-pkg-tools
DAEMON_ARGS="--config-file=/etc/neutron/metadata_agent.ini"

View File

@ -0,0 +1,24 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: neutron-metering-agent
# Required-Start: $network $local_fs $remote_fs $syslog
# Required-Stop: $remote_fs
# Should-Start: mysql postgresql rabbitmq-server keystone openvswitch-switch
# Should-Stop: mysql postgresql rabbitmq-server keystone openvswitch-switch
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Neutron Metering Agent agent
# Description: Provides Metering agent for neutron
### END INIT INFO
# 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
DESC="OpenStack Neutron Metering Agent"
PROJECT_NAME=neutron
NAME=${PROJECT_NAME}-metering-agent
DAEMON={{ daemon_path }}
# --config-file=/etc/neutron/neutron.conf will be appended
# to DAEMON_ARGS later by openstack-pkg-tools
DAEMON_ARGS="--config-file=/etc/neutron/metering_agent.ini"

View File

@ -0,0 +1,20 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: neutron-openvswitch-agent
# Required-Start: $network $local_fs $remote_fs $syslog
# Required-Stop: $remote_fs openvswitch-switch
# Should-Start: mysql postgresql rabbitmq-server keystone neutron-ovs-cleanup
# Should-Stop: mysql postgresql rabbitmq-server keystone
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Neutron Open vSwitch Agent
# Description: Open vSwitch agent for OpenStack Neutron ML2 plugin
### END INIT INFO
# Authors: Julien Danjou <acid@debian.org>, Thomas Goirand <zigo@debian.org>
DESC="Openstack Neutron Open vSwitch Agent"
PROJECT_NAME=neutron
NAME=${PROJECT_NAME}-openvswitch-agent
DAEMON={{ daemon_path }}
DAEMON_ARGS="--config-file=/etc/neutron/plugins/ml2/openvswitch_agent.ini"

View File

@ -0,0 +1,19 @@
[Unit]
Description=Openstack Neutron Open vSwitch Plugin Agent
After=mysql.service postgresql.service rabbitmq-server.service keystone.service
Requires=neutron-ovs-cleanup.service
[Service]
User=neutron
Group=neutron
WorkingDirectory=/var/lib/neutron
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p /var/lock/neutron /var/log/neutron /var/lib/neutron
ExecStartPre=/bin/chown neutron:neutron /var/lock/neutron /var/log/neutron /var/lib/neutron
ExecStart=/etc/init.d/neutron-openvswitch-agent systemd-start
Restart=on-failure
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,19 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: neutron-ovs-cleanup
# Required-Start: $network $local_fs $remote_fs $syslog openvswitch-switch
# Required-Stop: $remote_fs
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Neutron OVS Cleanup
# Description: OpenvSwitch Cleanup for OpenStack Neutron
### END INIT INFO
# Authors: James Page <james.page@ubuntu.com>
DESC="OpenStack Neutron OVS cleanup"
PROJECT_NAME=neutron
NAME=${PROJECT_NAME}-ovs-cleanup
DAEMON={{ daemon_path }}

View File

@ -0,0 +1,17 @@
[Unit]
Description=OpenStack Neutron OVS cleanup
[Service]
type=oneshot
User=neutron
Group=neutron
WorkingDirectory=/var/lib/neutron
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p /var/lock/neutron /var/log/neutron /var/lib/neutron
ExecStartPre=/bin/chown neutron:neutron /var/lock/neutron /var/log/neutron /var/lib/neutron
ExecStart=/etc/init.d/neutron-ovs-cleanup systemd-start
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,20 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: neutron-plugin-openvswitch-agent
# Required-Start: $network $local_fs $remote_fs $syslog
# Required-Stop: $remote_fs openvswitch-switch
# Should-Start: mysql postgresql rabbitmq-server keystone neutron-ovs-cleanup
# Should-Stop: mysql postgresql rabbitmq-server keystone
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Neutron Open vSwitch Agent
# Description: Open vSwitch agent for OpenStack Neutron ML2 plugin
### END INIT INFO
# Authors: Julien Danjou <acid@debian.org>, Thomas Goirand <zigo@debian.org>
DESC="Openstack Neutron Open vSwitch Agent"
PROJECT_NAME=neutron
NAME=${PROJECT_NAME}-plugin-openvswitch-agent
DAEMON={{ daemon_path }}
DAEMON_ARGS="--config-file=/etc/neutron/plugins/ml2/openvswitch_agent.ini"

View File

@ -0,0 +1,19 @@
[Unit]
Description=Openstack Neutron Open vSwitch Plugin Agent
After=mysql.service postgresql.service rabbitmq-server.service keystone.service
Requires=neutron-ovs-cleanup.service
[Service]
User=neutron
Group=neutron
WorkingDirectory=/var/lib/neutron
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p /var/lock/neutron /var/log/neutron /var/lib/neutron
ExecStartPre=/bin/chown neutron:neutron /var/lock/neutron /var/log/neutron /var/lib/neutron
ExecStart=/etc/init.d/neutron-plugin-openvswitch-agent systemd-start
Restart=on-failure
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,19 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: neutron-server
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# 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-server
# Description: Provides the Neutron networking service
### END INIT INFO
DESC="OpenStack Neutron Server"
PROJECT_NAME=neutron
NAME=${PROJECT_NAME}-server
DAEMON={{ daemon_path }}
[ -r /etc/default/neutron-server ] && . /etc/default/neutron-server
[ -n "$NEUTRON_PLUGIN_CONFIG" ] && DAEMON_ARGS="--config-file=$NEUTRON_PLUGIN_CONFIG"

View File

@ -0,0 +1,22 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: neutron-sriov-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 SRIOV Agent
# Description: SRIOV agent for OpenStack Neutron
### END INIT INFO
# Authors: James Page <james.page@ubuntu.com>
DESC="OpenStack Neutron SRIOV Plugin Agent"
PROJECT_NAME=neutron
NAME=${PROJECT_NAME}-sriov-agent
DAEMON={{ daemon_path }}
# --config-file=/etc/neutron/neutron.conf will be appended
# to DAEMON_ARGS later by openstack-pkg-tools
DAEMON_ARGS="--config-file=/etc/neutron/plugins/ml2/sriov_agent.ini"

View File

@ -0,0 +1,24 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: neutron-vpn-agent
# Required-Start: $network $local_fs $remote_fs $syslog
# Required-Stop: $remote_fs
# Should-Start: mysql postgresql rabbitmq-server keystone openvswitch-switch neutron-ovs-cleanup
# Should-Stop: mysql postgresql rabbitmq-server keystone openvswitch-switch
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Neutron VPN Agent agent
# Description: Provides VPN agent for neutron
### END INIT INFO
# 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
DESC="OpenStack Neutron VPN Agent"
PROJECT_NAME=neutron
NAME=${PROJECT_NAME}-vpn-agent
DAEMON={{ daemon_path }}
# --config-file=/etc/neutron/neutron.conf will be happened
# to DAEMON_ARGS later by openstack-pkg-tools
DAEMON_ARGS="--config-file=/etc/neutron/l3_agent.ini --config-file=/etc/neutron/fwaas_driver.ini --config-file=/etc/neutron/vpn_agent.ini"

View File

@ -0,0 +1,21 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: nova-api-metadata
# Required-Start: $network $local_fs $remote_fs $syslog
# Required-Stop: $remote_fs
# Should-Start: postgresql mysql keystone rabbitmq-server ntp
# Should-Stop: postgresql mysql keystone rabbitmq-server ntp
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Nova API metadata server
# Description: Frontend Nova API metadata server
### END INIT INFO
# Author: Julien Danjou <acid@debian.org>
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="OpenStack Compute metadata API"
PROJECT_NAME=nova
NAME=${PROJECT_NAME}-api-metadata
DAEMON={{ daemon_path }}

View File

@ -0,0 +1,4 @@
Defaults:nova !requiretty
nova ALL = (root) NOPASSWD: /usr/local/bin/nova-rootwrap /etc/nova/rootwrap.conf *

View File

@ -20,16 +20,20 @@ TO_PATCH = [
'apt_upgrade',
'apt_install',
'configure_installation_source',
'git_src_dir',
'log',
'add_bridge',
'add_bridge_port',
'headers_package',
'full_restart',
'os_release',
'service',
'service_running',
'NetworkServiceContext',
'ExternalPortContext',
'unit_private_ip',
'relations_of_type',
'render',
'service_stop',
'determine_dkms_package',
'service_restart',
@ -793,18 +797,30 @@ class TestNeutronAgentReallocation(CharmTestCase):
core_project='neutron')
self.assertTrue(git_post.called)
@patch('subprocess.check_call')
@patch.object(neutron_utils, 'mkdir')
@patch.object(neutron_utils, 'write_file')
@patch.object(neutron_utils, 'add_user_to_group')
@patch.object(neutron_utils, 'add_group')
@patch.object(neutron_utils, 'adduser')
def test_git_pre_install(self, adduser, add_group, add_user_to_group,
write_file, mkdir):
write_file, mkdir, check_call):
neutron_utils.git_pre_install()
adduser.assert_called_with('neutron', shell='/bin/bash',
system_user=True)
add_group.assert_called_with('neutron', system_group=True)
add_user_to_group.assert_called_with('neutron', 'neutron')
expected = [
call('neutron', shell='/bin/bash', system_user=True),
call('nova', shell='/bin/bash', system_user=True),
]
self.assertEquals(adduser.call_args_list, expected)
expected = [
call('neutron', system_group=True),
call('nova', system_group=True),
]
self.assertEquals(add_group.call_args_list, expected)
expected = [
call('neutron', 'neutron'),
call('nova', 'nova'),
]
self.assertEquals(add_user_to_group.call_args_list, expected)
expected = [
call('/etc/neutron', owner='neutron',
group='neutron', perms=0755, force=False),
@ -820,6 +836,10 @@ class TestNeutronAgentReallocation(CharmTestCase):
group='neutron', perms=0755, force=False),
call('/var/log/neutron', owner='neutron',
group='neutron', perms=0755, force=False),
call('/var/lib/nova', owner='neutron',
group='neutron', perms=0755, force=False),
call('/var/log/nova', owner='neutron',
group='neutron', perms=0755, force=False),
]
self.assertEquals(mkdir.call_args_list, expected)
expected = [
@ -863,18 +883,18 @@ class TestNeutronAgentReallocation(CharmTestCase):
self.assertEquals(write_file.call_args_list, expected)
@patch('os.remove')
@patch.object(neutron_utils, 'git_src_dir')
@patch.object(neutron_utils, 'render')
@patch('os.path.join')
@patch('os.path.exists')
@patch('os.symlink')
@patch('shutil.rmtree')
@patch('shutil.copyfile')
@patch('shutil.copytree')
def test_git_post_install(self, copytree, copyfile, rmtree, symlink,
exists, join, render, git_src_dir, remove):
def test_git_post_install_upstart(self, copytree, copyfile, rmtree,
symlink, exists, join, remove):
projects_yaml = openstack_origin_git
join.return_value = 'joined-string'
self.lsb_release.return_value = {'DISTRIB_RELEASE': '15.04'}
self.os_release.return_value = 'liberty'
neutron_utils.git_post_install(projects_yaml)
expected = [
call('joined-string', '/etc/neutron'),
@ -1085,10 +1105,23 @@ class TestNeutronAgentReallocation(CharmTestCase):
'/etc/neutron/fwaas_driver.ini'],
'log_file': '/var/log/neutron/vpn_agent.log',
}
nova_api_metadata_context = {
'service_description': 'Nova Metadata API server',
'service_name': 'nova-compute',
'user_name': 'nova',
'start_dir': '/var/lib/nova',
'process_name': 'nova-api-metadata',
'executable_name': 'joined-string',
'config_files': ['/etc/nova/nova.conf'],
}
expected = [
call('git/neutron_sudoers',
'/etc/sudoers.d/neutron_sudoers',
{}, perms=0o440),
call('git/nova_sudoers',
'/etc/sudoers.d/nova_sudoers',
{}, perms=0o440),
call('git/cron.d/neutron-dhcp-agent-netns-cleanup',
'/etc/cron.d/neutron-dhcp-agent-netns-cleanup',
{}, perms=0o755),
@ -1166,8 +1199,92 @@ class TestNeutronAgentReallocation(CharmTestCase):
call('git/upstart/neutron-agent.upstart',
'/etc/init/neutron-vpn-agent.conf',
neutron_vpn_agent_context, perms=0o644),
call('git.upstart',
'/etc/init/nova-api-metadata.conf',
nova_api_metadata_context, perms=0o644,
templates_dir='joined-string'),
]
self.assertEquals(render.call_args_list, expected)
self.assertEquals(self.render.call_args_list, expected)
@patch('os.listdir')
@patch('os.remove')
@patch('os.path.join')
@patch('os.path.exists')
@patch('os.symlink')
@patch('shutil.rmtree')
@patch('shutil.copyfile')
@patch('shutil.copytree')
def test_git_post_install_systemd(self, copytree, copyfile, rmtree,
symlink, exists, join, remove, listdir):
projects_yaml = openstack_origin_git
join.return_value = 'joined-string'
self.lsb_release.return_value = {'DISTRIB_RELEASE': '15.10'}
self.os_release.return_value = 'xenial'
neutron_utils.git_post_install(projects_yaml)
expected = [
call('git/neutron_sudoers',
'/etc/sudoers.d/neutron_sudoers',
{}, perms=288),
call('git/nova_sudoers',
'/etc/sudoers.d/nova_sudoers',
{}, perms=288),
call('git/cron.d/neutron-dhcp-agent-netns-cleanup',
'/etc/cron.d/neutron-dhcp-agent-netns-cleanup',
{}, perms=493),
call('git/cron.d/neutron-l3-agent-netns-cleanup',
'/etc/cron.d/neutron-l3-agent-netns-cleanup',
{}, perms=493),
call('git/cron.d/neutron-lbaas-agent-netns-cleanup',
'/etc/cron.d/neutron-lbaas-agent-netns-cleanup',
{}, perms=493),
call('git/neutron-dhcp-agent.init.in.template',
'joined-string', {'daemon_path': 'joined-string'},
perms=420),
call('git/neutron-l3-agent.init.in.template',
'joined-string', {'daemon_path': 'joined-string'},
perms=420),
call('git/neutron-lbaas-agent.init.in.template',
'joined-string', {'daemon_path': 'joined-string'},
perms=420),
call('git/neutron-lbaasv2-agent.init.in.template',
'joined-string', {'daemon_path': 'joined-string'},
perms=420),
call('git/neutron-linuxbridge-agent.init.in.template',
'joined-string', {'daemon_path': 'joined-string'},
perms=420),
call('git/neutron-linuxbridge-cleanup.init.in.template',
'joined-string', {'daemon_path': 'joined-string'},
perms=420),
call('git/neutron-macvtap-agent.init.in.template',
'joined-string', {'daemon_path': 'joined-string'},
perms=420),
call('git/neutron-metadata-agent.init.in.template',
'joined-string', {'daemon_path': 'joined-string'},
perms=420),
call('git/neutron-metering-agent.init.in.template',
'joined-string', {'daemon_path': 'joined-string'},
perms=420),
call('git/neutron-openvswitch-agent.init.in.template',
'joined-string', {'daemon_path': 'joined-string'},
perms=420),
call('git/neutron-ovs-cleanup.init.in.template',
'joined-string', {'daemon_path': 'joined-string'},
perms=420),
call('git/neutron-server.init.in.template',
'joined-string', {'daemon_path': 'joined-string'},
perms=420),
call('git/neutron-sriov-agent.init.in.template',
'joined-string', {'daemon_path': 'joined-string'},
perms=420),
call('git/neutron-vpn-agent.init.in.template',
'joined-string', {'daemon_path': 'joined-string'},
perms=420),
call('git/nova-api-metadata.init.in.template',
'joined-string', {'daemon_path': 'joined-string'},
perms=420),
]
self.assertEquals(self.render.call_args_list, expected)
def test_assess_status(self):
with patch.object(neutron_utils, 'assess_status_func') as asf: