Make /etc/default/libvirt-bin systemd compatible
When running under systemd libvirtd should not use the daemon mode flag '-d' as systemd looses track of the process and marks it as dead. Change-Id: I5f22e00338373e4d2218f1bbdb906e6a24c332e2 Closes-Bug: 1567180
This commit is contained in:
parent
32f17c9462
commit
390880e3df
@ -4,7 +4,11 @@ import platform
|
|||||||
|
|
||||||
from charmhelpers.core.unitdata import kv
|
from charmhelpers.core.unitdata import kv
|
||||||
from charmhelpers.contrib.openstack import context
|
from charmhelpers.contrib.openstack import context
|
||||||
from charmhelpers.core.host import service_running, service_start
|
from charmhelpers.core.host import (
|
||||||
|
lsb_release,
|
||||||
|
service_running,
|
||||||
|
service_start,
|
||||||
|
)
|
||||||
from charmhelpers.fetch import apt_install, filter_installed_packages
|
from charmhelpers.fetch import apt_install, filter_installed_packages
|
||||||
from charmhelpers.core.hookenv import (
|
from charmhelpers.core.hookenv import (
|
||||||
config,
|
config,
|
||||||
@ -100,12 +104,13 @@ class NovaComputeLibvirtContext(context.OSContextGenerator):
|
|||||||
def __call__(self):
|
def __call__(self):
|
||||||
# distro defaults
|
# distro defaults
|
||||||
ctxt = {
|
ctxt = {
|
||||||
# /etc/default/libvirt-bin
|
|
||||||
'libvirtd_opts': '-d',
|
|
||||||
# /etc/libvirt/libvirtd.conf (
|
# /etc/libvirt/libvirtd.conf (
|
||||||
'listen_tls': 0,
|
'listen_tls': 0
|
||||||
}
|
}
|
||||||
|
if lsb_release()['DISTRIB_CODENAME'].lower() < "wily":
|
||||||
|
ctxt['libvirtd_opts'] = '-d'
|
||||||
|
else:
|
||||||
|
ctxt['libvirtd_opts'] = ''
|
||||||
# get the processor architecture to use in the nova.conf template
|
# get the processor architecture to use in the nova.conf template
|
||||||
ctxt['arch'] = platform.machine()
|
ctxt['arch'] = platform.machine()
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ TO_PATCH = [
|
|||||||
'log',
|
'log',
|
||||||
'_save_flag_file',
|
'_save_flag_file',
|
||||||
'unit_get',
|
'unit_get',
|
||||||
|
'lsb_release',
|
||||||
]
|
]
|
||||||
|
|
||||||
NEUTRON_CONTEXT = {
|
NEUTRON_CONTEXT = {
|
||||||
@ -217,6 +218,18 @@ class NovaComputeContextTests(CharmTestCase):
|
|||||||
self.assertEqual(libvirt()['host_uuid'],
|
self.assertEqual(libvirt()['host_uuid'],
|
||||||
'73874c1c-ba48-406d-8d99-ac185d83b9bc')
|
'73874c1c-ba48-406d-8d99-ac185d83b9bc')
|
||||||
|
|
||||||
|
def test_libvirt_opts_trusty(self):
|
||||||
|
self.kv.return_value = FakeUnitdata(**{'host_uuid': self.host_uuid})
|
||||||
|
self.lsb_release.return_value = {'DISTRIB_CODENAME': 'trusty'}
|
||||||
|
libvirt = context.NovaComputeLibvirtContext()
|
||||||
|
self.assertEqual(libvirt()['libvirtd_opts'], '-d')
|
||||||
|
|
||||||
|
def test_libvirt_opts_xenial(self):
|
||||||
|
self.kv.return_value = FakeUnitdata(**{'host_uuid': self.host_uuid})
|
||||||
|
self.lsb_release.return_value = {'DISTRIB_CODENAME': 'xenial'}
|
||||||
|
libvirt = context.NovaComputeLibvirtContext()
|
||||||
|
self.assertEqual(libvirt()['libvirtd_opts'], '')
|
||||||
|
|
||||||
@patch.object(context.NeutronComputeContext, 'network_manager')
|
@patch.object(context.NeutronComputeContext, 'network_manager')
|
||||||
@patch.object(context.NeutronComputeContext, 'plugin')
|
@patch.object(context.NeutronComputeContext, 'plugin')
|
||||||
def test_disable_security_groups_true(self, plugin, nm):
|
def test_disable_security_groups_true(self, plugin, nm):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user