Custom binding:profile values not coming through
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
neutron |
Invalid
|
Undecided
|
Eric Fried |
Bug Description
1) Create a port with custom binding:profile values, e.g.:
$ neutron port-create --vnic-type direct ab85306c-
Created a new port:
+------
| Field | Value |
+------
| admin_state_up | True |
| allowed_
| binding:host_id | |
| binding:profile | {"vnic_
| binding:vif_details | {} |
| binding:vif_type | unbound |
| binding:vnic_type | direct |
| created_at | 2016-08-19T17:04:01 |
| description | |
| device_id | |
| device_owner | |
| extra_dhcp_opts | |
| fixed_ips | {"subnet_id": "47171599-
| | {"subnet_id": "ddc562b9-
| id | ff17dcab-
| mac_address | fa:16:3e:4f:4b:d0 |
| name | |
| network_id | ab85306c-
| port_security_
| revision | 5 |
| security_groups | 98413527-
| status | DOWN |
| tenant_id | aac7c974992c44b
| updated_at | 2016-08-19T17:06:17 |
+------
2) Boot an instance with that port, e.g.
$ nova boot --flavor 1 --image 58bc4e42-
3) The mechanism driver, accessing the binding:profile via:
profile = context.
...cannot see the custom values.
=======
I believe the reason lies here: https:/
310 if attrs and portbindings.
311 profile = attrs.get(
312
313 if profile not in (None, const.ATTR_
314 self._get_
315 binding.profile = jsonutils.
316 if len(binding.
317 msg = _("binding:profile value too large")
318 raise exc.InvalidInpu
319 changes = True
Stepping through the mech driver, binding.profile contains the custom values:
(Pdb) pp binding.profile
u'{"vnic_
But attrs does not:
(Pdb) pp attrs['
{u'pci_slot': u'*:*:*.*',
u'pci_
u'physical_
At this point, the condition on lines 313-4 succeds, and binding.profile is overwritten with the contents of attrs['
=======
Proposal is to *combine* the two dicts in this scenario, so the resulting binding.profile will in fact contain:
{u'pci_slot': u'*:*:*.*',
u'pci_
u'physical_
u'vnic_
Fix proposed to branch: master /review. openstack. org/358125
Review: https:/