ovn: Add dns_servers configuration support

networking-ovn optionally expects list of dns server to be defined in the
config -'ovn/dns_servers'. These will be included in the 'dns_server' DHCP
option field when the VMs send DHCP request if the subnet's dns_nameservers field
is not defined by the user.

Change-Id: I353ac905069ecc945720df2b9e3051989238a02a
Partial-bug: #1774052
This commit is contained in:
Numan Siddique 2018-06-01 15:35:36 +05:30
parent 8d65a81163
commit b2b8cf72a8
3 changed files with 16 additions and 0 deletions

View File

@ -52,6 +52,12 @@
# (optional) Whether to enable DVR.
# Type: boolean
# Defaults to $::os_service_default
#
# [*dns_servers*]
# (optional) List of dns servers which will be as forwarders
# if a subnet's dns_nameservers is empty.
# Type: List
# Defaults to $::os_service_default
class neutron::plugins::ml2::ovn(
$ovn_nb_connection = $::os_service_default,
@ -63,6 +69,7 @@ class neutron::plugins::ml2::ovn(
$vif_type = $::os_service_default,
$ovn_metadata_enabled = $::os_service_default,
$dvr_enabled = $::os_service_default,
$dns_servers = $::os_service_default,
) {
include ::neutron::deps
@ -96,5 +103,6 @@ class neutron::plugins::ml2::ovn(
'ovn/vif_type' : value => $vif_type;
'ovn/ovn_metadata_enabled' : value => $ovn_metadata_enabled;
'ovn/enable_distributed_floating_ip' : value => $dvr_enabled;
'ovn/dns_servers' : value => join(any2array($dns_servers), ',');
}
}

View File

@ -0,0 +1,6 @@
---
features:
- Provides the option to define a set of DNS servers which will be
configured in the 'ovn' section of etc/neutron/plugins/ml2_conf.ini.
These DNS servers will be used as DNS forwarders for the VMs if a neutron
subnet is not defined with 'dns_nameservers' option.

View File

@ -19,6 +19,7 @@ describe 'neutron::plugins::ml2::ovn' do
:ovn_l3_mode => true,
:vif_type => 'ovs',
:dvr_enabled => false,
:dns_servers => ['8.8.8.8', '10.10.10.10'],
}
end
@ -46,6 +47,7 @@ describe 'neutron::plugins::ml2::ovn' do
is_expected.to contain_neutron_plugin_ml2('ovn/ovn_l3_mode').with_value(params[:ovn_l3_mode])
is_expected.to contain_neutron_plugin_ml2('ovn/vif_type').with_value(params[:vif_type])
is_expected.to contain_neutron_plugin_ml2('ovn/enable_distributed_floating_ip').with_value(params[:dvr_enabled])
is_expected.to contain_neutron_plugin_ml2('ovn/dns_servers').with_value(params[:dns_servers].join(','))
end
end