Merge "NSX: Fix foreign key constraint delete provider network"
This commit is contained in:
commit
529cca4548
@ -41,6 +41,11 @@ def get_network_bindings_by_vlanid_and_physical_net(session, vlan_id,
|
||||
all())
|
||||
|
||||
|
||||
def delete_network_bindings(session, network_id):
|
||||
return (session.query(models.TzNetworkBinding).
|
||||
filter_by(network_id=network_id).delete())
|
||||
|
||||
|
||||
def add_network_binding(session, network_id, binding_type, phy_uuid, vlan_id):
|
||||
with session.begin(subtransactions=True):
|
||||
binding = models.TzNetworkBinding(network_id, binding_type,
|
||||
|
@ -1006,6 +1006,7 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
context.session, self.cluster, id)
|
||||
with context.session.begin(subtransactions=True):
|
||||
self._process_l3_delete(context, id)
|
||||
nsx_db.delete_network_bindings(context.session, id)
|
||||
super(NsxPluginV2, self).delete_network(context, id)
|
||||
|
||||
# Do not go to NSX for external networks
|
||||
|
@ -14,6 +14,7 @@
|
||||
# under the License.
|
||||
|
||||
from oslo.config import cfg
|
||||
import webob.exc
|
||||
|
||||
from neutron.extensions import multiprovidernet as mpnet
|
||||
from neutron.extensions import providernet as pnet
|
||||
@ -23,7 +24,7 @@ from neutron.tests.unit.vmware import test_nsx_plugin
|
||||
|
||||
class TestProvidernet(test_nsx_plugin.NsxPluginV2TestCase):
|
||||
|
||||
def test_create_provider_network_default_physical_net(self):
|
||||
def test_create_delete_provider_network_default_physical_net(self):
|
||||
data = {'network': {'name': 'net1',
|
||||
'admin_state_up': True,
|
||||
'tenant_id': 'admin',
|
||||
@ -33,6 +34,9 @@ class TestProvidernet(test_nsx_plugin.NsxPluginV2TestCase):
|
||||
net = self.deserialize(self.fmt, network_req.get_response(self.api))
|
||||
self.assertEqual(net['network'][pnet.NETWORK_TYPE], 'vlan')
|
||||
self.assertEqual(net['network'][pnet.SEGMENTATION_ID], 411)
|
||||
req = self.new_delete_request('networks', net['network']['id'])
|
||||
res = req.get_response(self.api)
|
||||
self.assertEqual(res.status_int, webob.exc.HTTPNoContent.code)
|
||||
|
||||
def test_create_provider_network(self):
|
||||
data = {'network': {'name': 'net1',
|
||||
|
Loading…
x
Reference in New Issue
Block a user