RFE: libguestfs logging should be connected up to openstack logging

Bug #1279857 reported by Richard Jones
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Wishlist
Sahid Orentino

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

Tags: compute
Changed in nova:
importance: Undecided → Wishlist
Tracy Jones (tjones-i)
tags: added: compute
Changed in nova:
status: New → Triaged
Changed in nova:
assignee: nobody → sahid (sahid-ferdjaoui)
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/124700

Changed in nova:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/124700
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=a2f843e0c6cd315f7e130661cc1d0b4b959cbc54
Submitter: Jenkins
Branch: master

commit a2f843e0c6cd315f7e130661cc1d0b4b959cbc54
Author: Sahid Orentino Ferdjaoui <email address hidden>
Date: Mon Sep 29 05:49:15 2014 -0400

    vfs: guestfs logging integration

    Adds support to enable guestfs logging.

    Change-Id: I46c5ec6606e4a2eb8277b081d0c773ceb6d36c4c
    DocImpact: New group of option has been introduced "guestfs"
    Closes-Bug: #1279857

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