diff --git a/hooks/charmhelpers/contrib/openstack/context.py b/hooks/charmhelpers/contrib/openstack/context.py index 2adf2cb8..ea93159d 100644 --- a/hooks/charmhelpers/contrib/openstack/context.py +++ b/hooks/charmhelpers/contrib/openstack/context.py @@ -1393,6 +1393,10 @@ class NeutronAPIContext(OSContextGenerator): 'rel_key': 'enable-l3ha', 'default': False, }, + 'dns_domain': { + 'rel_key': 'dns-domain', + 'default': None, + }, } ctxt = self.get_neutron_options({}) for rid in relation_ids('neutron-plugin-api'): diff --git a/hooks/neutron_contexts.py b/hooks/neutron_contexts.py index 4d82b783..cf0abcbf 100644 --- a/hooks/neutron_contexts.py +++ b/hooks/neutron_contexts.py @@ -91,6 +91,7 @@ class NeutronGatewayContext(NeutronAPIContext): 'l2_population': api_settings['l2_population'], 'enable_dvr': api_settings['enable_dvr'], 'enable_l3ha': api_settings['enable_l3ha'], + 'dns_domain': api_settings['dns_domain'], 'overlay_network_type': api_settings['overlay_network_type'], 'enable_metadata_network': config('enable-metadata-network'), diff --git a/templates/mitaka/dhcp_agent.ini b/templates/mitaka/dhcp_agent.ini index f2f2fea1..f6fcea29 100644 --- a/templates/mitaka/dhcp_agent.ini +++ b/templates/mitaka/dhcp_agent.ini @@ -12,6 +12,14 @@ root_helper = sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf dnsmasq_config_file = /etc/neutron/dnsmasq.conf {% endif -%} +{% if dns_domain -%} +dns_domain = {{ dns_domain }} +# Per LP#1583769, dhcp_domain needs to be configured as well. Additional +# testing shows that this has not been changed in newton, so will also +# specify the dhcp_domain field. +dhcp_domain = {{ dns_domain }} +{% endif -%} + enable_metadata_network = {{ enable_metadata_network }} enable_isolated_metadata = {{ enable_isolated_metadata }} diff --git a/unit_tests/test_neutron_contexts.py b/unit_tests/test_neutron_contexts.py index 5f32acbc..d2f73125 100644 --- a/unit_tests/test_neutron_contexts.py +++ b/unit_tests/test_neutron_contexts.py @@ -131,7 +131,8 @@ class TestNeutronGatewayContext(CharmTestCase): 'enable-dvr': 'True', 'overlay-network-type': 'gre', 'enable-l3ha': 'True', - 'network-device-mtu': 9000} + 'network-device-mtu': 9000, + 'dns-domain': 'openstack.example.'} self.test_config.set('plugin', 'ovs') self.test_config.set('debug', False) self.test_config.set('verbose', True) @@ -153,6 +154,7 @@ class TestNeutronGatewayContext(CharmTestCase): 'shared_secret': 'testsecret', 'enable_dvr': True, 'enable_l3ha': True, + 'dns_domain': 'openstack.example.', 'local_ip': '10.5.0.1', 'instance_mtu': 1420, 'core_plugin': "ml2", @@ -183,7 +185,8 @@ class TestNeutronGatewayContext(CharmTestCase): 'enable-dvr': 'True', 'overlay-network-type': 'gre', 'enable-l3ha': 'True', - 'network-device-mtu': 9000} + 'network-device-mtu': 9000, + 'dns-domain': 'openstack.example.'} self.test_config.set('plugin', 'ovs') self.test_config.set('debug', False) self.test_config.set('verbose', True) @@ -205,6 +208,7 @@ class TestNeutronGatewayContext(CharmTestCase): 'shared_secret': 'testsecret', 'enable_dvr': True, 'enable_l3ha': True, + 'dns_domain': 'openstack.example.', 'local_ip': '192.168.20.2', 'instance_mtu': 1420, 'core_plugin': "ml2",