From 45046b75ffb285b11eeb103cfcf5ef959888974c Mon Sep 17 00:00:00 2001 From: Adit Sarfaty Date: Sun, 13 Jan 2019 10:49:26 +0200 Subject: [PATCH] NSX|P dns integration support based on the v3 integration Change-Id: Ie726525c7b1cd4006b932b280634df27b192db4e --- setup.cfg | 1 + vmware_nsx/extension_drivers/dns_integration.py | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index 4e477dc62c..475674570e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -61,6 +61,7 @@ neutron.ipam_drivers = vmware_nsx.extension_drivers = vmware_nsxv_dns = vmware_nsx.extension_drivers.dns_integration:DNSExtensionDriverNSXv vmware_nsxv3_dns = vmware_nsx.extension_drivers.dns_integration:DNSExtensionDriverNSXv3 + vmware_nsxp_dns = vmware_nsx.extension_drivers.dns_integration:DNSExtensionDriverNSXp vmware_dvs_dns = vmware_nsx.extension_drivers.dns_integration:DNSExtensionDriverDVS vmware_nsx.neutron.nsxv.router_type_drivers = shared = vmware_nsx.plugins.nsx_v.drivers.shared_router_driver:RouterSharedDriver diff --git a/vmware_nsx/extension_drivers/dns_integration.py b/vmware_nsx/extension_drivers/dns_integration.py index dedd74ab1e..1093729de8 100644 --- a/vmware_nsx/extension_drivers/dns_integration.py +++ b/vmware_nsx/extension_drivers/dns_integration.py @@ -29,6 +29,7 @@ from oslo_log import log as logging from neutron.services.externaldns import driver from vmware_nsx.common import driver_api +from vmware_nsx.plugins.nsx_p import availability_zones as nsxp_az from vmware_nsx.plugins.nsx_v3 import availability_zones as nsx_az LOG = logging.getLogger(__name__) @@ -322,6 +323,7 @@ class DNSExtensionDriverNSXv3(DNSExtensionDriver): def initialize(self): self._availability_zones = nsx_az.NsxV3AvailabilityZones() LOG.info("DNSExtensionDriverNSXv3 initialization complete") + self.config_dns_domain = cfg.CONF.nsx_v3.dns_domain def _get_network_and_az(self, network_id, context): if not context: @@ -346,10 +348,10 @@ class DNSExtensionDriverNSXv3(DNSExtensionDriver): _dotted_domain(DNS_DOMAIN_DEFAULT)): dns_domain = az.dns_domain # Global nsx_v3 dns domain - elif (cfg.CONF.nsx_v3.dns_domain and - (_dotted_domain(cfg.CONF.nsx_v3.dns_domain) != + elif (self.config_dns_domain and + (_dotted_domain(self.config_dns_domain) != _dotted_domain(DNS_DOMAIN_DEFAULT))): - dns_domain = cfg.CONF.nsx_v3.dns_domain + dns_domain = self.config_dns_domain # Global neutron dns domain elif cfg.CONF.dns_domain: dns_domain = cfg.CONF.dns_domain @@ -370,6 +372,14 @@ class DNSExtensionDriverNSXv3(DNSExtensionDriver): return False +class DNSExtensionDriverNSXp(DNSExtensionDriverNSXv3): + + def initialize(self): + self._availability_zones = nsxp_az.NsxPAvailabilityZones() + LOG.info("DNSExtensionDriverNSXp initialization complete") + self.config_dns_domain = cfg.CONF.nsx_p.dns_domain + + class DNSExtensionDriverDVS(DNSExtensionDriver): def initialize(self):