LBaaS: pass the complete healthmonitor object to driver
Fixes bug: #1208372 Change-Id: I72198446f4de3907d92fc9c2bbdb403cf2e87341
This commit is contained in:
parent
23ac6df865
commit
4db5b793fe
@ -206,8 +206,10 @@ class LoadBalancerPlugin(loadbalancer_db.LoadBalancerPluginDb,
|
||||
health_monitor,
|
||||
pool_id
|
||||
)
|
||||
monitor_id = health_monitor['health_monitor']['id']
|
||||
hm = self.get_health_monitor(context, monitor_id)
|
||||
self.driver.create_pool_health_monitor(
|
||||
context, health_monitor, pool_id)
|
||||
context, hm, pool_id)
|
||||
return retval
|
||||
|
||||
def delete_pool_health_monitor(self, context, id, pool_id):
|
||||
|
@ -1193,6 +1193,23 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
health_mon2['health_monitor']['id']]},
|
||||
res)
|
||||
|
||||
def test_driver_call_create_pool_health_monitor(self):
|
||||
with mock.patch.object(self.plugin.driver,
|
||||
'create_pool_health_monitor') as driver_call:
|
||||
with contextlib.nested(
|
||||
self.pool(),
|
||||
self.health_monitor()
|
||||
) as (pool, hm):
|
||||
data = {"health_monitor": {
|
||||
"id": hm['health_monitor']['id'],
|
||||
'tenant_id': self._tenant_id}}
|
||||
self.plugin.create_pool_health_monitor(
|
||||
context.get_admin_context(),
|
||||
data, pool['pool']['id']
|
||||
)
|
||||
driver_call.assert_called_once_with(
|
||||
mock.ANY, hm['health_monitor'], pool['pool']['id'])
|
||||
|
||||
def test_create_pool_healthmon_invalid_pool_id(self):
|
||||
with self.health_monitor() as healthmon:
|
||||
self.assertRaises(loadbalancer.PoolNotFound,
|
||||
|
Loading…
x
Reference in New Issue
Block a user