]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Remove _delete_port_security_group_bindings from delete_port
authoryangxurong <yangxurong@huawei.com>
Mon, 29 Sep 2014 03:37:19 +0000 (11:37 +0800)
committeryangxurong <yangxurong@huawei.com>
Wed, 24 Dec 2014 02:34:32 +0000 (10:34 +0800)
Since SecurityGroupPortBinding has a foreign key constraint with Port
and cascade deleting is defined, SecurityGroupPortBinding can be
deleted when port is deleted, thus _delete_port_security_group_bindings
call in ML2 delete_port is not needed and can be removed. Redundant
calls in other core plugins are also removed in this patch.

_delete_port_security_group_bindings is needed when updating ports so
this method cannot be removed directly.

Change-Id: I33c787fbed46d6049d3b24ccd246a8484d8aa306
Closes-Bug: #1373199

neutron/plugins/bigswitch/plugin.py
neutron/plugins/ml2/plugin.py
neutron/plugins/nec/nec_plugin.py
neutron/plugins/nuage/plugin.py
neutron/plugins/oneconvergence/plugin.py

index 55604508f5e3647be779e9decac2eb4aa58e6f9f..e827bf3c0d79a5323a82599c0ebc5b37646d81ef 100644 (file)
@@ -819,7 +819,6 @@ class NeutronRestProxyV2(NeutronRestProxyV2Base,
             if self.l3_plugin:
                 router_ids = self.l3_plugin.disassociate_floatingips(
                     context, port_id, do_notify=False)
-            self._delete_port_security_group_bindings(context, port_id)
             port = super(NeutronRestProxyV2, self).get_port(context, port_id)
             # Tenant ID must come from network in case the network is shared
             tenid = self._get_port_net_tenantid(context, port)
index 18b044ea429240ed170141595c1ffcd264653972..fd3f04e5eacb190f48d2ae2fea94374198815005 100644 (file)
@@ -1023,7 +1023,6 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
                         context, id)
                 self.mechanism_manager.delete_port_precommit(mech_context)
                 bound_mech_contexts.append(mech_context)
-                self._delete_port_security_group_bindings(context, id)
             if l3plugin:
                 router_ids = l3plugin.disassociate_floatingips(
                     context, id, do_notify=False)
index 4ae65669900063ead6dd990ec7522f23365b42f7..2a16306adaaa2215a4cbb4dfe15ddcded9e62a6e 100644 (file)
@@ -664,7 +664,6 @@ class NECPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
         with context.session.begin(subtransactions=True):
             router_ids = self.disassociate_floatingips(
                 context, id, do_notify=False)
-            self._delete_port_security_group_bindings(context, id)
             super(NECPluginV2, self).delete_port(context, id)
 
         # now that we've left db transaction, we are safe to notify
index 0da031d8b082af21677c478d2e18f974cfaa11f6..c6640b4a486ffa35b52519a03aac3680e9d57e9a 100644 (file)
@@ -358,7 +358,7 @@ class NuagePlugin(db_base_plugin_v2.NeutronDbPluginV2,
 
         # Need to call this explicitly to delete vport to vporttag binding
         if ext_sg.SECURITYGROUPS in port:
-            self._delete_port_security_group_bindings(context, id)
+            self.nuageclient.delete_port_security_group_bindings(id)
 
         netpart_id = subnet_mapping['net_partition_id']
         net_partition = nuagedb.get_net_partition_by_id(context.session,
index f0daa004af0b6095d5e53cd9a29de9fda7860afc..0f415a0c78cb0517cbb0416ae6716e01381ba028 100644 (file)
@@ -346,8 +346,6 @@ class OneConvergencePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
             neutron_port = super(OneConvergencePluginV2,
                                  self).get_port(context, port_id)
 
-            self._delete_port_security_group_bindings(context, port_id)
-
             router_ids = self.disassociate_floatingips(
                 context, port_id, do_notify=False)