← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1772874] [NEW] attr_ops.verify_attributes() wrongly reject binding:host_id in _fixup_res_dict()

 

Public bug reported:

While testing puppet-openstack and Neutron with Debian packages (ie:
running with Stretch and Queens), I had to use neutron-api using uwsgi,
as /usr/bin/neutron-server would not work with Eventlet + Python 3
(which is famously broken). Therefore, I did a setup with uwsgi and
running nova-rpc-server.

Then, I tried spawning an instance, then I got some issues in the rpc-
server:

 [req-4b2c2379-78ef-437c-b08a-bd8b309fa0b0 - - - - -] Exception during message handling: ValueError: Unrecognized attribute(s) 'binding:host_id'
 Traceback (most recent call last):
   File "/usr/lib/python3/dist-packages/neutron/plugins/common/utils.py", line 162, in _fixup_res_dict
     attr_ops.verify_attributes(res_dict)
   File "/usr/lib/python3/dist-packages/neutron_lib/api/attributes.py", line 200, in verify_attributes
     raise exc.HTTPBadRequest(msg)
 webob.exc.HTTPBadRequest: Unrecognized attribute(s) 'binding:host_id'

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "/usr/lib/python3/dist-packages/oslo_messaging/rpc/server.py", line 163, in _process_incoming
     res = self.dispatcher.dispatch(message)
   File "/usr/lib/python3/dist-packages/oslo_messaging/rpc/dispatcher.py", line 220, in dispatch
     return self._do_dispatch(endpoint, method, ctxt, args)
   File "/usr/lib/python3/dist-packages/oslo_messaging/rpc/dispatcher.py", line 190, in _do_dispatch
     result = func(ctxt, **new_args)
   File "/usr/lib/python3/dist-packages/oslo_messaging/rpc/server.py", line 226, in inner
     return func(*args, **kwargs)
   File "/usr/lib/python3/dist-packages/neutron/db/api.py", line 91, in wrapped
     setattr(e, '_RETRY_EXCEEDED', True)
   File "/usr/lib/python3/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
     self.force_reraise()
   File "/usr/lib/python3/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
     six.reraise(self.type_, self.value, self.tb)
   File "/usr/lib/python3/dist-packages/six.py", line 693, in reraise
     raise value
   File "/usr/lib/python3/dist-packages/neutron/db/api.py", line 87, in wrapped
     return f(*args, **kwargs)
   File "/usr/lib/python3/dist-packages/oslo_db/api.py", line 147, in wrapper
     ectxt.value = e.inner_exc
   File "/usr/lib/python3/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
     self.force_reraise()
   File "/usr/lib/python3/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
     six.reraise(self.type_, self.value, self.tb)
   File "/usr/lib/python3/dist-packages/six.py", line 693, in reraise
     raise value
   File "/usr/lib/python3/dist-packages/oslo_db/api.py", line 135, in wrapper
     return f(*args, **kwargs)
   File "/usr/lib/python3/dist-packages/neutron/db/api.py", line 126, in wrapped
     LOG.debug("Retry wrapper got retriable exception: %s", e)
   File "/usr/lib/python3/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
     self.force_reraise()
   File "/usr/lib/python3/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
     six.reraise(self.type_, self.value, self.tb)
   File "/usr/lib/python3/dist-packages/six.py", line 693, in reraise
     raise value
   File "/usr/lib/python3/dist-packages/neutron/db/api.py", line 122, in wrapped
     return f(*dup_args, **dup_kwargs)
   File "/usr/lib/python3/dist-packages/neutron/quota/resource_registry.py", line 99, in wrapper
     ret_val = f(_self, context, *args, **kwargs)
   File "/usr/lib/python3/dist-packages/neutron/api/rpc/handlers/dhcp_rpc.py", line 271, in create_dhcp_port
     return self._port_action(plugin, context, port, 'create_port')
   File "/usr/lib/python3/dist-packages/neutron/api/rpc/handlers/dhcp_rpc.py", line 98, in _port_action
     return p_utils.create_port(plugin, context, port)
   File "/usr/lib/python3/dist-packages/neutron/plugins/common/utils.py", line 189, in create_port
     check_allow_post=check_allow_post)
   File "/usr/lib/python3/dist-packages/neutron/plugins/common/utils.py", line 166, in _fixup_res_dict
     raise ValueError(e.detail)
 ValueError: Unrecognized attribute(s) 'binding:host_id'

FYI, the content of the res_dict variable before calling
attr_ops.verify_attributes(res_dict) is as follow (I added a LOG.debug()
to find out):

res_dict var: {'device_owner': 'network:dhcp', 'network_id': '5fa58f3a-
3a72-4d5a-a781-dca20d882007', 'fixed_ips': [{'subnet_id': '85a0b153-fcd8
-418d-90c2-7d0140431d61'}], 'mac_address':
<neutron_lib.constants.Sentinel object at 0x7f4114ee65c0>, 'name': '',
'admin_state_up': True, 'binding:host_id': 'poi', 'device_id':
'dhcp6d2441eb-6701-5705-adb9-c31fa3421a1a-5fa58f3a-
3a72-4d5a-a781-dca20d882007', 'tenant_id':
'be123aff43cd4699a0fd062dc0f898c6'}

As the binding:host_id looked valid to me (it's been there for years in
Neutron), I figured out that the parameter validation code must have had
something wrong, so I commented out the
attr_ops.verify_attributes(res_dict) call. And without the check,
everything worked again.

So, my guess is that there's either something wrong in the parameters
when calling attr_ops.verify_attributes, or (less likely) there's an
issue in neutron_lib/api/attributes.py.

** Affects: neutron
     Importance: Undecided
         Status: New

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

