Sets binding:profile to empty dic when unbinding port

When binding preexisting ports, direct/macvtap, nova
adds the binding:profile information. But when deleting
the VM, the port binding:profile information still kept.

This patch sets binding:profile to empty dic when unbinding it.

Closes-Bug: #1524643

Change-Id: I127e88a9bcdad44b795a245e566ab276de09fd82
This commit is contained in:
Moshe Levi 2015-12-24 18:50:12 +02:00
parent dc905be8b6
commit caeeb5d505
2 changed files with 2 additions and 0 deletions

View File

@ -330,6 +330,7 @@ class API(base_api.NetworkAPI):
port_req_body = {'port': {'device_id': '', 'device_owner': ''}}
if port_binding:
port_req_body['port']['binding:host_id'] = None
port_req_body['port']['binding:profile'] = {}
try:
port_client.update_port(port_id, port_req_body)
except Exception:

View File

@ -3365,6 +3365,7 @@ class TestNeutronv2WithMock(test.TestCase):
body = {'port': {'device_id': '', 'device_owner': ''}}
if has_ext:
body['port']['binding:host_id'] = None
body['port']['binding:profile'] = {}
update_port_calls = []
for p in ports:
update_port_calls.append(mock.call(p, body))