diff options
-rw-r--r-- | nova/api/metadata/base.py | 6 | ||||
-rw-r--r-- | nova/conf/api.py | 24 | ||||
-rw-r--r-- | nova/conf/network.py | 18 | ||||
-rw-r--r-- | nova/network/linux_net.py | 10 | ||||
-rw-r--r-- | nova/tests/unit/network/test_linux_net.py | 8 | ||||
-rw-r--r-- | nova/tests/unit/test_metadata.py | 4 | ||||
-rw-r--r-- | releasenotes/notes/undeprecate-dhcp_domain-opt-77c9154c5b06e0ff.yaml | 8 |
7 files changed, 47 insertions, 31 deletions
diff --git a/nova/api/metadata/base.py b/nova/api/metadata/base.py index e3e25fe541..42e76a86b7 100644 --- a/nova/api/metadata/base.py +++ b/nova/api/metadata/base.py @@ -528,8 +528,10 @@ class InstanceMetadata(object): return self._check_version(required, requested, OPENSTACK_VERSIONS) def _get_hostname(self): - if CONF.dhcp_domain: - return '.'.join([self.instance.hostname, CONF.dhcp_domain]) + # TODO(stephenfin): At some point in the future, we may wish to + # retrieve this information from neutron. + if CONF.api.dhcp_domain: + return '.'.join([self.instance.hostname, CONF.api.dhcp_domain]) return self.instance.hostname diff --git a/nova/conf/api.py b/nova/conf/api.py index 574370e68e..a36e9e2f1b 100644 --- a/nova/conf/api.py +++ b/nova/conf/api.py @@ -209,6 +209,30 @@ running nova-metadata API service per cell, you should also configure each Neutron metadata-agent to point to the corresponding nova-metadata API service. """), + cfg.StrOpt("dhcp_domain", + deprecated_group="DEFAULT", + default="novalocal", + help=""" +Domain name used to configure FQDN for instances. + +This option has two purposes: + +#. For *neutron* and *nova-network* users, it is used to configure a + fully-qualified domain name for instance hostnames. If unset, only the + hostname without a domain will be configured. +#. (Deprecated) For *nova-network* users, this option configures the DNS + domains used for the DHCP server. Refer to the ``--domain`` option of the + ``dnsmasq`` utility for more information. Like *nova-network* itself, this + purpose is deprecated. + +Possible values: + +* Any string that is a valid domain name. + +Related options: + +* ``use_neutron`` +"""), ] file_opts = [ diff --git a/nova/conf/network.py b/nova/conf/network.py index 4ab64c1c7b..5e63231962 100644 --- a/nova/conf/network.py +++ b/nova/conf/network.py @@ -465,24 +465,6 @@ Related options: * ``use_neutron`` """), - cfg.StrOpt("dhcp_domain", - default="novalocal", - deprecated_for_removal=True, - deprecated_since='15.0.0', - deprecated_reason=""" -nova-network is deprecated, as are any related configuration options. -""", - help=""" -This option allows you to specify the domain for the DHCP server. - -Possible values: - -* Any string that is a valid domain name. - -Related options: - -* ``use_neutron`` -"""), cfg.StrOpt("l3_lib", default="nova.network.l3.LinuxNetL3", deprecated_for_removal=True, diff --git a/nova/network/linux_net.py b/nova/network/linux_net.py index da06724d0b..9abecc546d 100644 --- a/nova/network/linux_net.py +++ b/nova/network/linux_net.py @@ -1007,8 +1007,8 @@ def restart_dhcp(context, dev, network_ref, fixedips): # dnsmasq currently gives an error for an empty domain, # rather than ignoring. So only specify it if defined. - if CONF.dhcp_domain: - cmd.append('--domain=%s' % CONF.dhcp_domain) + if CONF.api.dhcp_domain: + cmd.append('--domain=%s' % CONF.api.dhcp_domain) dns_servers = CONF.dns_server if CONF.use_network_dns_servers: @@ -1096,20 +1096,20 @@ def _host_dhcp(fixedip): net = _host_dhcp_network(fixedip.virtual_interface_id) return '%s,%s.%s,%s,net:%s' % (fixedip.virtual_interface.address, hostname, - CONF.dhcp_domain, + CONF.api.dhcp_domain, fixedip.address, net) else: return '%s,%s.%s,%s' % (fixedip.virtual_interface.address, hostname, - CONF.dhcp_domain, + CONF.api.dhcp_domain, fixedip.address) def _host_dns(fixedip): return '%s\t%s.%s' % (fixedip.address, fixedip.instance.hostname, - CONF.dhcp_domain) + CONF.api.dhcp_domain) def _host_dhcp_opts(vif_id=None, gateway=None): diff --git a/nova/tests/unit/network/test_linux_net.py b/nova/tests/unit/network/test_linux_net.py index d40598487a..f184f8ffa9 100644 --- a/nova/tests/unit/network/test_linux_net.py +++ b/nova/tests/unit/network/test_linux_net.py @@ -734,10 +734,10 @@ class LinuxNetworkTestCase(test.NoDBTestCase): dev = 'br100' - default_domain = CONF.dhcp_domain + default_domain = CONF.api.dhcp_domain for domain in ('', default_domain): executes = [] - self.flags(dhcp_domain=domain) + self.flags(dhcp_domain=domain, group='api') fixedips = self._get_fixedips(network_ref) linux_net.restart_dhcp(self.context, dev, network_ref, fixedips) expected = ['env', @@ -761,8 +761,8 @@ class LinuxNetworkTestCase(test.NoDBTestCase): '--no-hosts', '--leasefile-ro'] - if CONF.dhcp_domain: - expected.append('--domain=%s' % CONF.dhcp_domain) + if CONF.api.dhcp_domain: + expected.append('--domain=%s' % CONF.api.dhcp_domain) if extra_expected: expected += extra_expected diff --git a/nova/tests/unit/test_metadata.py b/nova/tests/unit/test_metadata.py index d8fe323956..a1ec39896a 100644 --- a/nova/tests/unit/test_metadata.py +++ b/nova/tests/unit/test_metadata.py @@ -311,14 +311,14 @@ class MetadataTestCase(test.TestCase): self._test_security_groups() def test_local_hostname(self): - self.flags(dhcp_domain=None) + self.flags(dhcp_domain=None, group='api') md = fake_InstanceMetadata(self, self.instance.obj_clone()) data = md.get_ec2_metadata(version='2009-04-04') self.assertEqual(data['meta-data']['local-hostname'], self.instance['hostname']) def test_local_hostname_fqdn(self): - self.flags(dhcp_domain='fakedomain') + self.flags(dhcp_domain='fakedomain', group='api') md = fake_InstanceMetadata(self, self.instance.obj_clone()) data = md.get_ec2_metadata(version='2009-04-04') self.assertEqual('%s.fakedomain' % self.instance['hostname'], diff --git a/releasenotes/notes/undeprecate-dhcp_domain-opt-77c9154c5b06e0ff.yaml b/releasenotes/notes/undeprecate-dhcp_domain-opt-77c9154c5b06e0ff.yaml new file mode 100644 index 0000000000..794431fd1c --- /dev/null +++ b/releasenotes/notes/undeprecate-dhcp_domain-opt-77c9154c5b06e0ff.yaml @@ -0,0 +1,8 @@ +--- +other: + - | + The ``dhcp_domain`` option has been undeprecated and moved to the ``[api]`` + group. It is used by the metadata service to configure fully-qualified + domain names for instances, in addition to its role configuring DHCP + services for *nova-network*. This use case was missed when deprecating the + option initially. |