← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1279857] [NEW] RFE: libguestfs logging should be connected up to openstack logging

 

Public bug reported:

https://bugzilla.redhat.com/show_bug.cgi?id=1064948

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:
http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs

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.

---------

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:

https://github.com/libguestfs/libguestfs/blob/master/python/t/420-log-
messages.py

** Affects: nova
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1279857

Title:
  RFE: libguestfs logging should be connected up to openstack logging

Status in OpenStack Compute (Nova):
  New

Bug description:
  https://bugzilla.redhat.com/show_bug.cgi?id=1064948

  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:
  http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs

  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.

  ---------

  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:

  https://github.com/libguestfs/libguestfs/blob/master/python/t/420-log-
  messages.py

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1279857/+subscriptions


Follow ups

References