From a2fa43d067e163346114f676fd53f5a811fc3d84 Mon Sep 17 00:00:00 2001 From: asarfaty Date: Tue, 13 Oct 2020 06:03:16 +0200 Subject: [PATCH] NSX|P: Get LB status carefully Access status fields carefully in case they do not exist. Change-Id: I9ce4abfd2ed80457038f72e4963f4f4d9afa61f4 --- .../lbaas/nsx_p/implementation/loadbalancer_mgr.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 f902ed672f..79e6952a18 100644 --- a/vmware_nsx/services/lbaas/nsx_p/implementation/loadbalancer_mgr.py +++ b/vmware_nsx/services/lbaas/nsx_p/implementation/loadbalancer_mgr.py @@ -288,17 +288,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