]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Remove redundant codes
authorshihanzhang <shihanzhang@huawei.com>
Tue, 31 Dec 2013 07:22:40 +0000 (15:22 +0800)
committershihanzhang <shihanzhang@huawei.com>
Tue, 31 Dec 2013 08:09:31 +0000 (16:09 +0800)
the code is redundant, it should be removed

Change-Id: I050bfc0b4d72037510dc2f3d729a564869a374c2
Closes-Bug: #1265132

neutron/db/l3_db.py

index ab6017f5c2cd83afeb5fedb4687fba7737299006..71be3c41d08d70bf4dae9dcc9dbd46b89f8f9c4b 100644 (file)
@@ -196,13 +196,12 @@ class L3_NAT_db_mixin(l3.RouterPluginBase):
             if fip_count:
                 raise l3.RouterExternalGatewayInUseByFloatingIp(
                     router_id=router_id, net_id=gw_port['network_id'])
-            if gw_port and gw_port['network_id'] != network_id:
-                with context.session.begin(subtransactions=True):
-                    router.gw_port = None
-                    context.session.add(router)
-                self._core_plugin.delete_port(context.elevated(),
-                                              gw_port['id'],
-                                              l3_port_check=False)
+            with context.session.begin(subtransactions=True):
+                router.gw_port = None
+                context.session.add(router)
+            self._core_plugin.delete_port(context.elevated(),
+                                          gw_port['id'],
+                                          l3_port_check=False)
 
         if network_id is not None and (gw_port is None or
                                        gw_port['network_id'] != network_id):