diff --git a/releasenotes/notes/dns-search-domain-configuration-a134af0ef028282c.yaml b/releasenotes/notes/dns-search-domain-configuration-a134af0ef028282c.yaml new file mode 100644 index 0000000000..9ad70ec02c --- /dev/null +++ b/releasenotes/notes/dns-search-domain-configuration-a134af0ef028282c.yaml @@ -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. diff --git a/vmware_nsx/common/config.py b/vmware_nsx/common/config.py index db2ba93436..f91bcb7034 100644 --- a/vmware_nsx/common/config.py +++ b/vmware_nsx/common/config.py @@ -580,6 +580,9 @@ nsxv_opts = [ "exclusive_router_appliance_size will be picked up if " "--router-size parameter is not specified while doing " "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', default=[], help=_('List of nameservers to configure for the DHCP binding ' diff --git a/vmware_nsx/plugins/nsx_v/vshield/edge_utils.py b/vmware_nsx/plugins/nsx_v/vshield/edge_utils.py index cfa67ecb11..479e8a9a08 100644 --- a/vmware_nsx/plugins/nsx_v/vshield/edge_utils.py +++ b/vmware_nsx/plugins/nsx_v/vshield/edge_utils.py @@ -912,12 +912,16 @@ class EdgeManager(object): sub_binding = nsxv_db.get_nsxv_subnet_ext_attributes( context.session, subnet_id) - if sub_binding: - if sub_binding.dns_search_domain is not None: - static_config['domainName'] = sub_binding.dns_search_domain - if sub_binding.dhcp_mtu: - static_config = self.add_mtu_on_static_binding( - static_config, sub_binding.dhcp_mtu) + dns_search_domain = None + if sub_binding and sub_binding.dns_search_domain: + dns_search_domain = sub_binding.dns_search_domain + elif cfg.CONF.nsxv.dns_search_domain: + dns_search_domain = cfg.CONF.nsxv.dns_search_domain + 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( context, subnet_id, [static_config])