F12, libvirt 0.7.1-15, qemu 0.11.0-12, 32 bit
I recently discovered that libvirt is stealing ownership of my disk images. How can I make
it stop?
I have a disk image in my home directory, owned by matt. When I create a domain that uses
the disk it gets chowned to qemu.qemu. When the domain terminates it is owned by
root.root. I've lost access to the file.
It has been suggested that the user->qemu happens to make sure that the qemu account
can read/write the file. chmod'ing would be far better and avoid this problem. It
appears that libvirt just assumes the disk image was owned by root before being
chown'd to qemu.
Another problem with this is qcow disks. If chown'ing to qemu is to ensure that qemu
has access to all the disks needed for the domain, it fails for qcow, because the base
disk is not chown'd as well. This can result in a very cryptic error message (funny
period (.)):
monitor socket did not show up.: No such file or directory
For instance, base.img is owned by matt (u=rw,go=), a qcow disk qcow.img is linked to
base.img. When a domain using qcow.img is created qcow.img is owned to qemu, but base.img
is not.
Instead of chown'ing, will libvirt provide an error that could cover both these
situations? The virt-manager GUI (or virsh TUI) could interpret that error and chmod the
proper files transparently, or preemptively chmod the required files. Users of the libvirt
API would have to make sure things are setup properly at first and would not have to worry
about side-effect changes made by libvirtd.
I think the suggestion holds even if is only the qemu driver doing the chown.
Best,
matt