diff --git a/doc/source/topics/settings.rst b/doc/source/topics/settings.rst index 0ec7245443..a6179ec9dc 100644 --- a/doc/source/topics/settings.rst +++ b/doc/source/topics/settings.rst @@ -1333,6 +1333,18 @@ a later release. If there exists a default Subnet Pool it will be automatically detected through the Neutron API and the label will be set to the name of the default Subnet Pool. +``default_dns_nameservers``: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 10.0.0(Newton) + +Default: ``None`` (Empty) + +Default DNS servers you would like to use when a subnet is created. This is +only a default. Users can still choose a different list of dns servers. + +Example: ``["8.8.8.8", "8.8.4.4", "208.67.222.222"]`` + ``OPENSTACK_SSL_CACERT`` ------------------------ diff --git a/openstack_dashboard/dashboards/project/networks/subnets/views.py b/openstack_dashboard/dashboards/project/networks/subnets/views.py index 9c0e20d5fd..3df07f81bb 100644 --- a/openstack_dashboard/dashboards/project/networks/subnets/views.py +++ b/openstack_dashboard/dashboards/project/networks/subnets/views.py @@ -15,6 +15,7 @@ """ Views for managing Neutron Subnets. """ +from django.conf import settings from django.core.urlresolvers import reverse from django.utils.translation import ugettext_lazy as _ @@ -48,10 +49,17 @@ class CreateView(workflows.WorkflowView): msg = _("Unable to retrieve network.") exceptions.handle(self.request, msg, redirect=redirect) + def get_default_dns_servers(self): + # this returns the default dns servers to be used for new subnets + dns_default = "\n".join(getattr(settings, 'OPENSTACK_NEUTRON_NETWORK', + {}).get('default_dns_nameservers', '')) + return dns_default + def get_initial(self): network = self.get_object() return {"network_id": self.kwargs['network_id'], - "network_name": network.name_or_id} + "network_name": network.name_or_id, + "dns_nameservers": self.get_default_dns_servers()} class UpdateView(workflows.WorkflowView): diff --git a/openstack_dashboard/local/local_settings.py.example b/openstack_dashboard/local/local_settings.py.example index 11281673f5..862628627e 100644 --- a/openstack_dashboard/local/local_settings.py.example +++ b/openstack_dashboard/local/local_settings.py.example @@ -271,6 +271,13 @@ OPENSTACK_NEUTRON_NETWORK = { 'enable_vpn': True, 'enable_fip_topology_check': True, + # Default dns servers you would like to use when a subnet is + # created. This is only a default, users can still choose a different + # list of dns servers when creating a new subnet. + # The entries below are examples only, and are not appropriate for + # real deployments + # 'default_dns_nameservers': ["8.8.8.8", "8.8.4.4", "208.67.222.222"], + # Neutron can be configured with a default Subnet Pool to be used for IPv4 # subnet-allocation. Specify the label you wish to display in the Address # pool selector on the create subnet step if you want to use this feature.