On Mon, Dec 07, 2009 at 10:31:28AM +0000, Jamie Lokier wrote: > Anthony Liguori wrote: > > I'm not sure whether it's best to enable it by default because, as I > > said earlier, I'm not comfortable with the lack of correctness wrt > > advisory vs. mandatory locking. > > In my experience, disk images are accessed in one of five ways: > > qemu-img > qemu > qemu-nbd > mount -o loop > cp/rsync > > If all but the last implement qemu's advisory locking, that's comforting.
It's not directly relevant to what you said above, but I'd just like to interject my use case: We'd like to prevent libguestfs from corrupting disk images. If libguestfs is accessing a disk image read-only, then we would not acquire any lock (ie. lock=none). This gives reasonable results, enough to grab a file or do 'virt-df' even against a running guest, in all but the most pathological circumstances. The only danger is that libguestfs gets an error -- it can't corrupt the disk image of the running VM. If libguestfs is accessing a disk image read-write, then we would try to acquire lock=exclusive. At the same time, libvirt would be modified so it sets lock=exclusive on all disk images, so libguestfs would fail to acquire the lock when trying to write to a disk image that is in use, and this would prevent disk corruption. 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