]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Move _delete_port
authorPavel Bondar <pbondar@infoblox.com>
Thu, 18 Jun 2015 12:24:44 +0000 (15:24 +0300)
committerPavel Bondar <pbondar@infoblox.com>
Mon, 22 Jun 2015 08:09:16 +0000 (08:09 +0000)
Pluggable ipam implementation will do additional actions on port
deletion (deallocate ip using ipam driver).
Existing _delete_port code will be resused.
Moving _delete_port to ipam_backend_mixin to make this code
accessible and extendable by both backends (pluggable and non
pluggable).

This commit is a preparation step before pluggable ipam implementation
can be used.

Partially-Implements: blueprint neutron-ipam

Change-Id: If6cd623aad9e5501a26e5fb8cdecd5f55e85cd05

neutron/db/db_base_plugin_v2.py
neutron/db/ipam_backend_mixin.py

index ed7126ac0056888e3ecc20039ff202fa1a6bbbb0..ca0bd27666cca0bbce00ce61825f66caef46db08 100644 (file)
@@ -1078,13 +1078,6 @@ class NeutronDbPluginV2(ipam_non_pluggable_backend.IpamNonPluggableBackend,
                           "The port has already been deleted.",
                           port_id)
 
-    def _delete_port(self, context, id):
-        query = (context.session.query(models_v2.Port).
-                 enable_eagerloads(False).filter_by(id=id))
-        if not context.is_admin:
-            query = query.filter_by(tenant_id=context.tenant_id)
-        query.delete()
-
     def get_port(self, context, id, fields=None):
         port = self._get_port(context, id)
         return self._make_port_dict(port, fields)
index f7b231d12cd82934d63310c4d046e60537877177..ea4ec26b6f98b5b775c50becf1e8deddf57219f4 100644 (file)
@@ -252,3 +252,10 @@ class IpamBackendMixin(db_base_plugin_common.DbBasePluginCommon):
         return self.Changes(add=new_ips,
                             original=prev_ips,
                             remove=original_ips)
+
+    def _delete_port(self, context, port_id):
+        query = (context.session.query(models_v2.Port).
+                 enable_eagerloads(False).filter_by(id=port_id))
+        if not context.is_admin:
+            query = query.filter_by(tenant_id=context.tenant_id)
+        query.delete()