Adds Neutron OVS agent config to DHCP daemon
The neutron-dhcp-agent might rely on options defined in openvswitch_agent.ini. By default this config file is not passed to neutron-dhcp-agent daemon, and therefore those options are not loaded and fall back for the default values and by that inhibits the desired behavior. Charm helpers' PR: https://github.com/juju/charm-helpers/pull/615 Depends-on: I39024855c3e42ee135b6ad5e7618a770219b6994 Closes-bug: #1832021 Change-Id: I134c8077ee52ccdb4e383109ecbea27ed1633fb8
This commit is contained in:
parent
7ad1afeb74
commit
1f6e29fbe2
@ -2379,6 +2379,12 @@ class DHCPAgentContext(OSContextGenerator):
|
||||
ctxt['enable_metadata_network'] = True
|
||||
ctxt['enable_isolated_metadata'] = True
|
||||
|
||||
ctxt['append_ovs_config'] = False
|
||||
cmp_release = CompareOpenStackReleases(
|
||||
os_release('neutron-common', base='icehouse'))
|
||||
if cmp_release >= 'queens' and config('enable-dpdk'):
|
||||
ctxt['append_ovs_config'] = True
|
||||
|
||||
return ctxt
|
||||
|
||||
@staticmethod
|
||||
|
@ -147,6 +147,7 @@ PURGE_PACKAGES = [
|
||||
PHY_NIC_MTU_CONF = '/etc/init/os-charm-phy-nic-mtu.conf'
|
||||
TEMPLATES = 'templates/'
|
||||
OVS_DEFAULT = '/etc/default/openvswitch-switch'
|
||||
NEUTRON_DHCP_DEFAULT = '/etc/default/neutron-dhcp-agent'
|
||||
DPDK_INTERFACES = '/etc/dpdk/interfaces'
|
||||
NEUTRON_SRIOV_AGENT_CONF = os.path.join(NEUTRON_CONF_DIR,
|
||||
'plugins/ml2/sriov_agent.ini')
|
||||
@ -211,6 +212,10 @@ DHCP_RESOURCE_MAP = OrderedDict([
|
||||
'services': ['neutron-dhcp-agent'],
|
||||
'contexts': [DHCPAgentContext()],
|
||||
}),
|
||||
(NEUTRON_DHCP_DEFAULT, {
|
||||
'services': ['neutron-dhcp-agent'],
|
||||
'contexts': [DHCPAgentContext()],
|
||||
}),
|
||||
])
|
||||
DVR_RESOURCE_MAP = OrderedDict([
|
||||
(NEUTRON_L3_AGENT_CONF, {
|
||||
@ -387,6 +392,8 @@ def resource_map():
|
||||
"""
|
||||
drop_config = []
|
||||
resource_map = deepcopy(BASE_RESOURCE_MAP)
|
||||
# Remap any service names as required
|
||||
_os_release = os_release('neutron-common', base='icehouse')
|
||||
if use_dvr():
|
||||
resource_map.update(DVR_RESOURCE_MAP)
|
||||
resource_map.update(METADATA_RESOURCE_MAP)
|
||||
@ -397,8 +404,8 @@ def resource_map():
|
||||
resource_map.update(DHCP_RESOURCE_MAP)
|
||||
metadata_services = ['neutron-metadata-agent', 'neutron-dhcp-agent']
|
||||
resource_map[NEUTRON_CONF]['services'] += metadata_services
|
||||
# Remap any service names as required
|
||||
_os_release = os_release('neutron-common', base='icehouse')
|
||||
if use_dpdk() and CompareOpenStackReleases(_os_release) >= 'queens':
|
||||
resource_map[OVS_CONF]['services'] += ['neutron-dhcp-agent']
|
||||
if CompareOpenStackReleases(_os_release) >= 'mitaka':
|
||||
# ml2_conf.ini -> openvswitch_agent.ini
|
||||
drop_config.append(ML2_CONF)
|
||||
|
11
templates/neutron-dhcp-agent
Normal file
11
templates/neutron-dhcp-agent
Normal file
@ -0,0 +1,11 @@
|
||||
# This is a POSIX shell fragment -*- sh -*-
|
||||
###############################################################################
|
||||
# [ WARNING ]
|
||||
# Configuration file maintained by Juju. Local changes may be overwritten.
|
||||
# Configuration managed by neutron-openvswitch charm
|
||||
# Service restart triggered by remote application: {{ restart_trigger }}
|
||||
# {{ restart_trigger_ovs }}
|
||||
###############################################################################
|
||||
{% if append_ovs_config -%}
|
||||
DAEMON_ARGS="$DAEMON_ARGS --config-file=/etc/neutron/plugins/ml2/openvswitch_agent.ini"
|
||||
{% endif -%}
|
@ -569,10 +569,13 @@ class TestNeutronOVSUtils(CharmTestCase):
|
||||
@patch.object(nutils, 'use_l3ha')
|
||||
@patch.object(nutils, 'use_dpdk')
|
||||
@patch.object(nutils, 'use_dvr')
|
||||
def test_restart_map(self, mock_use_dvr, mock_use_dpdk, mock_use_l3ha):
|
||||
@patch.object(nutils, 'enable_local_dhcp')
|
||||
def test_restart_map(self, mock_enable_local_dhcp, mock_use_dvr,
|
||||
mock_use_dpdk, mock_use_l3ha):
|
||||
mock_use_dvr.return_value = False
|
||||
mock_use_l3ha.return_value = False
|
||||
mock_use_dpdk.return_value = False
|
||||
mock_enable_local_dhcp.return_value = False
|
||||
self.os_release.return_value = "mitaka"
|
||||
self.lsb_release.return_value = {'DISTRIB_CODENAME': 'xenial'}
|
||||
ML2CONF = "/etc/neutron/plugins/ml2/openvswitch_agent.ini"
|
||||
@ -580,7 +583,7 @@ class TestNeutronOVSUtils(CharmTestCase):
|
||||
expect = OrderedDict([
|
||||
(nutils.NEUTRON_CONF, ['neutron-openvswitch-agent']),
|
||||
(ML2CONF, ['neutron-openvswitch-agent']),
|
||||
(nutils.OVS_DEFAULT, ['openvswitch-switch']),
|
||||
(nutils.OVS_DEFAULT, ['openvswitch-switch'])
|
||||
])
|
||||
for item in _restart_map:
|
||||
self.assertTrue(item in _restart_map)
|
||||
|
Loading…
Reference in New Issue
Block a user