On Thu, Apr 04, 2013 at 10:48:54AM -0400, Skippy VonDrake wrote:
 I'm using qemu-nbd to setup the device with an offset
 into the image. Using libguestfs version 1.21.22
 Code for adding the drive:
   char *server[] = { "localhost:3000", NULL };
   if (guestfs_add_drive_opts (g, "" /* export name - see below */,
      GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw",
      GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "nbd",
      GUESTFS_ADD_DRIVE_OPTS_SERVER, server,
      -1) 
Glad someone is trying it!
 Here is some of the stdout. A mix of libguestfs and
 qemu-nbd messages.
 
 	\ libguestfs: child_cleanup: 0xbc4ba0: child process died
 	libguestfs: sending SIGTERM to process 23981 
[...]
Are you sure that qemu itself isn't crashing?
I've only tested this on qemu 1.4.0.
 	/build/buildd/qemu-kvm-1.2.0+noroms/nbd.c:nbd_trip():L836:
requested
 operation past EOF--bad client?
 	/build/buildd/qemu-kvm-1.2.0+noroms/nbd.c:nbd_receive_request():L516:
 read failed
 
 So I peppered some fprintfs in launch-appliance.c to try and narrow
 down the problem. Just below the comment:
    * does not mean the daemon is up until we read the
    * GUESTFS_LAUNCH_FLAG below.  Failures in qemu startup can still
 Is the call where it fails:
   r = guestfs___recv_from_daemon (g, &size, &buf);
 r is -1 and size is zero 
This would indicate that qemu is exiting or crashing early.
 How can I debug this problem further?
 I suppose I could build/debug the qemu side of this process... 
If qemu is crashing then enabling core dumps might be a good idea, ie:
  ulimit -c unlimited
But even if you get a coredump, no one in qemu-land will care since
1.2.0 is an old version.  You could try a locally compiled copy of
qemu from git:
  
http://libguestfs.org/guestfs.3.html#qemu-wrappers
Rich.
-- 
Richard Jones, Virtualization Group, Red Hat 
http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top