Attach public network return 500

Bug #1720726 reported by hongbin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
hongbin
Ocata
Fix Committed
Medium
Sam Yaple
Pike
Fix Committed
Medium
Sam Yaple

Bug Description

Description
===========
If policy allow attaching external network, Attach a 'public' network return 500.

Steps to reproduce
==================
1. Run devstack with default configuration.
2. Add policy.json to allow attaching external network.
3. Source demo credential
4. Create an instance and wait for the instance to become active.
5. Attach the instance with the 'public' network.

$ nova interface-attach --net-id 2b7e8a86-c5c6-4396-84bc-14cdc741e033 test
ERROR (ClientException): Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
<type 'exceptions.TypeError'> (HTTP 500) (Request-ID: req-3e353c62-a356-4d7d-bd73-28cf4406e447)

Expected result
===============
Nova should return 4xx response

Actual result
=============
Nova returned 500 response

Environment
===========
Devstack with master

Logs & Configs
==============
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server [None req-3e125907-0419-418a-a03c-154b99e97610 demo demo] Exception during message handling: TypeError: <class 'neutronclient.common.exceptions.Forbidden'> can't be encoded
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server Traceback (most recent call last):
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/server.py", line 160, in _process_incoming
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server res = self.dispatcher.dispatch(message)
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 222, in dispatch
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server return self._do_dispatch(endpoint, method, ctxt, args)
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 192, in _do_dispatch
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server result = func(ctxt, **new_args)
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server File "/opt/stack/nova/nova/exception_wrapper.py", line 76, in wrapped
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server function_name, call_dict, binary)
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server self.force_reraise()
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server six.reraise(self.type_, self.value, self.tb)
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server File "/opt/stack/nova/nova/exception_wrapper.py", line 67, in wrapped
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server return f(self, context, *args, **kw)
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server File "/opt/stack/nova/nova/compute/manager.py", line 217, in decorated_function
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server kwargs['instance'], e, sys.exc_info())
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server File "/opt/stack/nova/nova/compute/utils.py", line 99, in add_instance_fault_from_exc
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server fault_obj.update(exception_to_dict(fault, message=fault_message))
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server File "/opt/stack/nova/nova/compute/utils.py", line 76, in exception_to_dict
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server u_message = utils.safe_truncate(message, 255)
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server File "/opt/stack/nova/nova/utils.py", line 1193, in safe_truncate
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server b_value = encodeutils.safe_encode(value)[:length]
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server File "/usr/local/lib/python2.7/dist-packages/oslo_utils/encodeutils.py", line 85, in safe_encode
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server raise TypeError("%s can't be encoded" % type(text))
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server TypeError: <class 'neutronclient.common.exceptions.Forbidden'> can't be encoded
Oct 02 04:39:13 testzun nova-compute[24239]: ERROR oslo_messaging.rpc.server
Oct 02 04:39:13 testzun <email address hidden>[24253]: ERROR nova.api.openstack.extensions [None req-3e125907-0419-418a-a03c-154b99e97610 demo demo] Unexpected exception in API method: TypeError: <class 'neutronclient.common.exceptions.Forbidden'> can't be encoded

Tags: api
hongbin (hongbin034)
Changed in nova:
assignee: nobody → hongbin (hongbin034)
Changed in nova:
status: New → In Progress
tags: added: api
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/508802
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=f1a0557da4fbd7baa9196cb5c0ccdd7ebb16ecdf
Submitter: Zuul
Branch: master

commit f1a0557da4fbd7baa9196cb5c0ccdd7ebb16ecdf
Author: Hongbin Lu <email address hidden>
Date: Mon Oct 2 04:21:26 2017 +0000

    Fix wrapping of neutron forbidden error

    In neutronv2 api, the neutron forbidden error is not wrapped
    correctly. The exception class expects the first parameter as
    the error message but an exception object is passed.

    Closes-Bug: #1720726
    Change-Id: I6e88333427ec2befe2122274b02775f013404e30

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

This issue was fixed in the openstack/nova 17.0.0.0b2 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/pike)

Fix proposed to branch: stable/pike
Review: https://review.openstack.org/560087

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/ocata)

Fix proposed to branch: stable/ocata
Review: https://review.openstack.org/560088

Matt Riedemann (mriedem)
Changed in nova:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/pike)

Reviewed: https://review.openstack.org/560087
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=837ac8c1d651c58f5ebd5a20b409594f7368819d
Submitter: Zuul
Branch: stable/pike

commit 837ac8c1d651c58f5ebd5a20b409594f7368819d
Author: Hongbin Lu <email address hidden>
Date: Mon Oct 2 04:21:26 2017 +0000

    Fix wrapping of neutron forbidden error

    In neutronv2 api, the neutron forbidden error is not wrapped
    correctly. The exception class expects the first parameter as
    the error message but an exception object is passed.

    Closes-Bug: #1720726
    Change-Id: I6e88333427ec2befe2122274b02775f013404e30
    (cherry picked from commit f1a0557da4fbd7baa9196cb5c0ccdd7ebb16ecdf)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/ocata)

Reviewed: https://review.openstack.org/560088
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=5c43e76ce02d4f4b4e5204070fe1f5f0784d0513
Submitter: Zuul
Branch: stable/ocata

commit 5c43e76ce02d4f4b4e5204070fe1f5f0784d0513
Author: Hongbin Lu <email address hidden>
Date: Mon Oct 2 04:21:26 2017 +0000

    Fix wrapping of neutron forbidden error

    In neutronv2 api, the neutron forbidden error is not wrapped
    correctly. The exception class expects the first parameter as
    the error message but an exception object is passed.

    Closes-Bug: #1720726
    Change-Id: I6e88333427ec2befe2122274b02775f013404e30
    (cherry picked from commit f1a0557da4fbd7baa9196cb5c0ccdd7ebb16ecdf)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 16.1.2

This issue was fixed in the openstack/nova 16.1.2 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 15.1.1

This issue was fixed in the openstack/nova 15.1.1 release.

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.