← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1545117] [NEW] neutron: 500 error when trying to attach no network to an instance with no network

 

Public bug reported:

It's possible to create a VM with nova using neutron as the backend and
have no network information. If the tenant doesn't have any available
network in neutron and doesn't request any network, the neutron backend
will simply log a message and continue.

If you then later attempt to use the os-attach-interface API and don't
provider a network, and the tenant still doesn't have any networks
available in neutron, then the request fails in the neutronv2 API code
with an IndexError because it's assuming there is at least one available
network:

http://paste.openstack.org/show/486856/

2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions Traceback (most recent call last):
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions 
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions   File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 143, in _dispatch_and_reply
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions     executor_callback))
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions 
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions   File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 189, in _dispatch
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions     executor_callback)
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions 
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions   File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 130, in _do_dispatch
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions     result = func(ctxt, **new_args)
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions 
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions   File "/opt/stack/nova/nova/exception.py", line 110, in wrapped
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions     payload)
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions 
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 204, in __exit__
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions     six.reraise(self.type_, self.value, self.tb)
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions 
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions   File "/opt/stack/nova/nova/exception.py", line 89, in wrapped
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions     return f(self, context, *args, **kw)
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions 
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions   File "/opt/stack/nova/nova/compute/manager.py", line 385, in decorated_function
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions     kwargs['instance'], e, sys.exc_info())
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions 
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 204, in __exit__
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions     six.reraise(self.type_, self.value, self.tb)
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions 
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions   File "/opt/stack/nova/nova/compute/manager.py", line 373, in decorated_function
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions     return function(self, context, *args, **kwargs)
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions 
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions   File "/opt/stack/nova/nova/compute/manager.py", line 4933, in attach_interface
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions     context, instance, port_id, network_id, requested_ip)
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions 
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions   File "/opt/stack/nova/nova/network/neutronv2/api.py", line 775, in allocate_port_for_instance
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions     requested_networks=requested_networks)
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions 
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions   File "/opt/stack/nova/nova/network/neutronv2/api.py", line 579, in allocate_for_instance
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions     objects.NetworkRequest(network_id=nets[0]['id']))
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions 
2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions IndexError: list index out of range

We should at least handle that case and report a 400 to the user.

** Affects: nova
     Importance: Undecided
         Status: New


** Tags: network neutron

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1545117

Title:
  neutron: 500 error when trying to attach no network to an instance
  with no network

Status in OpenStack Compute (nova):
  New

Bug description:
  It's possible to create a VM with nova using neutron as the backend
  and have no network information. If the tenant doesn't have any
  available network in neutron and doesn't request any network, the
  neutron backend will simply log a message and continue.

  If you then later attempt to use the os-attach-interface API and don't
  provider a network, and the tenant still doesn't have any networks
  available in neutron, then the request fails in the neutronv2 API code
  with an IndexError because it's assuming there is at least one
  available network:

  http://paste.openstack.org/show/486856/

  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions Traceback (most recent call last):
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions 
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions   File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 143, in _dispatch_and_reply
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions     executor_callback))
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions 
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions   File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 189, in _dispatch
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions     executor_callback)
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions 
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions   File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 130, in _do_dispatch
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions     result = func(ctxt, **new_args)
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions 
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions   File "/opt/stack/nova/nova/exception.py", line 110, in wrapped
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions     payload)
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions 
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 204, in __exit__
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions     six.reraise(self.type_, self.value, self.tb)
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions 
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions   File "/opt/stack/nova/nova/exception.py", line 89, in wrapped
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions     return f(self, context, *args, **kw)
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions 
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions   File "/opt/stack/nova/nova/compute/manager.py", line 385, in decorated_function
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions     kwargs['instance'], e, sys.exc_info())
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions 
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 204, in __exit__
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions     six.reraise(self.type_, self.value, self.tb)
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions 
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions   File "/opt/stack/nova/nova/compute/manager.py", line 373, in decorated_function
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions     return function(self, context, *args, **kwargs)
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions 
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions   File "/opt/stack/nova/nova/compute/manager.py", line 4933, in attach_interface
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions     context, instance, port_id, network_id, requested_ip)
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions 
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions   File "/opt/stack/nova/nova/network/neutronv2/api.py", line 775, in allocate_port_for_instance
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions     requested_networks=requested_networks)
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions 
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions   File "/opt/stack/nova/nova/network/neutronv2/api.py", line 579, in allocate_for_instance
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions     objects.NetworkRequest(network_id=nets[0]['id']))
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions 
  2016-02-12 09:34:32.188 TRACE nova.api.openstack.extensions IndexError: list index out of range

  We should at least handle that case and report a 400 to the user.

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


Follow ups