Gate install of tmpfiles configuration
The vhost-user tmpfiles configuration is only applicable in deployments using libvirt/kvm with nova-compute. Ensure appropriate user and group exists before installing tmpfiles.d configuration. Change-Id: I471ff459e5f979cb6781193fb074f6f5f7ee967f Closes-Bug: 1792414
This commit is contained in:
parent
e268b1bc43
commit
3b72caa031
@ -67,6 +67,8 @@ from charmhelpers.core.host import (
|
||||
service_running,
|
||||
CompareHostReleases,
|
||||
init_is_systemd,
|
||||
group_exists,
|
||||
user_exists,
|
||||
)
|
||||
|
||||
from charmhelpers.fetch import (
|
||||
@ -445,7 +447,10 @@ def enable_ovs_dpdk():
|
||||
|
||||
def install_tmpfilesd():
|
||||
'''Install systemd-tmpfiles configuration for ovs vhost-user sockets'''
|
||||
if init_is_systemd():
|
||||
# NOTE(jamespage): Only do this if libvirt is actually installed
|
||||
if (init_is_systemd() and
|
||||
user_exists('libvirt-qemu') and
|
||||
group_exists('kvm')):
|
||||
shutil.copy('files/nova-ovs-vhost-user.conf',
|
||||
'/etc/tmpfiles.d')
|
||||
subprocess.check_call(['systemd-tmpfiles', '--create'])
|
||||
|
@ -61,6 +61,9 @@ TO_PATCH = [
|
||||
'disable_ipfix',
|
||||
'ovs_has_late_dpdk_init',
|
||||
'parse_data_port_mappings',
|
||||
'user_exists',
|
||||
'group_exists',
|
||||
'init_is_systemd',
|
||||
]
|
||||
|
||||
head_pkg = 'linux-headers-3.15.0-5-generic'
|
||||
@ -782,6 +785,28 @@ class TestNeutronOVSUtils(CharmTestCase):
|
||||
|
||||
self.assertTrue(self.remote_restart.called)
|
||||
|
||||
@patch.object(nutils, 'subprocess')
|
||||
@patch.object(nutils, 'shutil')
|
||||
def test_install_tmpfilesd_lxd(self, mock_shutil, mock_subprocess):
|
||||
self.init_is_systemd.return_value = True
|
||||
self.group_exists.return_value = False
|
||||
self.user_exists.return_value = False
|
||||
nutils.install_tmpfilesd()
|
||||
mock_shutil.copy.assert_not_called()
|
||||
mock_subprocess.check_call.assert_not_called()
|
||||
|
||||
@patch.object(nutils, 'subprocess')
|
||||
@patch.object(nutils, 'shutil')
|
||||
def test_install_tmpfilesd_libvirt(self, mock_shutil, mock_subprocess):
|
||||
self.init_is_systemd.return_value = True
|
||||
self.group_exists.return_value = True
|
||||
self.user_exists.return_value = True
|
||||
nutils.install_tmpfilesd()
|
||||
mock_shutil.copy.assert_called_once()
|
||||
mock_subprocess.check_call.assert_called_once_with(
|
||||
['systemd-tmpfiles', '--create']
|
||||
)
|
||||
|
||||
|
||||
class TestDPDKBridgeBondMap(CharmTestCase):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user