From f392263ae8c89412ec8be6a13b3dd56abd129a8c Mon Sep 17 00:00:00 2001 From: Kevin Benton Date: Tue, 18 Jun 2013 12:10:07 -0700 Subject: [PATCH] Always include tenant_id in port delete request 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 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/quantum/plugins/bigswitch/plugin.py b/quantum/plugins/bigswitch/plugin.py index 0a53849f12..5a16aaf3c5 100644 --- a/quantum/plugins/bigswitch/plugin.py +++ b/quantum/plugins/bigswitch/plugin.py @@ -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)