Red Hat Bugzilla – Bug 673477
Add a grep-friendly string to LIBGUESTFS_TRACE output
Last modified: 2015-09-27 22:23:27 EDT
When debugging virt-v2v problems, the most useful debug information is normally LIBGUESTFS_TRACE. Occasionally LIBGUESTFS_DEBUG is also useful, but less often. However, it is a problem when these 2 outputs are mixed. DEBUG is significantly more verbose than TRACE (about 100:1 iirc), and it is not trivial to separate their outputs. It would greatly simplify debugging instructions to users if we could simply request both outputs. The result should: * Be simple to view mixed, chronologically * Be simple to separate Adding a grep-friendly string to TRACE and/or DEBUG output would achieve this. It doesn't really matter what the string(s) is/are.
To test this: $ guestfish -x -N fs exit is_config = 1 add_drive "test1.img" = 0 is_config = 1 launch = 0 part_disk "/dev/sda" "mbr" = 0 mkfs "ext2" "/dev/sda1" = 0 umount_all = 0 sync = 0 kill_subprocess = 0 Notice that each trace line just has the command. When we patch libguestfs, we will add some (undecided) prefix to each line, so in the output above each line would have a prefix. Also note that 'guestfish -x -N fs exit' won't work at all in the RHEL 6.0 libguestfs.
This is the output when patched: $ guestfish -x -N fs exit libguestfs: trace: is_config = 1 libguestfs: trace: add_drive "test1.img" = 0 libguestfs: trace: is_config = 1 libguestfs: trace: launch = 0 libguestfs: trace: part_disk "/dev/sda" "mbr" = 0 libguestfs: trace: mkfs "ext2" "/dev/sda1" = 0 libguestfs: trace: umount_all = 0 libguestfs: trace: sync = 0 libguestfs: trace: kill_subprocess = 0
Ignore comment 2. The final patch upstream makes the output look like this which each call having a call and return value on separate lines: libguestfs: trace: is_config libguestfs: trace: is_config = 1 libguestfs: trace: add_drive "test1.img" libguestfs: trace: add_drive = 0 libguestfs: trace: is_config libguestfs: trace: is_config = 1 libguestfs: trace: launch libguestfs: trace: launch = 0 libguestfs: trace: part_disk "/dev/sda" "mbr" libguestfs: trace: part_disk = 0 etc.
https://brewweb.devel.redhat.com/buildinfo?buildID=155740
Note to self: The following patches are required to fully fix this: (1) http://git.annexia.org/?p=libguestfs.git;a=commitdiff;h=1d999540bddd7aea7c2d0fef8b15223d4acc645f Add a prefix to output when tracing (RHBZ#673479). (2) http://git.annexia.org/?p=libguestfs.git;a=commitdiff;h=b6c70b3f50472e20a33320e7d76887b011f33c64 Fix test-guestfish-a.sh regression test for new trace format. (3) http://git.annexia.org/?p=libguestfs.git;a=commitdiff;h=f2a4020caf0bc3dd63e9eae95dfc1814f051f87e regressions: Fix rhbz557655.sh so it works with tracing enabled. Unfortunately we screwed up and only (1) and (2) are applied to the RHEL 6.1 package. I'm not going to rebuild this again now, so (3) will need to be added in RHEL 6.2.
Test with libguestfs-1.7.17-10.el6: # guestfish -x -N fs exit is_config = 1 add_drive "test1.img" = 0 is_config = 1 launch = 0 part_disk "/dev/sda" "mbr" = 0 mkfs "ext2" "/dev/sda1" = 0 umount_all = 0 sync = 0 kill_subprocess = 0 with libguestfs-1.7.17-12.el6: # guestfish -x -N fs exit libguestfs: trace: is_config libguestfs: trace: is_config = 1 libguestfs: trace: add_drive "test1.img" libguestfs: trace: add_drive = 0 libguestfs: trace: is_config libguestfs: trace: is_config = 1 libguestfs: trace: launch libguestfs: trace: launch = 0 libguestfs: trace: part_disk "/dev/sda" "mbr" libguestfs: trace: part_disk = 0 ... So move to VERIFIED.
Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: Separating libguestfs trace output from debug output was difficult. A string (libguestfs: trace:) is now added to the beginning of each line of the trace output so that it can be easily distinguished and filtered out of logs with the grep command or similar.
This is fine, thanks.
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHSA-2011-0586.html