Add systemd support for the nova-compute daemon
Add support systemd daemon support. Activate the virtualenv prior to executing the nova-compute daemon to ensure that the nova users LXD SSL certificates are accessible. Change-Id: Ibadc2a0e1ac1ee7ad0cd1f25b539fff6289c358e Signed-off-by: Chuck Short <chuck.short@canonical.com>
This commit is contained in:
parent
5ae65ad14f
commit
fd84739de8
@ -25,6 +25,7 @@ from charmhelpers.core.host import (
|
|||||||
service_restart,
|
service_restart,
|
||||||
lsb_release,
|
lsb_release,
|
||||||
write_file,
|
write_file,
|
||||||
|
init_is_systemd,
|
||||||
)
|
)
|
||||||
|
|
||||||
from charmhelpers.core.hookenv import (
|
from charmhelpers.core.hookenv import (
|
||||||
@ -770,14 +771,31 @@ def git_post_install(projects_yaml):
|
|||||||
'executable_name': os.path.join(bin_dir, 'nova-api'),
|
'executable_name': os.path.join(bin_dir, 'nova-api'),
|
||||||
'config_files': [nova_conf],
|
'config_files': [nova_conf],
|
||||||
}
|
}
|
||||||
nova_compute_context = {
|
# Use systemd init units/scripts from ubuntu wily onwar
|
||||||
'service_description': 'Nova compute worker',
|
if init_is_systemd():
|
||||||
'service_name': service_name,
|
activate_path = os.path.join(git_pip_venv_dir(projects_yaml), 'bin',
|
||||||
'user_name': nova_user,
|
'activate')
|
||||||
'process_name': 'nova-compute',
|
nova_compute_context = {
|
||||||
'executable_name': os.path.join(bin_dir, 'nova-compute'),
|
'daemon_path': os.path.join(bin_dir, 'nova-compute'),
|
||||||
'config_files': [nova_conf, '/etc/nova/nova-compute.conf'],
|
'activate_path': activate_path,
|
||||||
}
|
}
|
||||||
|
templates_dir = os.path.join(charm_dir(), 'templates/git')
|
||||||
|
render('git/nova-compute.system.in.template',
|
||||||
|
'/lib/systemd/system/nova-compute.service',
|
||||||
|
nova_compute_context, perms=0o644)
|
||||||
|
else:
|
||||||
|
nova_compute_context = {
|
||||||
|
'service_description': 'Nova compute worker',
|
||||||
|
'service_name': service_name,
|
||||||
|
'user_name': nova_user,
|
||||||
|
'process_name': 'nova-compute',
|
||||||
|
'executable_name': os.path.join(bin_dir, 'nova-compute'),
|
||||||
|
'config_files': [nova_conf, '/etc/nova/nova-compute.conf'],
|
||||||
|
}
|
||||||
|
render('git/upstart/nova-compute.upstart',
|
||||||
|
'/etc/init/nova-compute.conf',
|
||||||
|
nova_compute_context, perms=0o644)
|
||||||
|
|
||||||
nova_network_context = {
|
nova_network_context = {
|
||||||
'service_description': 'Nova network worker',
|
'service_description': 'Nova network worker',
|
||||||
'service_name': service_name,
|
'service_name': service_name,
|
||||||
@ -795,8 +813,6 @@ def git_post_install(projects_yaml):
|
|||||||
nova_api_metadata_context, perms=0o644, templates_dir=templates_dir)
|
nova_api_metadata_context, perms=0o644, templates_dir=templates_dir)
|
||||||
render('git.upstart', '/etc/init/nova-api.conf',
|
render('git.upstart', '/etc/init/nova-api.conf',
|
||||||
nova_api_context, perms=0o644, templates_dir=templates_dir)
|
nova_api_context, perms=0o644, templates_dir=templates_dir)
|
||||||
render('git/upstart/nova-compute.upstart', '/etc/init/nova-compute.conf',
|
|
||||||
nova_compute_context, perms=0o644)
|
|
||||||
render('git.upstart', '/etc/init/nova-network.conf',
|
render('git.upstart', '/etc/init/nova-network.conf',
|
||||||
nova_network_context, perms=0o644, templates_dir=templates_dir)
|
nova_network_context, perms=0o644, templates_dir=templates_dir)
|
||||||
|
|
||||||
|
17
templates/git/nova-compute.system.in.template
Normal file
17
templates/git/nova-compute.system.in.template
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=OpenStack Compute
|
||||||
|
After=libvirtd.service postgresql.service mysql.service keystone.service rabbitmq-server.service ntp.service neutron-ovs-cleanup.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=nova
|
||||||
|
Group=nova
|
||||||
|
WorkingDirectory=/var/lib/nova
|
||||||
|
PermissionsStartOnly=true
|
||||||
|
ExecStartPre=/bin/mkdir -p /var/lock/nova /var/log/nova /var/lib/nova
|
||||||
|
ExecStartPre=/bin/chown nova:nova /var/lock/nova /var/log/nova /var/lib/nova
|
||||||
|
ExecStart=/bin/bash -c "source {{activate_path}} ;{{ daemon_path }} --config-file=/etc/nova/nova.conf --config-file=/etc/nova/nova-compute.conf"
|
||||||
|
Restart=on-failure
|
||||||
|
LimitNOFILE=65535
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
@ -683,15 +683,15 @@ class NovaComputeUtilsTests(CharmTestCase):
|
|||||||
{}, perms=0o644),
|
{}, perms=0o644),
|
||||||
call('git/nova_sudoers', '/etc/sudoers.d/nova_sudoers',
|
call('git/nova_sudoers', '/etc/sudoers.d/nova_sudoers',
|
||||||
{}, perms=0o440),
|
{}, perms=0o440),
|
||||||
|
call('git/upstart/nova-compute.upstart',
|
||||||
|
'/etc/init/nova-compute.conf',
|
||||||
|
nova_compute_context, perms=420),
|
||||||
call('git.upstart', '/etc/init/nova-api-metadata.conf',
|
call('git.upstart', '/etc/init/nova-api-metadata.conf',
|
||||||
nova_api_metadata_context, perms=0o644,
|
nova_api_metadata_context, perms=0o644,
|
||||||
templates_dir='joined-string'),
|
templates_dir='joined-string'),
|
||||||
call('git.upstart', '/etc/init/nova-api.conf',
|
call('git.upstart', '/etc/init/nova-api.conf',
|
||||||
nova_api_context, perms=0o644,
|
nova_api_context, perms=0o644,
|
||||||
templates_dir='joined-string'),
|
templates_dir='joined-string'),
|
||||||
call('git/upstart/nova-compute.upstart',
|
|
||||||
'/etc/init/nova-compute.conf',
|
|
||||||
nova_compute_context, perms=0o644),
|
|
||||||
call('git.upstart', '/etc/init/nova-network.conf',
|
call('git.upstart', '/etc/init/nova-network.conf',
|
||||||
nova_network_context, perms=0o644,
|
nova_network_context, perms=0o644,
|
||||||
templates_dir='joined-string'),
|
templates_dir='joined-string'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user