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
(cherry picked from commit f392263ae8)
This commit is contained in:
Kevin Benton 2013-06-18 12:10:07 -07:00 committed by Gary Kotton
parent 57b2bcf7f7
commit 0d59115cfa
1 changed files with 7 additions and 2 deletions

View File

@ -681,17 +681,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)