Skip to content

Commit

Permalink
LBaaS: update DB pool stats received from lbaas agent
Browse files Browse the repository at this point in the history
Fixes bug 1201401

Change-Id: I84e2fbdb3e6368529c1d829d4e8134e6b0b54311
  • Loading branch information
Oleg Bondarev committed Jul 16, 2013
1 parent b99b020 commit dab95c4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion neutron/db/loadbalancer/loadbalancer_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ def _make_pool_dict(self, pool, fields=None):

return self._fields(res, fields)

def _update_pool_stats(self, context, pool_id, data=None):
def update_pool_stats(self, context, pool_id, data=None):
"""Update a pool with new stats structure."""
with context.session.begin(subtransactions=True):
pool_db = self._get_resource(context, Pool, pool_id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ def unplug_vip_port(self, context, port_id=None, host=None):
LOG.debug(msg, port_id)

def update_pool_stats(self, context, pool_id=None, stats=None, host=None):
# TODO(markmcclain): add stats collection
pass
self.plugin.update_pool_stats(context, pool_id, data=stats)


class LoadBalancerAgentApi(proxy.RpcProxy):
Expand Down
6 changes: 3 additions & 3 deletions neutron/tests/unit/db/loadbalancer/test_db_loadbalancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ def test_update_pool_stats_with_no_stats(self):
with self.pool() as pool:
pool_id = pool['pool']['id']
ctx = context.get_admin_context()
self.plugin._update_pool_stats(ctx, pool_id)
self.plugin.update_pool_stats(ctx, pool_id)
pool_obj = ctx.session.query(ldb.Pool).filter_by(id=pool_id).one()
for key in keys:
self.assertEqual(pool_obj.stats.__dict__[key], 0)
Expand All @@ -948,7 +948,7 @@ def _test_update_pool_stats_with_negative_value(self, k, v):
with self.pool() as pool:
pool_id = pool['pool']['id']
ctx = context.get_admin_context()
self.assertRaises(ValueError, self.plugin._update_pool_stats,
self.assertRaises(ValueError, self.plugin.update_pool_stats,
ctx, pool_id, {k: v})

def test_update_pool_stats(self):
Expand All @@ -959,7 +959,7 @@ def test_update_pool_stats(self):
with self.pool() as pool:
pool_id = pool['pool']['id']
ctx = context.get_admin_context()
self.plugin._update_pool_stats(ctx, pool_id, stats_data)
self.plugin.update_pool_stats(ctx, pool_id, stats_data)
pool_obj = ctx.session.query(ldb.Pool).filter_by(id=pool_id).one()
for k, v in stats_data.items():
self.assertEqual(pool_obj.stats.__dict__[k], v)
Expand Down

0 comments on commit dab95c4

Please sign in to comment.