Don't overwrite binding-profile

Currently when providing existing direct port, nova-compute
will overwrite the binding-profile information with pci_vendor_info
and pci_slot. The binding-profile will be used to request
NIC capabilities for SR-IOV ports [1]. This also allows to distinguish
which neutron mechanism driver will bind the port [2].

This patch updates the behaviour that on update port it will update,
rather than overwrite, the binding-profile information with
pci_vendor_info and pci_slot. And on unbind port it will remove
only the pci_vendor_info and pci_slot from the port binding-profile
rather than unsetting the entire field.

[1] https://review.openstack.org/#/c/435954/
[2] https://review.openstack.org/#/c/499203/

Closes-Bug: #1719327

Change-Id: Id847949b4761d51a14e5c2f39552f60a47889aa9
This commit is contained in:
Moshe Levi 2017-11-12 08:55:15 +02:00
parent e92593ba13
commit e40f78bf09

@ -1216,6 +1216,13 @@ class NeutronFixture(fixtures.Fixture):
else:
return None
def _filter_ports(self, **_params):
ports = copy.deepcopy(self._ports)
for opt in _params:
filtered_ports = [p for p in ports if p.get(opt) == _params[opt]]
ports = filtered_ports
return {'ports': ports}
def list_extensions(self, *args, **kwargs):
return copy.deepcopy({'extensions': self._extensions})
@ -1234,7 +1241,7 @@ class NeutronFixture(fixtures.Fixture):
return copy.deepcopy({'networks': self._networks})
def list_ports(self, retrieve_all=True, **_params):
return copy.deepcopy({'ports': self._ports})
return self._filter_ports(**_params)
def list_subnets(self, retrieve_all=True, **_params):
return copy.deepcopy({'subnets': self._subnets})