[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [Qemu-devel] debugging qemu-nbd.c



On Tue, Apr 09, 2013 at 10:41:47AM -0400, Skippy VonDrake wrote:
> On Tue, Apr 9, 2013 at 10:33 AM, Richard W.M. Jones <rjones redhat com> wrote:
> > On Tue, Apr 09, 2013 at 10:18:50AM -0400, Skippy VonDrake wrote:
> >> Hello,
> >>
> >> Apologies upfront if posting to this list is inappropriate.
> >>
> >> I have an app that forks a process with calls qemu-nbd with an offset
> >> into an image.
> >> The app then uses libguestfs to attach the nbd device.
> >> But it appears that qemu is failing.
> >
> > When you say "qemu is failing", do you mean qemu-nbd, or the qemu
> > subprocess that libguestfs uses?  Does it print any error?
> 
> I believe it is the qemu subprocess that libguestfs is using.
> I'm basing that assumption on the log file statements from both libguestfs
> and qemu, and from stderr from libguestfs.
> 
> The only stderr from libguestfs is "child_cleanup:... child process died"

Enable debugging in libguestfs to find out what's going on:

http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs

> >> I'm using the latest qemu sources and placed file log statements within
> >> qemu-nbd.c to pinpoint the problem.
> >>
> >> The statement: " if (chdir("/") < 0)"
> >> appears to be the culprit.
> >>
> >> But the subsequent err() call is never reached. If I pull 'chdir' out of
> >> the 'IF' and assign a local var to its return - execution still seems to
> >> stop on the 'chdir'. So there is no opportunity to examine its return.
> >>
> >> What is the best approach to debugging this section of code?
> >
> > As a first step I would just add 'fprintf (stderr, ...)' straight into
> > the qemu-nbd.c file.  Or run it under gdb.
> 
> I haven't tried this with gdb yet but the log statements I described
> above were in the qemu-nbd.c file. And are successfully written
> up until the chdir command.
> 
> I'll try attaching gdb...

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]