]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Always include tenant_id in port delete request
authorKevin Benton <kevin.benton@bigswitch.com>
Tue, 18 Jun 2013 19:10:07 +0000 (12:10 -0700)
committerKevin Benton <kevin.benton@bigswitch.com>
Tue, 18 Jun 2013 20:25:25 +0000 (13:25 -0700)
Quantum does not include the tenant_id in port objects for floating IP addresses.
However, the Big Switch backend requires the tenant_id in the port removal requests.
This looks up the correct tenant_id whenever it is missing in the port removal.

Change-Id: I7580ed2f545ad2d92b831b65dfbb34541bf465aa
Fixes: bug #1190020
quantum/plugins/bigswitch/plugin.py

index 0a53849f129abb6e5fbcbba3300cc3a37d6cf95e..5a16aaf3c5cbbd9c8b3911eb0a35531a7f3538cc 100644 (file)
@@ -701,17 +701,22 @@ class QuantumRestProxyV2(db_base_plugin_v2.QuantumDbPluginV2,
     def _delete_port(self, context, port_id):
         # Delete from DB
         port = super(QuantumRestProxyV2, self).get_port(context, port_id)
+        tenant_id = port['tenant_id']
+        if tenant_id == '':
+            net = super(QuantumRestProxyV2,
+                        self).get_network(context, port['network_id'])
+            tenant_id = net['tenant_id']
 
         # delete from network ctrl. Remote error on delete is ignored
         try:
-            resource = PORTS_PATH % (port["tenant_id"], port["network_id"],
+            resource = PORTS_PATH % (tenant_id, port["network_id"],
                                      port_id)
             ret = self.servers.delete(resource)
             if not self.servers.action_success(ret):
                 raise RemoteRestError(ret[2])
 
             if port.get("device_id"):
-                self._unplug_interface(context, port["tenant_id"],
+                self._unplug_interface(context, tenant_id,
                                        port["network_id"], port["id"])
             ret_val = super(QuantumRestProxyV2, self)._delete_port(context,
                                                                    port_id)