"with id: %s!"), id)
return hm
- def delete_health_monitor(self, context, id):
- with context.session.begin(subtransactions=True):
- qry = context.session.query(
- loadbalancer_db.PoolMonitorAssociation
- ).filter_by(monitor_id=id)
- for assoc in qry:
- pool_id = assoc['pool_id']
- super(NsxAdvancedPlugin,
- self).delete_pool_health_monitor(context,
- id,
- pool_id)
- pool = self.get_pool(context, pool_id)
- if not pool.get('vip_id'):
- continue
- edge_id = self._get_edge_id_by_vip_id(
- context, pool['vip_id'])
- self._resource_set_status(
- context, loadbalancer_db.Pool,
- pool_id, service_constants.PENDING_UPDATE)
- try:
- self._vcns_update_pool(context, pool)
- except Exception:
- with excutils.save_and_reraise_exception():
- LOG.exception(_("Failed to update pool with monitor!"))
- self._resource_set_status(
- context, loadbalancer_db.Pool,
- pool_id, service_constants.ACTIVE)
- try:
- self.vcns_driver.delete_health_monitor(
- context, id, edge_id)
- except Exception:
- with excutils.save_and_reraise_exception():
- LOG.exception(_("Failed to delete monitor "
- "with id: %s!"), id)
- super(NsxAdvancedPlugin,
- self).delete_health_monitor(context, id)
- self._delete_resource_router_id_binding(
- context, id, loadbalancer_db.HealthMonitor)
-
- super(NsxAdvancedPlugin, self).delete_health_monitor(context, id)
- self._delete_resource_router_id_binding(
- context, id, loadbalancer_db.HealthMonitor)
-
def create_pool_health_monitor(self, context,
health_monitor, pool_id):
monitor_id = health_monitor['health_monitor']['id']
from neutron.api.v2 import attributes
from neutron import context
-from neutron.db.loadbalancer import loadbalancer_db as ldb
from neutron.extensions import loadbalancer as lb
from neutron import manager
from neutron.openstack.common import uuidutils
with contextlib.nested(
self.subnet(),
- self.pool(),
- self.health_monitor()
- ) as (subnet, pool, health_mon):
+ self.health_monitor(),
+ self.pool()
+ ) as (subnet, health_mon, pool):
net_id = subnet['subnet']['network_id']
self._set_net_external(net_id)
with self.vip(
for k, v in keys:
self.assertEqual(res['health_monitor'][k], v)
- def test_delete_healthmonitor(self):
- ctx = context.get_admin_context()
- with contextlib.nested(
- self.subnet(),
- self.pool(),
- self.health_monitor(no_delete=True)
- ) as (subnet, pool, health_mon):
- net_id = subnet['subnet']['network_id']
- self._set_net_external(net_id)
- with self.vip(
- router_id=self._create_and_get_router(),
- pool=pool, subnet=subnet):
- self.plugin.create_pool_health_monitor(
- context.get_admin_context(),
- health_mon, pool['pool']['id']
- )
-
- req = self.new_delete_request('health_monitors',
- health_mon['health_monitor']['id'])
- res = req.get_response(self.ext_api)
- self.assertEqual(res.status_int, 204)
- qry = ctx.session.query(ldb.HealthMonitor)
- qry = qry.filter_by(id=health_mon['health_monitor']['id'])
- self.assertIsNone(qry.first())
-
def test_create_vip(self, **extras):
expected = {
'name': 'vip1',
with contextlib.nested(
self.subnet(),
- self.pool(),
- self.health_monitor()
- ) as (subnet, pool, monitor):
+ self.health_monitor(),
+ self.pool()
+ ) as (subnet, monitor, pool):
net_id = subnet['subnet']['network_id']
self._set_net_external(net_id)
expected['pool_id'] = pool['pool']['id']
with contextlib.nested(
self.subnet(),
- self.pool(),
- self.health_monitor()
- ) as (subnet, pool, monitor):
+ self.health_monitor(),
+ self.pool()
+ ) as (subnet, monitor, pool):
net_id = subnet['subnet']['network_id']
self._set_net_external(net_id)
self.plugin.create_pool_health_monitor(
def test_delete_vip(self):
with contextlib.nested(
self.subnet(),
- self.pool(),
- self.health_monitor()
- ) as (subnet, pool, monitor):
+ self.health_monitor(),
+ self.pool()
+ ) as (subnet, monitor, pool):
net_id = subnet['subnet']['network_id']
self._set_net_external(net_id)
self.plugin.create_pool_health_monitor(
with contextlib.nested(
self.subnet(),
- self.pool(),
- self.health_monitor()
- ) as (subnet, pool, monitor):
+ self.health_monitor(),
+ self.pool()
+ ) as (subnet, monitor, pool):
net_id = subnet['subnet']['network_id']
self._set_net_external(net_id)
self.plugin.create_pool_health_monitor(
'admin_state_up': False}}
with contextlib.nested(
self.subnet(),
- self.pool(),
- self.health_monitor()
- ) as (subnet, pool, monitor):
+ self.health_monitor(),
+ self.pool()
+ ) as (subnet, monitor, pool):
net_id = subnet['subnet']['network_id']
self._set_net_external(net_id)
self.plugin.create_pool_health_monitor(
router_id = self._create_and_get_router()
with contextlib.nested(
self.subnet(),
- self.pool(),
- self.health_monitor()
- ) as (subnet, pool, monitor):
+ self.health_monitor(),
+ self.pool()
+ ) as (subnet, monitor, pool):
pool_id = pool['pool']['id']
net_id = subnet['subnet']['network_id']
self._set_net_external(net_id)
def test_update_member(self):
with contextlib.nested(
self.subnet(),
+ self.health_monitor(),
self.pool(name="pool1"),
- self.pool(name="pool2"),
- self.health_monitor()
- ) as (subnet, pool1, pool2, monitor):
+ self.pool(name="pool2")
+ ) as (subnet, monitor, pool1, pool2):
net_id = subnet['subnet']['network_id']
self._set_net_external(net_id)
self.plugin.create_pool_health_monitor(
def test_delete_member(self):
with contextlib.nested(
self.subnet(),
- self.pool(),
- self.health_monitor()
- ) as (subnet, pool, monitor):
+ self.health_monitor(),
+ self.pool()
+ ) as (subnet, monitor, pool):
pool_id = pool['pool']['id']
net_id = subnet['subnet']['network_id']
self._set_net_external(net_id)