On Tue, May 17, 2016 at 03:35:09PM +0800, Fam Zheng wrote: > v5: - Change "lock-image=on/off" to "lock-mode=exclusive/shared/off". > Default is "lock-mode=exclusive" to exclusively lock RW images and > shared > lock RO images; with lock-mode="shared", RW images are shared locked > too; > lock-mode=off turns off image locking completely. > - Use F_OFD_SETLK fcntl so that close/dup on different fds are not a > problem. > - Update test cases.
My comments after testing this patch set: * It's not possible to tell from the `qemu -help' output that this binary supports the lock-mode option. Please add this to the -help output (under `-drive') so we can detect it in qemu. * I patched libguestfs to add the `lock-image=off' flag when the drive is added readonly. This permits libguestfs to read live guests. I also checked that writing to live guests is now forbidden, and it is, which is good. In the write-to-live-guest case libguestfs will now fail with: qemu-system-x86_64: -drive file=/var/tmp/centos-6.img,cache=writeback,id=hd0,if=none: Failed to lock image So definitely we need this option to be reflected in the -help output. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org