NSX-mh: perform appropriate pre-delete checks
This patch ensures that pre-delete checks are executed in the appropriate way for both DVR and 'traditional' routers, by invoking the _ensure_router_not_in_use method defined in neutron.db.l3_db.L3_nat_dbonly_mixin Also, verify metadata network before removing router to ensure metada access network's router port is removed if not yet deleted. Applied from commit: 5a07069824d468bc9b49cf72c8d5092d5a8a523f Change-Id: I96933c4523bdd90fbc2647f4860533f8d53802e4 Closes-Bug: #1479309
This commit is contained in:
parent
8819c6983b
commit
5bc885ddc0
|
@ -1551,26 +1551,11 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||
# transaction, and it should be restored on rollback
|
||||
self.handle_router_metadata_access(
|
||||
context, router_id, interface=None)
|
||||
# Pre-delete checks
|
||||
# NOTE(salv-orlando): These checks will be repeated anyway when
|
||||
# calling the superclass. This is wasteful, but is the simplest
|
||||
# way of ensuring a consistent removal of the router both in
|
||||
# the neutron Database and in the NSX backend.
|
||||
# TODO(salv-orlando): split pre-delete checks and actual
|
||||
# deletion in superclass.
|
||||
|
||||
# Ensure that the router is not used
|
||||
fips = self.get_floatingips_count(
|
||||
context.elevated(), filters={'router_id': [router_id]})
|
||||
if fips:
|
||||
raise l3.RouterInUse(router_id=router_id)
|
||||
|
||||
device_filter = {'device_id': [router_id],
|
||||
'device_owner': [l3_db.DEVICE_OWNER_ROUTER_INTF]}
|
||||
ports = self._core_plugin.get_ports_count(context.elevated(),
|
||||
filters=device_filter)
|
||||
if ports:
|
||||
raise l3.RouterInUse(router_id=router_id)
|
||||
self._ensure_router_not_in_use(context, router_id)
|
||||
|
||||
nsx_router_id = nsx_utils.get_nsx_router_id(
|
||||
context.session, self.cluster, router_id)
|
||||
|
|
Loading…
Reference in New Issue