NSX|P: Skip validation on missing edge cluster

Log warning and skip validation for mdproxy or dhcp profile without
edge cluster

Change-Id: I6e0f3b67a81fcd10a9552ecc5c98cee1cd539b43
This commit is contained in:
asarfaty 2021-01-19 14:52:45 +02:00 committed by Adit Sarfaty
parent bb0b09fecf
commit dcb586f893
2 changed files with 17 additions and 1 deletions

View File

@ -2080,6 +2080,11 @@ class NsxPluginV3Base(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
dhcp_profile = az._native_dhcp_profile_uuid
dhcp_obj = self.nsxlib.native_dhcp_profile.get(dhcp_profile)
ec_id = dhcp_obj['edge_cluster_id']
if not ec_id:
LOG.warning("DHCP profile %s is missing an edge cluster",
dhcp_profile)
return
ec_nodes = self.nsxlib.edge_cluster.get_transport_nodes(ec_id)
ec_tzs = []
for tn_uuid in ec_nodes:

View File

@ -1015,6 +1015,10 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base):
net_tz = self._get_net_tz(context, network['id'])
dhcp_ec_path = self.nsxpolicy.dhcp_server_config.get(
az._policy_dhcp_server_config).get('edge_cluster_path')
if not dhcp_ec_path:
LOG.warning("DHCP server config %s is missing an edge cluster",
az._policy_dhcp_server_config)
return
ec_id = p_utils.path_to_id(dhcp_ec_path)
try:
@ -4251,12 +4255,19 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base):
# Policy obj
md_ec_path = self.nsxpolicy.md_proxy.get(
mdproxy_uuid).get('edge_cluster_path')
if not md_ec_path:
LOG.warning("MDProxy %s is missing an edge cluster",
mdproxy_uuid)
return True
md_ec = p_utils.path_to_id(md_ec_path)
else:
# MP obj
md_ec = self.nsxlib.native_md_proxy.get(
mdproxy_uuid).get('edge_cluster_id')
if not md_ec:
LOG.warning("MDProxy %s is missing an edge cluster",
mdproxy_uuid)
return True
try:
ec_tzs = plugin_utils.get_edge_cluster_tzs(
self.nsxpolicy, self.nsxlib, md_ec)