With Ubuntu's 10.04 stock kernel (2.6.32-22-generic), libvirt functions normally. However, after changing only the kernel version to 2.6.34-020634-generic from Ubuntu's mainline PPA (http://kernel.ubuntu.com/~kernel-ppa/mainline/) all VM's started through libvirt fail to write to their disk images unless the image is owned by root. Rebooting to the older kernel resolves the issue, as does making root the owner of the disk images. I would have set the severity on this to Low, as there is a workaround. However, the workaround creates more of a problem as making root the owner of the disk images creates more problems for anything else needing access to the disk images.
Jamin, Please file this report in Ubuntu's bug tracker, as it is not an upstream kernel issue.
I'd already asked on the Ubuntu kernel team's IRC channel where the bug report should be filed. They indicated that the mainline PPA kernels are only packaged versions of the kernel.org source and that the report should be filed here. From http://irclogs.ubuntu.com/2010/06/29/%23ubuntu-kernel.txt: [22:22] <jaminc> is there a place to report bugs found in kernels from the mainline-ppa? [22:24] <jjohansen> jaminc: https://bugzilla.kernel.org/ [22:26] <jaminc> guess I'm a bit confused, are the mainline builds essentially just the kernel.org versions? [22:27] <jjohansen> yes [22:27] <jjohansen> just built into a deb for testing
Please strace qemu and show how the writes are failing. Note, this is unlikely to be a kvm problem. kvm doesn't read or write files.
The problem only happens when the VM is started via libvirt with a newer (mainline) kernel. The log entry provided is simply "Write failed". If I call kvm directly (without libvirt) and specify the same VM disk image, both newer (mainline) and older kernel versions work fine regardless of which user owns the disk image files. I'm open to suggestions on how to get the trace you're after when starting the VM from libvirt.
Move qemu somewhere else, replace by a script that straces it into some file.
Created attachment 27047 [details] strace of unwritable VM startup I believe I've managed to get the trace you wanted. Changing the ownership on the winxp.qcow2 file to root fixes the problem.
open("/opt/vms/winxp.qcow2", O_RDWR|O_SYNC|O_CLOEXEC) = -1 EACCES (Permission denied) open("/opt/vms/winxp.qcow2", O_RDONLY|O_SYNC|O_CLOEXEC) = 8 Obviously, qemu can't open the file due to permissions problems. Please report this as a libvirt bug (but check first for user error).
I'm more than a bit lost as to how this is a libvirt issue when it's caused and fixed by changing only the kernel version. Additionally, the process attempting to access the file is running as root, I've verified this by gathering additional information in the tracing shell script replacement for qemu-system-x86_64 that gathered the provided trace. In short, the very same libvirt binaries and libraries work fine with Ubuntu's 2.6.32-23-generic kernel, but not with 2.6.34-020634-generic unless the disk images are owned by root.
Please ask the libvirt people for help. It may be a security module/libvirt interaction issue. It is NOT a kvm issue. Do NOT reopen this bug, at least not under the kvm component. Thanks.