Add dnsmasq_local_resolv option

Add 'dnsmasq_local_resolv' option support to Enables the dnsmasq
service to provide name resolution for instances via DNS resolvers
on the host running the DHCP agent.

Change-Id: I451777a573fd31dd5d6732303956f17bb67c22e0
Closes-Bug: #1728795
This commit is contained in:
ZhongShengping 2017-11-01 15:13:45 +08:00
parent 0a2b0141a8
commit c8f2190761
3 changed files with 26 additions and 2 deletions

View File

@ -45,6 +45,11 @@
# (optional) List of servers to use as dnsmasq forwarders.
# Defaults to $::os_service_default.
#
# [*dnsmasq_local_resolv*]
# (optional) Enables the dnsmasq service to provide name resolution for instances
# via DNS resolvers on the host running the DHCP agent.
# Defaults to $::os_service_default.
#
# [*enable_isolated_metadata*]
# (optional) enable metadata support on isolated networks.
# Defaults to false.
@ -96,6 +101,7 @@ class neutron::agents::dhcp (
$root_helper = 'sudo neutron-rootwrap /etc/neutron/rootwrap.conf',
$dnsmasq_config_file = $::os_service_default,
$dnsmasq_dns_servers = $::os_service_default,
$dnsmasq_local_resolv = $::os_service_default,
$enable_isolated_metadata = false,
$enable_force_metadata = $::os_service_default,
$enable_metadata_network = false,
@ -138,6 +144,7 @@ class neutron::agents::dhcp (
'DEFAULT/dhcp_broadcast_reply': value => $dhcp_broadcast_reply;
'DEFAULT/dnsmasq_config_file': value => $dnsmasq_config_file;
'DEFAULT/dnsmasq_dns_servers': value => join(any2array($dnsmasq_dns_servers), ',');
'DEFAULT/dnsmasq_local_resolv': value => $dnsmasq_local_resolv;
'DEFAULT/ovs_integration_bridge': value => $ovs_integration_bridge;
'AGENT/availability_zone': value => $availability_zone;
}

View File

@ -0,0 +1,5 @@
---
features:
- Add 'dnsmasq_local_resolv' option support to Enables the dnsmasq
service to provide name resolution for instances via DNS resolvers
on the host running the DHCP agent.

View File

@ -48,6 +48,7 @@ describe 'neutron::agents::dhcp' do
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/enable_metadata_network').with_value(p[:enable_metadata_network]);
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/dhcp_broadcast_reply').with_value('<SERVICE DEFAULT>');
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/ovs_integration_bridge').with_value('<SERVICE DEFAULT>');
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/dnsmasq_local_resolv').with_value('<SERVICE DEFAULT>');
is_expected.to contain_neutron_dhcp_agent_config('AGENT/availability_zone').with_value('<SERVICE DEFAULT>');
end
@ -163,6 +164,17 @@ describe 'neutron::agents::dhcp' do
end
end
shared_examples_for 'enable advertisement of the DNS resolver on the host.' do
before do
params.merge!(
:dnsmasq_local_resolv => true
)
end
it 'configures dnsmasq_local_resolv' do
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/dnsmasq_local_resolv').with_value(params[:dnsmasq_config_file])
end
end
shared_examples_for 'neutron dhcp agent with dnsmasq_dns_servers set' do
before do
params.merge!(