Bug 1613946 - RFE: Enhanced Python error reporting
Summary: RFE: Enhanced Python error reporting
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: nbdkit
Version: 7.6
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard: V2V
: 1614187 (view as bug list)
Depends On: 1557273
Blocks: 1647740
TreeView+ depends on / blocked
 
Reported: 2018-08-08 15:32 UTC by Richard W.M. Jones
Modified: 2019-08-06 12:02 UTC (History)
8 users (show)

Fixed In Version: nbdkit-1.2.6-1.el7.2
Doc Type: Enhancement
Doc Text:
The Python plug-in for the nbdkit tool suite has been enhanced to print full stack traces when errors occur in Python scripts. As a result, certain error messages that can be generated when converting a virtual machine to Red Hat Virtualization using the virt-v2v utility now provide significantly more information.
Clone Of:
: 1614750 1647740 (view as bug list)
Environment:
Last Closed: 2019-08-06 12:02:10 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:2015 0 None None None 2019-08-06 12:02:17 UTC

Description Richard W.M. Jones 2018-08-08 15:32:36 UTC
Description of problem:

virt-v2v use nbdkit's Python plugin to write to RHV (bug 1557273).
We do this to allow us to use the Python API to RHV.  However when
a Python call fails we don't always print the full stack trace.

I added support for doing this to nbdkit today:

https://github.com/libguestfs/nbdkit/commit/72c0d64a47db642cafa89884f2ee554bd0b8e822

and we should support this in RHEL 7 too.

Version-Release number of selected component (if applicable):

nbdkit-1.2.4-4.el7.x86_64

How reproducible:

100%

Steps to Reproduce:
1. See comment below.

Comment 3 Richard W.M. Jones 2018-08-08 15:41:33 UTC
Reproducer:

(1) Create a file called 'test.py' containing:

def function():
    raise RuntimeError("error")
def config(key, value):
    function()
def open(readonly):
    raise RuntimeError("open")
def get_size(h):
    raise RuntimeError("get_size")
def pread(h, count, offset):
    raise RuntimeError("pread")


(2) Run this command:

  $ nbdkit -fv python ./test.py foo=bar


When the RFE has not been implemented you will see only this:

  nbdkit: error: ./test.py: config: error: error

With the RFE implemented you will see a full traceback:

  nbdkit: error: ./test.py: config: error: ['Traceback (most recent call last):\n', '  File "./test.py", line 4, in config\n    function()\n', '  File "./test.py", line 2, in function\n    raise RuntimeError("error")\n', 'RuntimeError: error\n']

Comment 4 Mor 2018-08-09 07:33:05 UTC
*** Bug 1614187 has been marked as a duplicate of this bug. ***

Comment 5 Richard W.M. Jones 2018-08-10 10:45:24 UTC
Requesting exception for RHEL 7.6.  It's a small change and easily
tested, and it will greatly improve the logs/errors collected from
customer machines deploying IMS 1.0.

Comment 9 mxie@redhat.com 2019-04-15 09:20:54 UTC
Verify the bug with builds:
nbdkit-plugin-python-common-1.8.0-1.el7.x86_64
nbdkit-plugin-python2-1.8.0-1.el7.x86_64
nbdkit-1.8.0-1.el7.x86_64
nbdkit-plugin-vddk-1.8.0-1.el7.x86_64

Steps:
1.Create a file called 'test.py' with below content:

$ cat test.py 
def function():
    raise RuntimeError("error")
def config(key, value):
    function()
def open(readonly):
    raise RuntimeError("open")
def get_size(h):
    raise RuntimeError("get_size")
def pread(h, count, offset):
    raise RuntimeError("pread")

2.Run command:
$ nbdkit -fv python2 ./test.py foo=bar
nbdkit: debug: TLS disabled: could not load TLS certificates
nbdkit: debug: registering plugin /usr/lib64/nbdkit/plugins/nbdkit-python2-plugin.so
nbdkit: debug: registered plugin /usr/lib64/nbdkit/plugins/nbdkit-python2-plugin.so (name python)
nbdkit: debug: python: load
nbdkit: debug: python: config key=script, value=./test.py
nbdkit: debug: python: config key=foo, value=bar
nbdkit: error: ./test.py: config: error: ['Traceback (most recent call last):\n', '  File "./test.py", line 4, in config\n    function()\n', '  File "./test.py", line 2, in function\n    raise RuntimeError("error")\n', 'RuntimeError: error\n']

Result:
   nbdkit can get full traceback when a Python call fails, so move the bug from ON_QA to VERIFIED

Comment 11 errata-xmlrpc 2019-08-06 12:02:10 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:2015


Note You need to log in before you can comment on or make changes to this bug.