From 55a2f90362eeec17262106edd7355ade4264fc95 Mon Sep 17 00:00:00 2001 From: Kobi Samoray Date: Wed, 17 Oct 2018 13:31:56 +0300 Subject: [PATCH] NSXv: Metadata should complete init Metadata initialization should not fail because misconigured edge appliances. Change-Id: Ib63dc88550f1e7cfd1cf7a9f893052e2f3ed24b9 --- vmware_nsx/plugins/nsx_v/md_proxy.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/vmware_nsx/plugins/nsx_v/md_proxy.py b/vmware_nsx/plugins/nsx_v/md_proxy.py index af2a104c62..6d454f38de 100644 --- a/vmware_nsx/plugins/nsx_v/md_proxy.py +++ b/vmware_nsx/plugins/nsx_v/md_proxy.py @@ -347,9 +347,12 @@ class NsxVMetadataProxyHandler(object): # Read and validate connectivity h, if_data = self.nsxv_plugin.nsx_v.get_interface( edge_id, vcns_const.EXTERNAL_VNIC_INDEX) - cur_ip = if_data.get('addressGroups', {} - ).get('addressGroups', {} - )[0].get('primaryAddress') + a_groups = if_data.get('addressGroups', {}).get('addressGroups') + if a_groups: + cur_ip = a_groups[0].get('primaryAddress') + else: + cur_ip = None + cur_pgroup = if_data['portgroupId'] if (if_data and cur_pgroup != self.az.mgt_net_moid or cur_ip != rtr_ext_ip): @@ -392,8 +395,7 @@ class NsxVMetadataProxyHandler(object): vs.default_pool.members[m_name].payload['ipAddress'] = ( m_ip_to_set.pop()) else: - error = _('Number of metadata members should not change') - raise nsxv_exc.NsxPluginException(err_msg=error) + LOG.error('Number of metadata members should not change') try: # This may fail if the edge is powered off right now