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

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1615128

Title:
  Custom binding:profile values not coming through

Status in neutron:
  Invalid

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'}

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1615128/+subscriptions

-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to