NSX-V3| Fix AZ when native dhcp is disabled
When native dhcp is disabled, the default availability zone is defined, but the profile ids can be None. Avoid crashing in this case. Change-Id: If16b9e31fe6b9b983f58bbb90d4293081f9f8b22
This commit is contained in:
parent
6228a06399
commit
826b9eb1b2
@ -86,17 +86,27 @@ class NsxV3AvailabilityZone(common_az.ConfiguredAvailabilityZone):
|
||||
|
||||
def translate_configured_names_to_uuids(self, nsxlib):
|
||||
# Mandatory configurations (in AZ or inherited from global values)
|
||||
dhcp_id = nsxlib.native_dhcp_profile.get_id_by_name_or_id(
|
||||
self.dhcp_profile)
|
||||
self._native_dhcp_profile_uuid = dhcp_id
|
||||
# Unless this is the default AZ, and metadata is disabled.
|
||||
if self.dhcp_profile:
|
||||
dhcp_id = nsxlib.native_dhcp_profile.get_id_by_name_or_id(
|
||||
self.dhcp_profile)
|
||||
self._native_dhcp_profile_uuid = dhcp_id
|
||||
else:
|
||||
self._native_dhcp_profile_uuid = None
|
||||
|
||||
proxy_id = nsxlib.native_md_proxy.get_id_by_name_or_id(
|
||||
self.metadata_proxy)
|
||||
self._native_md_proxy_uuid = proxy_id
|
||||
if self.metadata_proxy:
|
||||
proxy_id = nsxlib.native_md_proxy.get_id_by_name_or_id(
|
||||
self.metadata_proxy)
|
||||
self._native_md_proxy_uuid = proxy_id
|
||||
else:
|
||||
self._native_md_proxy_uuid = None
|
||||
|
||||
tz_id = nsxlib.transport_zone.get_id_by_name_or_id(
|
||||
self.default_overlay_tz)
|
||||
self._default_overlay_tz_uuid = tz_id
|
||||
if self.default_overlay_tz:
|
||||
tz_id = nsxlib.transport_zone.get_id_by_name_or_id(
|
||||
self.default_overlay_tz)
|
||||
self._default_overlay_tz_uuid = tz_id
|
||||
else:
|
||||
self._default_overlay_tz_uuid = None
|
||||
|
||||
# Optional configurations (may be None)
|
||||
if self.default_vlan_tz:
|
||||
|
Loading…
x
Reference in New Issue
Block a user