500 Error when attaching an interface with the network that doesn't have any subnets

Bug #1584676 reported by Takashi Natsume
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Takashi Natsume

Bug Description

The nova-api returns 500 error when attaching an interface with the network that doesn't have any subnets.

[How to reproduce]
stack@devstack-master:~/nova$ openstack server list
+--------------------------------------+---------+--------+--------------------------------+
| ID | Name | Status | Networks |
+--------------------------------------+---------+--------+--------------------------------+
| 82e55546-3496-499b-82eb-7b819d0a5e8e | server1 | ACTIVE | public=10.0.2.197, 2001:db8::6 |
+--------------------------------------+---------+--------+--------------------------------+
stack@devstack-master:~/nova$ openstack network list
+--------------------------------------+---------+----------------------------------------------------------------------------+
| ID | Name | Subnets |
+--------------------------------------+---------+----------------------------------------------------------------------------+
| 7687f6d3-8ec7-4d47-863b-aab88f95d88b | private | 38025678-a6fc-4318-b8c9-4a4fe4c1acb9, fae11795-7253-4d58-a890-d9b1c74054e1 |
| 0f3c1a14-3c7c-4c8c-ae0e-ce7e38d01fde | public | 6fd1d52b-9762-4178-8424-07fe21473334, e921f73c-8606-4436-92f8-22eb5e518491 |
| 00ad2c69-2796-4c01-b578-e48842854274 | net1 | |
+--------------------------------------+---------+----------------------------------------------------------------------------+
stack@devstack-master:~/nova$ nova interface-attach --net-id 00ad2c69-2796-4c01-b578-e48842854274 server1
ERROR (ClientException): Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
<class 'SecurityGroupCannotBeApplied_Remote'> (HTTP 500) (Request-ID: req-8a3d18c2-ef33-4174-beab-e45057071353)

[log]
nova-comupte.log

2016-05-23 18:41:54.285 ERROR oslo_messaging.rpc.server [req-8a3d18c2-ef33-4174-beab-e45057071353 admin admin] Exception during handling message
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server Traceback (most recent call last):
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/server.py", line 133, in _process_incoming
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server res = self.dispatcher.dispatch(message)
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 153, in dispatch
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server return self._do_dispatch(endpoint, method, ctxt, args)
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 122, in _do_dispatch
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server result = func(ctxt, **new_args)
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server File "/opt/stack/nova/nova/exception.py", line 110, in wrapped
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server payload)
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 221, in __exit__
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server self.force_reraise()
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 197, in force_reraise
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server six.reraise(self.type_, self.value, self.tb)
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server File "/opt/stack/nova/nova/exception.py", line 89, in wrapped
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server return f(self, context, *args, **kw)
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server File "/opt/stack/nova/nova/compute/manager.py", line 210, in decorated_function
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server kwargs['instance'], e, sys.exc_info())
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 221, in __exit__
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server self.force_reraise()
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 197, in force_reraise
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server six.reraise(self.type_, self.value, self.tb)
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server File "/opt/stack/nova/nova/compute/manager.py", line 198, in decorated_function
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server return function(self, context, *args, **kwargs)
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server File "/opt/stack/nova/nova/compute/manager.py", line 4864, in attach_interface
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server bind_host_id=bind_host_id)
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server File "/opt/stack/nova/nova/network/neutronv2/api.py", line 845, in allocate_port_for_instance
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server bind_host_id=bind_host_id)
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server File "/opt/stack/nova/nova/network/neutronv2/api.py", line 600, in allocate_for_instance
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server raise exception.SecurityGroupCannotBeApplied()
2016-05-23 18:41:54.285 TRACE oslo_messaging.rpc.server SecurityGroupCannotBeApplied: Network requires port_security_enabled and subnet associated in order to apply security groups.

[Environment]
OS: Ubuntu 14.04 LTS(64bit)
nova: master (commit 2505c5d8b1d9c075e20275ee903657640cc97c92)
with neutron

Tags: api
Changed in nova:
assignee: nobody → Takashi NATSUME (natsume-takashi)
Changed in nova:
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

Changed in nova:
status: Confirmed → In Progress
tags: added: api
Changed in nova:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/323332
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=dba6713e83967be513b5b2bfc39408f15c0d0fe6
Submitter: Jenkins
Branch: master

commit dba6713e83967be513b5b2bfc39408f15c0d0fe6
Author: Takashi NATSUME <email address hidden>
Date: Tue May 31 21:08:35 2016 +0900

    Return 400 when SecurityGroupCannotBeApplied is raised

    Return 400 when SecurityGroupCannotBeApplied is raised
    in attaching an interface to a VM instance.

    Change-Id: I6cc0e2b43b82dc3b16a581b1f8ec75b35995934e
    Closes-Bug: #1584676

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 14.0.0.0b3

This issue was fixed in the openstack/nova 14.0.0.0b3 development milestone.

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.