Title:
  attr_ops.verify_attributes() wrongly reject binding:host_id in
  _fixup_res_dict()

Status in neutron:
  New

Bug description:
  While testing puppet-openstack and Neutron with Debian packages (ie:
  running with Stretch and Queens), I had to use neutron-api using
  uwsgi, as /usr/bin/neutron-server would not work with Eventlet +
  Python 3 (which is famously broken). Therefore, I did a setup with
  uwsgi and running nova-rpc-server.

  Then, I tried spawning an instance, then I got some issues in the rpc-
  server:

   [req-4b2c2379-78ef-437c-b08a-bd8b309fa0b0 - - - - -] Exception during message handling: ValueError: Unrecognized attribute(s) 'binding:host_id'
   Traceback (most recent call last):
     File "/usr/lib/python3/dist-packages/neutron/plugins/common/utils.py", line 162, in _fixup_res_dict
       attr_ops.verify_attributes(res_dict)
     File "/usr/lib/python3/dist-packages/neutron_lib/api/attributes.py", line 200, in verify_attributes
       raise exc.HTTPBadRequest(msg)
   webob.exc.HTTPBadRequest: Unrecognized attribute(s) 'binding:host_id'

   During handling of the above exception, another exception occurred:

   Traceback (most recent call last):
     File "/usr/lib/python3/dist-packages/oslo_messaging/rpc/server.py", line 163, in _process_incoming
       res = self.dispatcher.dispatch(message)
     File "/usr/lib/python3/dist-packages/oslo_messaging/rpc/dispatcher.py", line 220, in dispatch
       return self._do_dispatch(endpoint, method, ctxt, args)
     File "/usr/lib/python3/dist-packages/oslo_messaging/rpc/dispatcher.py", line 190, in _do_dispatch
       result = func(ctxt, **new_args)
     File "/usr/lib/python3/dist-packages/oslo_messaging/rpc/server.py", line 226, in inner
       return func(*args, **kwargs)
     File "/usr/lib/python3/dist-packages/neutron/db/api.py", line 91, in wrapped
       setattr(e, '_RETRY_EXCEEDED', True)
     File "/usr/lib/python3/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
       self.force_reraise()
     File "/usr/lib/python3/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
       six.reraise(self.type_, self.value, self.tb)
     File "/usr/lib/python3/dist-packages/six.py", line 693, in reraise
       raise value
     File "/usr/lib/python3/dist-packages/neutron/db/api.py", line 87, in wrapped
       return f(*args, **kwargs)
     File "/usr/lib/python3/dist-packages/oslo_db/api.py", line 147, in wrapper
       ectxt.value = e.inner_exc
     File "/usr/lib/python3/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
       self.force_reraise()
     File "/usr/lib/python3/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
       six.reraise(self.type_, self.value, self.tb)
     File "/usr/lib/python3/dist-packages/six.py", line 693, in reraise
       raise value
     File "/usr/lib/python3/dist-packages/oslo_db/api.py", line 135, in wrapper
       return f(*args, **kwargs)
     File "/usr/lib/python3/dist-packages/neutron/db/api.py", line 126, in wrapped
       LOG.debug("Retry wrapper got retriable exception: %s", e)
     File "/usr/lib/python3/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
       self.force_reraise()
     File "/usr/lib/python3/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
       six.reraise(self.type_, self.value, self.tb)
     File "/usr/lib/python3/dist-packages/six.py", line 693, in reraise
       raise value
     File "/usr/lib/python3/dist-packages/neutron/db/api.py", line 122, in wrapped
       return f(*dup_args, **dup_kwargs)
     File "/usr/lib/python3/dist-packages/neutron/quota/resource_registry.py", line 99, in wrapper
       ret_val = f(_self, context, *args, **kwargs)
     File "/usr/lib/python3/dist-packages/neutron/api/rpc/handlers/dhcp_rpc.py", line 271, in create_dhcp_port
       return self._port_action(plugin, context, port, 'create_port')
     File "/usr/lib/python3/dist-packages/neutron/api/rpc/handlers/dhcp_rpc.py", line 98, in _port_action
       return p_utils.create_port(plugin, context, port)
     File "/usr/lib/python3/dist-packages/neutron/plugins/common/utils.py", line 189, in create_port
       check_allow_post=check_allow_post)
     File "/usr/lib/python3/dist-packages/neutron/plugins/common/utils.py", line 166, in _fixup_res_dict
       raise ValueError(e.detail)
   ValueError: Unrecognized attribute(s) 'binding:host_id'

  FYI, the content of the res_dict variable before calling
  attr_ops.verify_attributes(res_dict) is as follow (I added a
  LOG.debug() to find out):

  res_dict var: {'device_owner': 'network:dhcp', 'network_id':
  '5fa58f3a-3a72-4d5a-a781-dca20d882007', 'fixed_ips': [{'subnet_id':
  '85a0b153-fcd8-418d-90c2-7d0140431d61'}], 'mac_address':
  <neutron_lib.constants.Sentinel object at 0x7f4114ee65c0>, 'name': '',
  'admin_state_up': True, 'binding:host_id': 'poi', 'device_id':
  'dhcp6d2441eb-6701-5705-adb9-c31fa3421a1a-5fa58f3a-
  3a72-4d5a-a781-dca20d882007', 'tenant_id':
  'be123aff43cd4699a0fd062dc0f898c6'}

  As the binding:host_id looked valid to me (it's been there for years
  in Neutron), I figured out that the parameter validation code must
  have had something wrong, so I commented out the
  attr_ops.verify_attributes(res_dict) call. And without the check,
  everything worked again.

  So, my guess is that there's either something wrong in the parameters
  when calling attr_ops.verify_attributes, or (less likely) there's an
  issue in neutron_lib/api/attributes.py.

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


Follow ups