Use dns_domain_ports extension driver for >= queens

The dns_domain_ports extension driver was introduced in Queens
to allow setting a dns_domain on ports and having that
override the network dns_domain value. The new extension driver
inherits from the old dns extension driver so it is safe to
simply replace it.

Change-Id: I26db4433359cf8c9d23158d553c4805fd0526a1a
Closes-Bug: #1815138
This commit is contained in:
Edward Hope-Morley 2019-02-07 22:01:27 +00:00
parent 20ace1288c
commit 4c842b1346
3 changed files with 18 additions and 2 deletions

View File

@ -49,6 +49,7 @@ TENANT_NET_TYPES = [VXLAN, GRE, VLAN, FLAT, LOCAL]
EXTENSION_DRIVER_PORT_SECURITY = 'port_security'
EXTENSION_DRIVER_DNS = 'dns'
EXTENSION_DRIVER_DNS_DOMAIN_PORTS = 'dns_domain_ports'
EXTENSION_DRIVER_QOS = 'qos'
ETC_NEUTRON = '/etc/neutron'
@ -472,7 +473,11 @@ class NeutronCCContext(context.NeutronContext):
if config('enable-ml2-port-security'):
extension_drivers.append(EXTENSION_DRIVER_PORT_SECURITY)
if enable_dns_extension_driver:
extension_drivers.append(EXTENSION_DRIVER_DNS)
if cmp_release < 'queens':
extension_drivers.append(EXTENSION_DRIVER_DNS)
else:
extension_drivers.append(EXTENSION_DRIVER_DNS_DOMAIN_PORTS)
if is_qos_requested_and_valid():
extension_drivers.append(EXTENSION_DRIVER_QOS)

View File

@ -583,7 +583,11 @@ class NeutronAPIBasicDeployment(OpenStackAmuletDeployment):
'supported_pci_vendor_devs': '8086:1515',
})
if self._get_openstack_release() >= self.trusty_mitaka:
if self._get_openstack_release() >= self.xenial_queens:
expected['ml2'].update({
'extension_drivers': 'dns_domain_ports',
})
elif self._get_openstack_release() >= self.trusty_mitaka:
expected['ml2'].update({
'extension_drivers': 'dns',
})

View File

@ -509,6 +509,13 @@ class NeutronCCContextTest(CharmTestCase):
self.assertEqual('example.org.', ctxt['dns_domain'])
self.assertEqual('port_security,dns', ctxt['extension_drivers'])
self.os_release.return_value = 'queens'
with patch.object(napi_ctxt, '_ensure_packages'):
ctxt = napi_ctxt()
self.assertEqual('example.org.', ctxt['dns_domain'])
self.assertEqual('port_security,dns_domain_ports',
ctxt['extension_drivers'])
@patch.object(context, 'NeutronLoadBalancerContext')
@patch.object(context.NeutronCCContext, 'network_manager')
@patch.object(context.NeutronCCContext, 'plugin')