commit c689b2f7a1b83790de2f404ea06756a4e3761c9e Author: asarfaty Date: Tue Oct 13 06:03:16 2020 +0200 NSX|P: Get LB status carefully Access status fields carefully in case they do not exist. Change-Id: I9ce4abfd2ed80457038f72e4963f4f4d9afa61f4 diff --git a/vmware_nsx/services/lbaas/nsx_p/implementation/loadbalancer_mgr.py b/vmware_nsx/services/lbaas/nsx_p/implementation/loadbalancer_mgr.py index 668d482..1d97d88 100644 --- a/vmware_nsx/services/lbaas/nsx_p/implementation/loadbalancer_mgr.py +++ b/vmware_nsx/services/lbaas/nsx_p/implementation/loadbalancer_mgr.py @@ -356,17 +356,21 @@ def status_getter(context, core_plugin): 'operating_status': _nsx_status_to_lb_status( vs_status['status'])}) for pool_status in result.get('pools', []): + if not pool_status.get('pool_path'): + LOG.warning("pool_path missing from lb status: %s", + lb_status_results) + continue pool_id = lib_p_utils.path_to_id(pool_status['pool_path']) pool_statuses.append({ 'id': pool_id, 'operating_status': _nsx_status_to_lb_status( - pool_status['status'])}) + pool_status.get('status'))}) for member in pool_status.get('members', []): member_statuses.append({ 'pool_id': pool_id, 'member_ip': member.get('ip_address'), 'operating_status': _nsx_status_to_lb_status( - member['status'])}) + member.get('status'))}) else: lb_operating_status = lb_const.OFFLINE