Merge "Add support for default dns for subnet"

This commit is contained in:
Jenkins 2016-05-04 17:12:00 +00:00 committed by Gerrit Code Review
commit dda1eb2cb6
3 changed files with 28 additions and 1 deletions

View File

@ -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``
------------------------

View File

@ -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):

View File

@ -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.