Fix "Include error message in instance faults" to resolve more messages

Bug #1203880 reported by Mathew Odden
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Ben Nemec

Bug Description

The previous bug and fix for "Include error message in instance faults" (https://bugs.launchpad.net/nova/+bug/1013350) was merged and uses the exceptions kwargs['value'] to try to coerce a readable message out of an exception, but this only applies to very few exceptions.

We should be using unicode(exception) for the error message, as that is the recommended way of getting an error message from an exception (see http://docs.python.org/2/library/exceptions.html#exceptions.BaseException) since BaseException.args and .message are deprecated as of python 2.6

Example where resolving a message fails:

In the first example, IOError has no .kwargs or .message attributes, but unicode(exception) yields the message that is the first line in the 'details' item.

| fault | {u'message': u'IOError', u'code': 500, u'details': u'[Errno 28] No space left on device |
| | File "/opt/stack/nova/nova/compute/manager.py", line 228, in decorated_function |
| | return function(self, context, *args, **kwargs) |
| | File "/opt/stack/nova/nova/compute/manager.py", line 1668, in rebuild_instance |
| | block_device_info=block_device_info) |
| | File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 1527, in spawn |
| | admin_pass=admin_password) |
| | File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 1813, in _create_image |
| | project_id=instance[\'project_id\']) |
| | File "/opt/stack/nova/nova/virt/libvirt/imagebackend.py", line 156, in cache |
| | *args, **kwargs) |
| | File "/opt/stack/nova/nova/virt/libvirt/imagebackend.py", line 254, in create_image |
| | prepare_template(target=base, *args, **kwargs) |
| | File "/opt/stack/nova/nova/openstack/common/lockutils.py", line 232, in inner |
| | retval = f(*args, **kwargs) |
| | File "/opt/stack/nova/nova/virt/libvirt/imagebackend.py", line 144, in call_if_not_exists |
| | fetch_func(target=target, *args, **kwargs) |
| | File "/opt/stack/nova/nova/virt/libvirt/utils.py", line 601, in fetch_image |
| | images.fetch_to_raw(context, image_id, target, user_id, project_id) |
| | File "/opt/stack/nova/nova/virt/images.py", line 207, in fetch_to_raw |
| | fetch(context, image_href, path_tmp, user_id, project_id) |
| | File "/opt/stack/nova/nova/virt/images.py", line 202, in fetch |
| | image_service.download(context, image_id, image_file) |
| | File "/opt/stack/nova/nova/image/glance.py", line 284, in download |
| | data.write(chunk)

Ben Nemec (bnemec)
Changed in nova:
status: New → Confirmed
Revision history for this message
Ben Nemec (bnemec) wrote :

Relevant to this topic are the comments on https://review.openstack.org/#/c/28391/

Basically, the error information is available in the details field, but that's not supposed to be visible to end users. So if this error were to happen in a production environment, the user would see "500: IOError" and have no idea whether the problem is on their end or the provider's. That's rather unfriendly behavior IMHO, and it can be fixed as Matt suggests in the bug description above.

I had also suggested maybe we take the message out of the details field and only put the stack trace there to avoid duplication. That's probably a topic for when a fix gets proposed.

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/38401

Changed in nova:
assignee: nobody → Ben Nemec (bnemec)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/38401
Committed: http://github.com/openstack/nova/commit/b50d0995552322cfd18a1190d4bdb6de0b23ac4b
Submitter: Jenkins
Branch: master

commit b50d0995552322cfd18a1190d4bdb6de0b23ac4b
Author: Phong Ly <email address hidden>
Date: Thu May 16 01:21:42 2013 +0000

    Put fault message in the correct field

    Currently when adding an instance fault, the message field looks
    for kwargs['value'], which many exceptions do not have. This
    results in the message field being set to the name of the
    exception class, which in some cases is not useful (see the bug
    report for an example).

    This change puts the exception message in the message field, and
    removes it from the details field since there's no need to put it
    in both places. That leaves the details field for actual details,
    like stack traces.

    Fixes bug 1203880

    Change-Id: Ic92a9bd9cb2e139ce7a9f3f1299b7a6ccae82dd1

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → havana-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: havana-3 → 2013.2
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.