LBaaS: add status of pool-monitor association to the pool return dict
Closes-Bug: #1219692 Change-Id: Icc7ca4a48c43a8462860cdbc42626079bffadc26
This commit is contained in:
parent
0f35cddf1a
commit
70902ad435
@ -479,6 +479,11 @@ class LoadBalancerPluginDb(LoadBalancerPluginBase,
|
|||||||
# Get the associated health_monitors
|
# Get the associated health_monitors
|
||||||
res['health_monitors'] = [
|
res['health_monitors'] = [
|
||||||
monitor['monitor_id'] for monitor in pool['monitors']]
|
monitor['monitor_id'] for monitor in pool['monitors']]
|
||||||
|
res['health_monitors_status'] = [
|
||||||
|
{'monitor_id': monitor['monitor_id'],
|
||||||
|
'status': monitor['status'],
|
||||||
|
'status_description': monitor['status_description']}
|
||||||
|
for monitor in pool['monitors']]
|
||||||
return self._fields(res, fields)
|
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):
|
||||||
|
@ -175,6 +175,8 @@ RESOURCE_ATTRIBUTE_MAP = {
|
|||||||
'validate': {'type:uuid_list': None},
|
'validate': {'type:uuid_list': None},
|
||||||
'convert_to': attr.convert_to_list,
|
'convert_to': attr.convert_to_list,
|
||||||
'is_visible': True},
|
'is_visible': True},
|
||||||
|
'health_monitors_status': {'allow_post': False, 'allow_put': False,
|
||||||
|
'is_visible': True},
|
||||||
'admin_state_up': {'allow_post': True, 'allow_put': True,
|
'admin_state_up': {'allow_post': True, 'allow_put': True,
|
||||||
'default': True,
|
'default': True,
|
||||||
'convert_to': attr.convert_to_boolean,
|
'convert_to': attr.convert_to_boolean,
|
||||||
@ -308,6 +310,7 @@ class Loadbalancer(extensions.ExtensionDescriptor):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def get_resources(cls):
|
def get_resources(cls):
|
||||||
my_plurals = [(key, key[:-1]) for key in RESOURCE_ATTRIBUTE_MAP.keys()]
|
my_plurals = [(key, key[:-1]) for key in RESOURCE_ATTRIBUTE_MAP.keys()]
|
||||||
|
my_plurals.append(('health_monitors_status', 'health_monitor_status'))
|
||||||
attr.PLURALS.update(dict(my_plurals))
|
attr.PLURALS.update(dict(my_plurals))
|
||||||
resources = []
|
resources = []
|
||||||
plugin = manager.NeutronManager.get_service_plugins()[
|
plugin = manager.NeutronManager.get_service_plugins()[
|
||||||
|
@ -1109,6 +1109,16 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
|||||||
res['pool']['health_monitors'])
|
res['pool']['health_monitors'])
|
||||||
self.assertIn(monitor2['health_monitor']['id'],
|
self.assertIn(monitor2['health_monitor']['id'],
|
||||||
res['pool']['health_monitors'])
|
res['pool']['health_monitors'])
|
||||||
|
expected = [
|
||||||
|
{'monitor_id': monitor1['health_monitor']['id'],
|
||||||
|
'status': 'PENDING_CREATE',
|
||||||
|
'status_description': None},
|
||||||
|
{'monitor_id': monitor2['health_monitor']['id'],
|
||||||
|
'status': 'PENDING_CREATE',
|
||||||
|
'status_description': None}]
|
||||||
|
self.assertEqual(
|
||||||
|
sorted(expected),
|
||||||
|
sorted(res['pool']['health_monitors_status']))
|
||||||
|
|
||||||
def test_delete_healthmonitor_of_pool(self):
|
def test_delete_healthmonitor_of_pool(self):
|
||||||
with self.health_monitor(type="TCP") as monitor1:
|
with self.health_monitor(type="TCP") as monitor1:
|
||||||
@ -1161,6 +1171,13 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
|||||||
res['pool']['health_monitors'])
|
res['pool']['health_monitors'])
|
||||||
self.assertIn(monitor2['health_monitor']['id'],
|
self.assertIn(monitor2['health_monitor']['id'],
|
||||||
res['pool']['health_monitors'])
|
res['pool']['health_monitors'])
|
||||||
|
expected = [
|
||||||
|
{'monitor_id': monitor2['health_monitor']['id'],
|
||||||
|
'status': 'PENDING_CREATE',
|
||||||
|
'status_description': None}
|
||||||
|
]
|
||||||
|
self.assertEqual(expected,
|
||||||
|
res['pool']['health_monitors_status'])
|
||||||
|
|
||||||
def test_create_loadbalancer(self):
|
def test_create_loadbalancer(self):
|
||||||
vip_name = "vip3"
|
vip_name = "vip3"
|
||||||
@ -1221,6 +1238,13 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
|||||||
pool_updated['pool']['members'])
|
pool_updated['pool']['members'])
|
||||||
self.assertIn(health_monitor['health_monitor']['id'],
|
self.assertIn(health_monitor['health_monitor']['id'],
|
||||||
pool_updated['pool']['health_monitors'])
|
pool_updated['pool']['health_monitors'])
|
||||||
|
expected = [
|
||||||
|
{'monitor_id': health_monitor['health_monitor']['id'],
|
||||||
|
'status': 'PENDING_CREATE',
|
||||||
|
'status_description': None}
|
||||||
|
]
|
||||||
|
self.assertEqual(
|
||||||
|
expected, pool_updated['pool']['health_monitors_status'])
|
||||||
|
|
||||||
req = self.new_show_request('vips',
|
req = self.new_show_request('vips',
|
||||||
vip_id,
|
vip_id,
|
||||||
|
Loading…
Reference in New Issue
Block a user