summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-06-08 07:49:10 +0000
committerGerrit Code Review <review@openstack.org>2017-06-08 07:49:10 +0000
commit50ef64ceb1715c127f743e3b66ecb5eadecc9730 (patch)
tree8d7715bbcda67022749565604ef330795a501a94
parent3eb98e5070cd8743a549cbbfb9c363849b87d09a (diff)
parentb154a57c6dae25aa5e74e979e4ec25892872ac30 (diff)
Merge "NSXv: add lbaas statistics support" into stable/ocata
-rw-r--r--vmware_nsx/services/lbaas/nsx_v/v2/loadbalancer_mgr.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/vmware_nsx/services/lbaas/nsx_v/v2/loadbalancer_mgr.py b/vmware_nsx/services/lbaas/nsx_v/v2/loadbalancer_mgr.py
index 6bb57a2..1cbccc4 100644
--- a/vmware_nsx/services/lbaas/nsx_v/v2/loadbalancer_mgr.py
+++ b/vmware_nsx/services/lbaas/nsx_v/v2/loadbalancer_mgr.py
@@ -130,12 +130,30 @@ class EdgeLoadBalancerManager(base_mgr.EdgeLoadbalancerBaseManager):
130 130
131 @log_helpers.log_method_call 131 @log_helpers.log_method_call
132 def stats(self, context, lb): 132 def stats(self, context, lb):
133 # TODO(kobis): implement
134 stats = {'bytes_in': 0, 133 stats = {'bytes_in': 0,
135 'bytes_out': 0, 134 'bytes_out': 0,
136 'active_connections': 0, 135 'active_connections': 0,
137 'total_connections': 0} 136 'total_connections': 0}
138 137
138 binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding(context.session,
139 lb.id)
140
141 try:
142 lb_stats = self.vcns.get_loadbalancer_statistics(
143 binding['edge_id'])
144
145 except nsxv_exc.VcnsApiException:
146 msg = (_('Failed to read load balancer statistics, edge: %s') %
147 binding['edge_id'])
148 raise n_exc.BadRequest(resource='edge-lbaas', msg=msg)
149
150 pools_stats = lb_stats[1].get('pool', [])
151 for pool_stats in pools_stats:
152 stats['bytes_in'] += pool_stats.get('bytesIn', 0)
153 stats['bytes_out'] += pool_stats.get('bytesOut', 0)
154 stats['active_connections'] += pool_stats.get('curSessions', 0)
155 stats['total_connections'] += pool_stats.get('totalSessions', 0)
156
139 return stats 157 return stats
140 158
141 def _handle_subnet_gw_change(self, *args, **kwargs): 159 def _handle_subnet_gw_change(self, *args, **kwargs):