I didn't file a bug about this because it's not really clear what the
bug is. Anyway, here goes ...
$ virt-builder fedora-23 -o /dev/sdX
[ 2.3] Downloading:
http://libguestfs.org/download/builder/fedora-23.xz
[ 3.0] Planning how to build this image
[ 3.0] Uncompressing
[ 18.1] Resizing (using virt-resize) to expand the disk to 14.9G
virt-resize: error: libguestfs error: could not destroy libvirt
domain: Failed to terminate process 1275 with SIGTERM: Device or
resource busy [code=38 domain=0]
$ ps ax | grep qemu
1275 ? Dl 0:49 /usr/bin/qemu-system-x86_64 -machine accel=kvm [...]
What's actually happening here is that /dev/sdX is an incredibly
slow[1] USB key. The virt-resize operation completes successfully,
but qemu is blocked writing/fsyncing to the USB key, and takes a few
minutes to exit.
libvirt has a loop (src/util/virprocess.c:virProcessKillPainfully)
which waits 15 seconds [comment says 10 seconds], and this wait is not
configurable.
There seem to be several possible solutions, none of them very nice:
- Hard-code a longer wait in libvirt.
- Make the wait in libvirt configurable.
- If the process is in 'D' state, wait indefinitely.
I tried another workaround which was to get virt-resize to fsync the
output file before closing the libvirt connection, but that doesn't
work for reasons I don't understand so far - still studying this.
Rich.
[1] "Incredibly slow" ... but it's just a regular USB key, they are
all very slow!
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v