Merge "NSXP: parse statistics correctly"
This commit is contained in:
commit
db82bd3c14
|
@ -253,21 +253,26 @@ def stats_getter(context, core_plugin, ignore_list=None):
|
||||||
lb_service_id = lb_service.get('id')
|
lb_service_id = lb_service.get('id')
|
||||||
try:
|
try:
|
||||||
# get the NSX statistics for this LB service
|
# get the NSX statistics for this LB service
|
||||||
rsp = lb_service_client.get_statistics(lb_service_id)
|
stats_results = lb_service_client.get_statistics(
|
||||||
if rsp and 'virtual_servers' in rsp:
|
lb_service_id).get('results', [])
|
||||||
# Go over each virtual server in the response
|
if stats_results:
|
||||||
for vs in rsp['virtual_servers']:
|
rsp = stats_results[0]
|
||||||
# look up the virtual server in the DB
|
else:
|
||||||
if vs.get('statistics'):
|
rsp = {}
|
||||||
vs_stats = vs['statistics']
|
|
||||||
stats = copy.copy(lb_const.LB_EMPTY_STATS)
|
# Go over each virtual server in the response
|
||||||
stats['id'] = p_utils.path_to_id(
|
for vs in rsp.get('virtual_servers', []):
|
||||||
vs['virtual_server_path'])
|
# look up the virtual server in the DB
|
||||||
stats['request_errors'] = 0 # currently unsupported
|
if vs.get('statistics'):
|
||||||
for stat in lb_const.LB_STATS_MAP:
|
vs_stats = vs['statistics']
|
||||||
lb_stat = lb_const.LB_STATS_MAP[stat]
|
stats = copy.copy(lb_const.LB_EMPTY_STATS)
|
||||||
stats[stat] += vs_stats[lb_stat]
|
stats['id'] = p_utils.path_to_id(
|
||||||
stat_list.append(stats)
|
vs['virtual_server_path'])
|
||||||
|
stats['request_errors'] = 0 # currently unsupported
|
||||||
|
for stat in lb_const.LB_STATS_MAP:
|
||||||
|
lb_stat = lb_const.LB_STATS_MAP[stat]
|
||||||
|
stats[stat] += vs_stats[lb_stat]
|
||||||
|
stat_list.append(stats)
|
||||||
|
|
||||||
except nsxlib_exc.ManagerError:
|
except nsxlib_exc.ManagerError:
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in New Issue