NSX|V: add configuration variable for dns_search_domain

Enable a admin to configure a global search domain. That is, if a
subnet is not created with a search domain (commit
d9f3ee826a) then is a domain is
defined in the configuration file then we can use that one.

In the nsxv section there will be a new variable
 - dns_search_domain

Change-Id: I112a00dbc89b1c7702e82ecfa6ec974b7b9cce8d
This commit is contained in:
Gary Kotton 2016-12-12 04:28:23 -08:00
parent a966ca0708
commit 8cca87ed98
3 changed files with 22 additions and 6 deletions

View File

@ -0,0 +1,9 @@
---
prelude: >
Enable an admin to configure a global search domain.
This is used if no search domain is configured on a
subnet.
features:
- A new configuration variable in the nsxv section will
enable the admin to configure a search domain. The new
variable is dns_search_domain.

View File

@ -580,6 +580,9 @@ nsxv_opts = [
"exclusive_router_appliance_size will be picked up if " "exclusive_router_appliance_size will be picked up if "
"--router-size parameter is not specified while doing " "--router-size parameter is not specified while doing "
"neutron router-create")), "neutron router-create")),
cfg.StrOpt('dns_search_domain',
help=_("(Optional) Use this search domain if there is no "
"search domain configured on the subnet.")),
cfg.ListOpt('nameservers', cfg.ListOpt('nameservers',
default=[], default=[],
help=_('List of nameservers to configure for the DHCP binding ' help=_('List of nameservers to configure for the DHCP binding '

View File

@ -912,12 +912,16 @@ class EdgeManager(object):
sub_binding = nsxv_db.get_nsxv_subnet_ext_attributes( sub_binding = nsxv_db.get_nsxv_subnet_ext_attributes(
context.session, context.session,
subnet_id) subnet_id)
if sub_binding: dns_search_domain = None
if sub_binding.dns_search_domain is not None: if sub_binding and sub_binding.dns_search_domain:
static_config['domainName'] = sub_binding.dns_search_domain dns_search_domain = sub_binding.dns_search_domain
if sub_binding.dhcp_mtu: elif cfg.CONF.nsxv.dns_search_domain:
static_config = self.add_mtu_on_static_binding( dns_search_domain = cfg.CONF.nsxv.dns_search_domain
static_config, sub_binding.dhcp_mtu) if dns_search_domain:
static_config['domainName'] = dns_search_domain
if sub_binding and sub_binding.dhcp_mtu:
static_config = self.add_mtu_on_static_binding(
static_config, sub_binding.dhcp_mtu)
self.handle_meta_static_route( self.handle_meta_static_route(
context, subnet_id, [static_config]) context, subnet_id, [static_config])