Merge "NSX|V: treat edge cases with edge deletions"
This commit is contained in:
commit
9439aa0a76
@ -17,6 +17,7 @@ import random
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
from neutron_lib import constants as lib_const
|
from neutron_lib import constants as lib_const
|
||||||
|
from neutron_lib import context as q_context
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
@ -530,9 +531,14 @@ class EdgeApplianceDriver(object):
|
|||||||
LOG.error("Failed to resize edge: %s", e.response)
|
LOG.error("Failed to resize edge: %s", e.response)
|
||||||
|
|
||||||
def delete_edge(self, context, router_id, edge_id, dist=False):
|
def delete_edge(self, context, router_id, edge_id, dist=False):
|
||||||
|
LOG.debug("Deleting edge %s", edge_id)
|
||||||
|
if context is None:
|
||||||
|
context = q_context.get_admin_context()
|
||||||
try:
|
try:
|
||||||
|
LOG.debug("Deleting router binding %s", router_id)
|
||||||
nsxv_db.delete_nsxv_router_binding(context.session, router_id)
|
nsxv_db.delete_nsxv_router_binding(context.session, router_id)
|
||||||
if not dist:
|
if not dist:
|
||||||
|
LOG.debug("Deleting vnic bindings for edge %s", edge_id)
|
||||||
nsxv_db.clean_edge_vnic_binding(context.session, edge_id)
|
nsxv_db.clean_edge_vnic_binding(context.session, edge_id)
|
||||||
except sa_exc.NoResultFound:
|
except sa_exc.NoResultFound:
|
||||||
LOG.warning("Router Binding for %s not found", router_id)
|
LOG.warning("Router Binding for %s not found", router_id)
|
||||||
|
@ -290,7 +290,7 @@ class EdgeManager(object):
|
|||||||
context.session, router_binding['router_id'],
|
context.session, router_binding['router_id'],
|
||||||
status=constants.PENDING_DELETE)
|
status=constants.PENDING_DELETE)
|
||||||
self._get_worker_pool().spawn_n(
|
self._get_worker_pool().spawn_n(
|
||||||
self.nsxv_manager.delete_edge, q_context.get_admin_context(),
|
self.nsxv_manager.delete_edge, None,
|
||||||
router_binding['router_id'], router_binding['edge_id'],
|
router_binding['router_id'], router_binding['edge_id'],
|
||||||
dist=(router_binding['edge_type'] == nsxv_constants.VDR_EDGE))
|
dist=(router_binding['edge_type'] == nsxv_constants.VDR_EDGE))
|
||||||
|
|
||||||
@ -306,7 +306,7 @@ class EdgeManager(object):
|
|||||||
LOG.debug("Start deleting extra edge: %s in pool",
|
LOG.debug("Start deleting extra edge: %s in pool",
|
||||||
binding['edge_id'])
|
binding['edge_id'])
|
||||||
self._get_worker_pool().spawn_n(
|
self._get_worker_pool().spawn_n(
|
||||||
self.nsxv_manager.delete_edge, q_context.get_admin_context(),
|
self.nsxv_manager.delete_edge, None,
|
||||||
binding['router_id'], binding['edge_id'],
|
binding['router_id'], binding['edge_id'],
|
||||||
dist=(binding['edge_type'] == nsxv_constants.VDR_EDGE))
|
dist=(binding['edge_type'] == nsxv_constants.VDR_EDGE))
|
||||||
|
|
||||||
@ -773,7 +773,7 @@ class EdgeManager(object):
|
|||||||
# delete edge
|
# delete edge
|
||||||
self._get_worker_pool().spawn_n(
|
self._get_worker_pool().spawn_n(
|
||||||
self.nsxv_manager.delete_edge,
|
self.nsxv_manager.delete_edge,
|
||||||
q_context.get_admin_context(),
|
None,
|
||||||
router_id, edge_id, dist=dist)
|
router_id, edge_id, dist=dist)
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -812,7 +812,7 @@ class EdgeManager(object):
|
|||||||
# delete edge
|
# delete edge
|
||||||
self._get_worker_pool().spawn_n(
|
self._get_worker_pool().spawn_n(
|
||||||
self.nsxv_manager.delete_edge,
|
self.nsxv_manager.delete_edge,
|
||||||
q_context.get_admin_context(),
|
None,
|
||||||
router_id, edge_id, dist=dist)
|
router_id, edge_id, dist=dist)
|
||||||
|
|
||||||
def _allocate_dhcp_edge_appliance(self, context, resource_id,
|
def _allocate_dhcp_edge_appliance(self, context, resource_id,
|
||||||
|
Loading…
Reference in New Issue
Block a user