[For a bug noted earlier by both Matt Booth and Jim Meyering]
If you use the guestfs_add_drive function, then currently it
generates a qemu command line element like:
-drive ...,cache=off,...
This causes qemu to try to open the device with O_DIRECT.
Unfortunately some filesystems don't support this flag, notably tmpfs,
which means you can't use libguestfs in conjunction with tmpfs. On
some systems /tmp is a tmpfs filesystem.
This patch fixes this so that if the filesystem doesn't support
O_DIRECT, then we omit the cache=off parameter. This seems reasonable
from a reliability point of view, because if you're using tmpfs then
you probably didn't expect reliability in the case where your system
suddenly powers off.
Tested using a tmpfs. Without:
$ guestfish alloc /mnt/tmp/test.img 10M : run
qemu: could not open disk image /mnt/tmp/test.img
libguestfs: error: connect: Connection refused
libguestfs: error: connect: Connection refused
libguestfs: error: connect: Connection refused
libguestfs: error: connect: Connection refused
With:
$ ./fish/guestfish
Welcome to guestfish, the libguestfs filesystem interactive shell for
editing virtual machine filesystems.
Type: 'help' for help with commands
'quit' to quit the shell
<fs> alloc /mnt/tmp/test.img 10M
<fs> run
<fs>
Rich.
--
Richard Jones, Emerging Technologies, Red Hat
http://et.redhat.com/~rjones
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages.
http://et.redhat.com/~rjones/libguestfs/
See what it can do:
http://et.redhat.com/~rjones/libguestfs/recipes.html