Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1064948 - RFE: libguestfs logging should be connected up to openstack logging
Summary: RFE: libguestfs logging should be connected up to openstack logging
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-nova
Version: 5.0 (RHEL 7)
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
: 6.0 (Juno)
Assignee: Matthew Booth
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2014-02-13 15:44 UTC by Richard W.M. Jones
Modified: 2016-04-18 06:47 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Last Closed: 2015-09-08 15:10:13 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Launchpad 1279857 None None None Never

Description Richard W.M. Jones 2014-02-13 15:44:16 UTC
Description of problem:

We were trying to chase up a bug in libguestfs integration with
OpenStack.  It was made much harder because the only way to diagnose
the bug was to manually run the nova service after manually setting
environment variables:

It would be much nicer if:

(1) There was a Nova setting to enable debugging, like:
      libguestfs_debug = 1
    or something along those lines.

(2) Nova used the events API to collect libguestfs debug messages
    and push them into Openstack's own logging system.  See code
    example below.

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

Current git version, and all versions AFAIK.


Here is how you enable logging programmatically and capture
the log messages.

(a) As soon as possible after creating the guestfs handle, call
either (or better, both) of these functions:

g.set_trace (1)         # just traces libguestfs API calls
g.set_verbose (1)       # verbose debugging

(b) Register an event handler like this:

events = guestfs.EVENT_APPLIANCE | guestfs.EVENT_LIBRARY \
         | guestfs.EVENT_WARNING | guestfs.EVENT_TRACE
g.set_event_callback (log_callback, events)

(c) The log_callback function should look something like this:

def log_callback (ev,eh,buf,array):
    if ev == guestfs.EVENT_APPLIANCE:
        buf = buf.rstrip()
    # What just happened?
    LOG.debug ("event=%s eh=%d buf='%s' array=%s" %
               (guestfs.event_to_string (ev), eh, buf, array))

There is a fully working example here:

Comment 5 Stephen Gordon 2015-09-08 15:10:13 UTC
Looks like this actually got done in Kilo.

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