This is an experimental (not working) patch which would allow you to
set the user and group of the qemu process, assuming the main program
is running as root.
The reason for this is to allow access as root to disk images which
are located on "root-squashed" NFS volumes. This is a particular
concern for virt-v2v.
The most immediate problem with the patch (which can be fixed easily)
is that the non-root qemu cannot access the appliance:
qemu: could not load kernel '/tmp/libguestfsj2CItc/kernel': Permission denied
In terms of the bigger picture I'm not convinced that this patch is
really going to be useful. Firstly various commands currently try to
access the disk image from the main process (notably
guestfs_add_drive). Secondly any serious program using libguestfs
will want to touch the disk image elsewhere, so the root-squashing
problem will have to be tackled there too. It sounds as if for
virt-v2v the whole program should just setuid itself to a non-root
user as early as possible, rather than pushing this into libguestfs.
On the other hand, not running qemu as root even when libguestfs
itself is root, is an appealing idea if the permissions issues could
be resolved.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v