Custom binding:profile values not coming through

Bug #1615128 reported by Eric Fried
14
This bug affects 2 people
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-0861-4ef0-b127-1bedc8fc94f3 -- --binding:profile type=dict vnic_required_vfs=3,capacity=0.06
Created a new port:
+-----------------------+------------------------------------------------------------------------------------+
| Field | Value |
+-----------------------+------------------------------------------------------------------------------------+
| admin_state_up | True |
| allowed_address_pairs | |
| binding:host_id | |
| binding:profile | {"vnic_required_vfs": "3", "capacity": "0.06"} |
| 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-7a0d-480a-82c7-adf8f58ecf52", "ip_address": "172.24.4.12"} |
| | {"subnet_id": "ddc562b9-65c3-48fe-8b3e-20ac98630375", "ip_address": "2001:db8::d"} |
| id | ff17dcab-bbf7-44f4-8f65-0e7dc32b611b |
| mac_address | fa:16:3e:4f:4b:d0 |
| name | |
| network_id | ab85306c-0861-4ef0-b127-1bedc8fc94f3 |
| port_security_enabled | True |
| revision | 5 |
| security_groups | 98413527-6c85-4c16-8fe9-da0f3fdcaa97 |
| status | DOWN |
| tenant_id | aac7c974992c44b7aaf4ecf6049c2165 |
| updated_at | 2016-08-19T17:06:17 |
+-----------------------+------------------------------------------------------------------------------------+

2) Boot an instance with that port, e.g.

$ nova boot --flavor 1 --image 58bc4e42-0189-4f4b-bdff-dfe7fcabf414 efried1 --nic port-id=ff17dcab-bbf7-44f4-8f65-0e7dc32b611b

3) The mechanism driver, accessing the binding:profile via:

profile = context.current.get(portbindings.PROFILE, {})

...cannot see the custom values.

==============================

I believe the reason lies here: https://github.com/openstack/neutron/blob/master/neutron/plugins/ml2/plugin.py#L310-L319

310 if attrs and portbindings.PROFILE in attrs:
311 profile = attrs.get(portbindings.PROFILE) or {}
312
313 if profile not in (None, const.ATTR_NOT_SPECIFIED,
314 self._get_profile(binding)):
315 binding.profile = jsonutils.dumps(profile)
316 if len(binding.profile) > models.BINDING_PROFILE_LEN:
317 msg = _("binding:profile value too large")
318 raise exc.InvalidInput(error_message=msg)
319 changes = True

Stepping through the mech driver, binding.profile contains the custom values:

(Pdb) pp binding.profile
u'{"vnic_required_vfs": "3", "capacity": "0.06"}'

But attrs does not:

(Pdb) pp attrs['binding:profile']
{u'pci_slot': u'*:*:*.*',
 u'pci_vendor_info': u'*:*',
 u'physical_network': u'default'}

At this point, the condition on lines 313-4 succeds, and binding.profile is overwritten with the contents of attrs['binding:profile']

=============================

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_vendor_info': u'*:*',
 u'physical_network': u'default',
 u'vnic_required_vfs': u'3', 'capacity': u'0.06'}

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/358125

Changed in neutron:
assignee: nobody → Eric Fried (efried)
status: New → In Progress
Revision history for this message
Armando Migliaccio (armando-migliaccio) wrote :

Binding profile is an admin only extension and is meant to be used by mech drivers, not really for regular users. I think you'd have to elaborate more on your use case, because the way this work is intentional.

The fact that binding:profile is a blob of unstructured data has been the source of grief for a while and we're slowly getting to a point where we're sanitizing binding:vif_details with the os-vif effort. I am not sure we're gonna want to allow anyone jam anything in binding:profile.

Changed in neutron:
status: In Progress → Invalid
Revision history for this message
Eric Fried (efried) wrote :

Armando, thanks for the feedback. For the use case, please reference:

https://review.openstack.org/#/c/343423/23/networking_powervm/plugins/ml2/drivers/mech_pvm_sriov.py@71

The user needs to be able to pass two (for now) pieces of information to the mech driver:
- How many SR-IOV VFs should back the vNIC
- The minimum capacity percentage each VF should get

I would be delighted if there was some other way for a user to send this information on a vif-by-vif basis (not, e.g., through flavor extra_specs). Any suggestions would be welcome.

Revision history for this message
Eric Fried (efried) wrote :

By the way, my assumption that binding:profile was okay for users was based on the fact that it's available via the CLI.

Revision history for this message
Eric Fried (efried) wrote :

Summary of outside discussions:

This bug will not be fixed. The general philosophy is that neutron should be generic and portable, and should therefore not expose the ability to pass arbitrary backend-specific metadata through the vif.

The case can be made for the "genericness" of these two tunables (guaranteed bandwidth and redundancy/failover); but such tunables should be added explicitly to the API, probably under the auspices of QoS. That work would need to be done via the RFE process (blueprints, etc.), and in a future release given where we are in the Newton cycle.

References:

1) IRC discussion between efried1 and armax:
http://eavesdrop.openstack.org/irclogs/%23openstack-neutron/%23openstack-neutron.2016-08-24.log.html#t2016-08-24T21:58:50

2) Previous bug on similar topic; lots of background on the philosophy behind it all:
https://bugs.launchpad.net/neutron/+bug/1460222

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (master)

Change abandoned by Eric Fried (<email address hidden>) on branch: master
Review: https://review.openstack.org/358125
Reason: See https://bugs.launchpad.net/neutron/+bug/1615128

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.