NSX_V3: enable non native DHCP to work with AZ support

The dhcp and metadata prodiles do not need to be set.

Change-Id: I5e7f50d9e9c8517372e04317b17f99434aaba080
This commit is contained in:
Gary Kotton 2017-12-17 10:38:50 +02:00 committed by Adit Sarfaty
parent bdeabecca7
commit 498a8215bd
2 changed files with 25 additions and 27 deletions

View File

@ -37,27 +37,33 @@ class NsxV3AvailabilityZone(common_az.ConfiguredAvailabilityZone):
def init_from_config_section(self, az_name):
az_info = config.get_nsxv3_az_opts(self.name)
# The optional parameters will get the global values if not
# defined for this AZ
self.metadata_proxy = az_info.get('metadata_proxy')
if not self.metadata_proxy:
raise nsx_exc.NsxInvalidConfiguration(
opt_name="metadata_proxy",
opt_value='None',
reason=(_("metadata_proxy for availability zone %s "
"must be defined") % az_name))
if cfg.CONF.nsx_v3.native_dhcp_metadata:
# The optional parameters will get the global values if not
# defined for this AZ
self.metadata_proxy = az_info.get('metadata_proxy')
if not self.metadata_proxy:
raise nsx_exc.NsxInvalidConfiguration(
opt_name="metadata_proxy",
opt_value='None',
reason=(_("metadata_proxy for availability zone %s "
"must be defined") % az_name))
self.dhcp_profile = az_info.get('dhcp_profile')
if not self.dhcp_profile:
raise nsx_exc.NsxInvalidConfiguration(
opt_name="dhcp_profile",
opt_value='None',
reason=(_("dhcp_profile for availability zone %s "
"must be defined") % az_name))
self.dhcp_profile = az_info.get('dhcp_profile')
if not self.dhcp_profile:
raise nsx_exc.NsxInvalidConfiguration(
opt_name="dhcp_profile",
opt_value='None',
reason=(_("dhcp_profile for availability zone %s "
"must be defined") % az_name))
self.native_metadata_route = az_info.get('native_metadata_route')
if self.native_metadata_route is None:
self.native_metadata_route = cfg.CONF.nsx_v3.native_metadata_route
self.native_metadata_route = az_info.get('native_metadata_route')
if self.native_metadata_route is None:
nmr = cfg.CONF.nsx_v3.native_metadata_route
self.native_metadata_route = nmr
else:
self.metadata_proxy = None
self.dhcp_profile = None
self.native_metadata_route = None
self.dns_domain = az_info.get('dns_domain')
if self.dns_domain is None:

View File

@ -375,14 +375,6 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
return lb_driver_v2.DummyLoadbalancerDriverV2()
def init_availability_zones(self):
# availability zones are supported only with native dhcp
# if not - the default az will be loaded and used internally only
if (cfg.CONF.nsx_v3.availability_zones and
not cfg.CONF.nsx_v3.native_dhcp_metadata):
msg = _("Availability zones are not supported without native "
"DHCP metadata")
LOG.error(msg)
raise n_exc.InvalidInput(error_message=msg)
validate_default = not self._is_sub_plugin
self._availability_zones_data = nsx_az.NsxV3AvailabilityZones(
validate_default=validate_default)