From f27e5244adcac9a12c04605fbf5c49a086d5fce5 Mon Sep 17 00:00:00 2001 From: Vishal Agarwal Date: Mon, 16 Jun 2014 21:31:15 +0530 Subject: [PATCH] Fix pool statistics for LBaaS Haproxy driver Total connections was mapped to none of the counters of haproxy. Active connections was mapped to active request counter(qcur)) of haproxy which in low load situations always remains zero. Patch maps connections API counters to haproxy session counters and fixes unit test accordingly. Change-Id: I0ef4f76a75340232eb11a9b95453769ecd89d13a Closes-Bug: #1319361 --- neutron/services/loadbalancer/drivers/haproxy/cfg.py | 5 +++-- .../loadbalancer/drivers/haproxy/test_namespace_driver.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/neutron/services/loadbalancer/drivers/haproxy/cfg.py b/neutron/services/loadbalancer/drivers/haproxy/cfg.py index d740cb6c0..815334f81 100644 --- a/neutron/services/loadbalancer/drivers/haproxy/cfg.py +++ b/neutron/services/loadbalancer/drivers/haproxy/cfg.py @@ -37,10 +37,11 @@ BALANCE_MAP = { } STATS_MAP = { - constants.STATS_ACTIVE_CONNECTIONS: 'qcur', - constants.STATS_MAX_CONNECTIONS: 'qmax', + constants.STATS_ACTIVE_CONNECTIONS: 'scur', + constants.STATS_MAX_CONNECTIONS: 'smax', constants.STATS_CURRENT_SESSIONS: 'scur', constants.STATS_MAX_SESSIONS: 'smax', + constants.STATS_TOTAL_CONNECTIONS: 'stot', constants.STATS_TOTAL_SESSIONS: 'stot', constants.STATS_IN_BYTES: 'bin', constants.STATS_OUT_BYTES: 'bout', diff --git a/neutron/tests/unit/services/loadbalancer/drivers/haproxy/test_namespace_driver.py b/neutron/tests/unit/services/loadbalancer/drivers/haproxy/test_namespace_driver.py index f3c3b3972..450727bc2 100644 --- a/neutron/tests/unit/services/loadbalancer/drivers/haproxy/test_namespace_driver.py +++ b/neutron/tests/unit/services/loadbalancer/drivers/haproxy/test_namespace_driver.py @@ -218,14 +218,15 @@ class TestHaproxyNSDriver(base.BaseTestCase): socket.recv.return_value = raw_stats exp_stats = {'connection_errors': '0', - 'active_connections': '1', + 'active_connections': '3', 'current_sessions': '3', 'bytes_in': '7764', - 'max_connections': '2', + 'max_connections': '4', 'max_sessions': '4', 'bytes_out': '2365', 'response_errors': '0', 'total_sessions': '10', + 'total_connections': '10', 'members': { '32a6c2a3-420a-44c3-955d-86bd2fc6871e': { 'status': 'ACTIVE', -- 2.45.2