diff options
author | hamalq <hamalq@verizonmedia.com> | 2020-05-28 23:17:28 +0000 |
---|---|---|
committer | Edward Hope-Morley <edward.hope-morley@canonical.com> | 2022-09-20 13:39:15 +0100 |
commit | f6aed71cbf6a9a7da0c3c7aa5b6acf83ceea2fec (patch) | |
tree | f1bad8e637e3ec0b8c5af4b5aa7289d515691266 | |
parent | fdacb80cc93a8b811c5a013a533d542aedfd4a48 (diff) | |
download | neutron-f6aed71cbf6a9a7da0c3c7aa5b6acf83ceea2fec.tar.gz |
Sync the dns-assignment with the actual designate dns-domain
When a port is created the dns-assignment (dns-domain part)
was always taken form Neutron config dns_domain which is not
always true, since it could be Neutron network dns_domain or
the dns_domain sent when creating the port
Change-Id: I7f4366ff5a26f73013433bfbfb299fd06294f359
Closes-Bug:1873091
(cherry picked from commit ea13f2e83f8c2de3def69b6c883a5c161c3a6180)
3 files changed, 11 insertions, 0 deletions
diff --git a/neutron/plugins/ml2/extensions/dns_integration.py b/neutron/plugins/ml2/extensions/dns_integration.py index 60d5e06bf1..2bf79f79a5 100644 --- a/neutron/plugins/ml2/extensions/dns_integration.py +++ b/neutron/plugins/ml2/extensions/dns_integration.py @@ -288,6 +288,8 @@ class DNSExtensionDriver(api.ExtensionDriver): if dns_domain and dns_domain != lib_const.DNS_DOMAIN_DEFAULT: if dns_data_db: dns_name = dns_data_db.dns_name + if dns_data_db.current_dns_domain: + dns_domain = dns_data_db.current_dns_domain return dns_name, dns_domain def _get_dns_names_for_port(self, ips, dns_data_db): diff --git a/neutron/tests/unit/plugins/ml2/extensions/test_dns_integration.py b/neutron/tests/unit/plugins/ml2/extensions/test_dns_integration.py index 959ab0b727..1cb8b750a2 100644 --- a/neutron/tests/unit/plugins/ml2/extensions/test_dns_integration.py +++ b/neutron/tests/unit/plugins/ml2/extensions/test_dns_integration.py @@ -164,6 +164,9 @@ class DNSIntegrationTestCase(test_plugin.Ml2PluginV2TestCase): self.assertEqual(current_dns_name, dns_data_db['current_dns_name']) self.assertEqual(previous_dns_name, dns_data_db['previous_dns_name']) + curr_dns_domain = dns_data_db['current_dns_domain'] + for fqdn in port['dns_assignment']: + self.assertTrue(fqdn['fqdn'].endswith(curr_dns_domain)) if current_dns_name: self.assertEqual(current_dns_domain, dns_data_db['current_dns_domain']) diff --git a/releasenotes/notes/fix-port-dns-assignment-9d916d77522abd65.yaml b/releasenotes/notes/fix-port-dns-assignment-9d916d77522abd65.yaml new file mode 100644 index 0000000000..3a45c69e89 --- /dev/null +++ b/releasenotes/notes/fix-port-dns-assignment-9d916d77522abd65.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + The dns-assignment will reflect the dns-domain defined in the network or + sent by user when creating the port using --dns-domain rather than just + take the dns-domain defined in the neutron configuration |