Thanks Rich.
I have used libguestfs for several month. It worked perfectly before, the issue appears recently. I am trying guestfs_set_backend (g, "direct").

Thanks,
Allen

2016-08-29 23:31 GMT+08:00 Richard W.M. Jones <rjones@redhat.com>:
On Mon, Aug 29, 2016 at 11:19:04PM +0800, Baochuan Wu wrote:
> Thanks Rich for you quick reply. I enabled logs and the program stuck
> again, here is the call stack and log:
> Thread 1 (Thread 0x7fac58edc8c0 (LWP 1271)):
> #0  0x00007fac578fac20 in __poll_nocancel () from /lib64/libc.so.6
> #1  0x00007fac56df3c5a in virNetClientIOEventLoop () from
> /lib64/libvirt.so.0
> #2  0x00007fac56df441b in virNetClientSendInternal () from
> /lib64/libvirt.so.0
> #3  0x00007fac56df5843 in virNetClientSendWithReply () from
> /lib64/libvirt.so.0
> #4  0x00007fac56df6052 in virNetClientProgramCall () from
> /lib64/libvirt.so.0
> #5  0x00007fac56dcbfe2 in callFull.isra.2 () from /lib64/libvirt.so.0
> #6  0x00007fac56de213d in remoteDomainCreateXML () from /lib64/libvirt.so.0
> #7  0x00007fac56d82151 in virDomainCreateXML () from /lib64/libvirt.so.0
> #8  0x00007fac58acca50 in launch_libvirt () from /lib64/libguestfs.so.0
> #9  0x00007fac58ac2b2b in guestfs_impl_launch () from /lib64/libguestfs.so.0
> #10 0x00007fac58a5eba5 in guestfs_launch () from /lib64/libguestfs.so.0
> #11 0x00000000004117ca in main ()
...
> libguestfs: [62900ms] launch libvirt guest

The error is happening in libvirt's virDomainCreateXML call, called
from libguestfs here:

https://github.com/libguestfs/libguestfs/blob/master/src/launch-libvirt.c#L600

Unfortunately libvirt isn't a simple C library.  It will launch and
talk to a daemon (usually ``libvirt --timeout=30'' process, if you are
not running as root).  Debugging into libvirtd is described here:

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

A workaround is to set LIBGUESTFS_BACKEND=direct [or use the
equivalent call ``guestfs_set_backend (g, "direct")''] which will
cause libguestfs to run qemu directly instead of going through
libvirt.

http://libguestfs.org/guestfs.3.html#backend

Rich.

--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
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/