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

Richard W.M. Jones rjones at redhat.com
Tue Apr 9 14:33:19 UTC 2013


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'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.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list