docs: Add documentation for image locking
cover docs: Add documentation for image locking
Image locking feature was added in 2.10 but the documentation has been missing. Users sometimes get confused and wonder how to configure it for their specific needs. We should address common use cases in the man page and explain related options.
Fam Zheng (2):
docs: Add image locking subsection
qemu-options: Mention locking option of file driver
docs/qemu-block-drivers.texi | 36 ++++++++++++++++++++++++++++++++++++ qemu-doc.texi | 1 + qemu-options.hx | 3 +++ 3 files changed, 40 insertions(+)
Signature · 1 line
2.14.3
PATCH 1/2 docs: Add image locking subsection
This documents the image locking feature and explains when and how related options can be used.
--- docs/qemu-block-drivers.texi | 36 ++++++++++++++++++++++++++++++++++++ qemu-doc.texi | 1 + 2 files changed, 37 insertions(+)
docs/qemu-block-drivers.texi +36 -0
@@ -785,6 +785,42 @@ warning: ssh server @code{ssh.example.com:22} does not support fsync With sufficiently new versions of libssh2 and OpenSSH, @code{fsync} is supported. +@node disk_image_locking +@subsection Disk image file locking + +By default, QEMU tries to protect image files from unexpected concurrent +access, as long as it's supported by the block protocol driver and host +operating system. If multiple QEMU processes (including QEMU emulators and +utilities) try to open the same image with conflicting accessing modes, all but +the first one will get an error. + +This feature is currently supported by the file protocol on Linux with Open +File Descriptor (OFD) locking API, and can be configured to fall back to POSIX +locking if the POSIX host doesn't support Linux OFD locking. + +To explicitly enable image locking, specify "locking=on" in the file protocol +driver options. If OFD locking is not possible, a warning will be printed and +the POSIX locking API will be used. In this case there is risk that the lock +will get silently lost when doing hot plugging and block jobs, due to the +shortcomings of the POSIX locking API. + +QEMU transparently handles lock handover during shared storage migration. For +shared virtual disk images between multiple VMs, the "share-rw" device option +should be used. + +Alternatively, locking can be fully disabled by "locking=off" block device +option. In the command line the option is usually in the form of +"file.locking=off" as the protocol driver is normally placed as a "file" child +under a format driver. For example: + +@code{-blockdev driver=qcow2,file.filename=/path/to/image,file.locking=off,file.driver=file} + +To check if image locking is active, check the output of "lslocks" command on +host and see if there are locks held by QEMU process on the image file. More +than one bytes could be locked by a QEMU instance, each byte of which reflects +a perticular permission that are acquired or protected by the running block +driver. + @c man end @ignore
qemu-doc.texi +1 -0
@@ -405,6 +405,7 @@ encrypted disk images. * disk_images_iscsi:: iSCSI LUNs * disk_images_gluster:: GlusterFS disk images * disk_images_ssh:: Secure Shell (ssh) disk images +* disk_image_locking:: Disk image file locking @end menu @node disk_images_quickstart
Signature · 1 line
2.14.3
Re: [Qemu-devel] [PATCH 1/2] docs: Add image locking subsection
Hello,
Am 23.11.2017 um 14:59 schrieb Fam Zheng:
Quoted 5 lines
docs/qemu-block-drivers.texi +0
-0@@ -785,6 +785,42 @@ warning: ssh server @code{ssh.example.com:22} does not support fsync
...
docs/qemu-block-drivers.texi warning: ssh server @code{ssh.example.com:22} does not support fsync · line 820
Quoted 3 lines
docs/qemu-block-drivers.texi +3
-0+To check if image locking is active, check the output of "lslocks" command on +host and see if there are locks held by QEMU process on the image file. More +than one bytes could be locked by a QEMU instance, each byte of which reflects
"one byte", without the 's'?
Quoted 1 line
+a perticular permission that are acquired or protected by the running block
"particular", 'e' -> 'a'
Philipp
Re: [Qemu-devel] [PATCH 1/2] docs: Add image locking subsection
Quoted 15 lines · Philipp Hahn
Hello,
Am 23.11.2017 um 14:59 schrieb Fam Zheng:
Quoted 5 lines
docs/qemu-block-drivers.texi +0
-0@@ -785,6 +785,42 @@ warning: ssh server @code{ssh.example.com:22} does not support fsync...
docs/qemu-block-drivers.texi warning: ssh server @code{ssh.example.com:22} does not support fsync · line 820
Quoted 3 lines
docs/qemu-block-drivers.texi +3
-0+To check if image locking is active, check the output of "lslocks" command on +host and see if there are locks held by QEMU process on the image file. More +than one bytes could be locked by a QEMU instance, each byte of which reflects"one byte", without the 's'?
Quoted 4 lines
Quoted 1 line
+a perticular permission that are acquired or protected by the running block
"particular", 'e' -> 'a'
Yes to both. Thanks!
Fam
Re: [Qemu-devel] [PATCH 1/2] docs: Add image locking subsection
In reply to Fam ZhengAm 23.11.2017 um 14:59 hat Fam Zheng geschrieben:
Quoted 17 lines
This documents the image locking feature and explains when and how related options can be used.
Signed-off-by Fam Zheng <[email protected]>--- docs/qemu-block-drivers.texi | 36 ++++++++++++++++++++++++++++++++++++ qemu-doc.texi | 1 + 2 files changed, 37 insertions(+)docs/qemu-block-drivers.texi +0
-0@@ -785,6 +785,42 @@ warning: ssh server @code{ssh.example.com:22} does not support fsync With sufficiently new versions of libssh2 and OpenSSH, @code{fsync} is supported.
docs/qemu-block-drivers.texi warning: ssh server @code{ssh.example.com:22} does not support fsync · line 797
Quoted 10 lines
docs/qemu-block-drivers.texi +10
-0+@node disk_image_locking +@subsection Disk image file locking + +By default, QEMU tries to protect image files from unexpected concurrent +access, as long as it's supported by the block protocol driver and host +operating system. If multiple QEMU processes (including QEMU emulators and +utilities) try to open the same image with conflicting accessing modes, all but +the first one will get an error. + +This feature is currently supported by the file protocol on Linux with Open
s/with/with the/
docs/qemu-block-drivers.texi warning: ssh server @code{ssh.example.com:22} does not support fsync · line 803
Quoted 6 lines
docs/qemu-block-drivers.texi +6
-0+File Descriptor (OFD) locking API, and can be configured to fall back to POSIX +locking if the POSIX host doesn't support Linux OFD locking. + +To explicitly enable image locking, specify "locking=on" in the file protocol +driver options. If OFD locking is not possible, a warning will be printed and +the POSIX locking API will be used. In this case there is risk that the lock
s/risk/a risk/ (native speakers, is this the right correction?)
docs/qemu-block-drivers.texi warning: ssh server @code{ssh.example.com:22} does not support fsync · line 811
Quoted 8 lines
docs/qemu-block-drivers.texi +8
-0+will get silently lost when doing hot plugging and block jobs, due to the +shortcomings of the POSIX locking API. + +QEMU transparently handles lock handover during shared storage migration. For +shared virtual disk images between multiple VMs, the "share-rw" device option +should be used. + +Alternatively, locking can be fully disabled by "locking=off" block device
s/by/with the/
docs/qemu-block-drivers.texi warning: ssh server @code{ssh.example.com:22} does not support fsync · line 812
Quoted 1 line
docs/qemu-block-drivers.texi +1
-0+option. In the command line the option is usually in the form of
Comma after "command line"?
docs/qemu-block-drivers.texi warning: ssh server @code{ssh.example.com:22} does not support fsync · line 818
Quoted 6 lines
docs/qemu-block-drivers.texi +6
-0+"file.locking=off" as the protocol driver is normally placed as a "file" child +under a format driver. For example: + +@code{-blockdev driver=qcow2,file.filename=/path/to/image,file.locking=off,file.driver=file} + +To check if image locking is active, check the output of "lslocks" command on
_the_ "lslocks" command
docs/qemu-block-drivers.texi warning: ssh server @code{ssh.example.com:22} does not support fsync · line 819
Quoted 1 line
docs/qemu-block-drivers.texi +1
-0+host and see if there are locks held by QEMU process on the image file. More
"by a" or "by the", depending on what exactly you want to say
docs/qemu-block-drivers.texi warning: ssh server @code{ssh.example.com:22} does not support fsync · line 820
Quoted 1 line
docs/qemu-block-drivers.texi +1
-0+than one bytes could be locked by a QEMU instance, each byte of which reflects
s/bytes/byte/
docs/qemu-block-drivers.texi warning: ssh server @code{ssh.example.com:22} does not support fsync · line 821
Quoted 1 line
docs/qemu-block-drivers.texi +1
-0+a perticular permission that are acquired or protected by the running block
s/are/is/
docs/qemu-block-drivers.texi warning: ssh server @code{ssh.example.com:22} does not support fsync · line 824
Quoted 3 lines
docs/qemu-block-drivers.texi +2
-0+driver. + @c man end
Kevin
Re: [Qemu-devel] [PATCH 1/2] docs: Add image locking subsection
Quoted 72 lines · Kevin Wolf
Am 23.11.2017 um 14:59 hat Fam Zheng geschrieben:
Quoted 17 lines
This documents the image locking feature and explains when and how related options can be used.
Signed-off-by Fam Zheng <[email protected]>--- docs/qemu-block-drivers.texi | 36 ++++++++++++++++++++++++++++++++++++ qemu-doc.texi | 1 + 2 files changed, 37 insertions(+)docs/qemu-block-drivers.texi +0
-0@@ -785,6 +785,42 @@ warning: ssh server @code{ssh.example.com:22} does not support fsync With sufficiently new versions of libssh2 and OpenSSH, @code{fsync} is supported.docs/qemu-block-drivers.texi warning: ssh server @code{ssh.example.com:22} does not support fsync · line 797
Quoted 10 lines
docs/qemu-block-drivers.texi +10
-0+@node disk_image_locking +@subsection Disk image file locking + +By default, QEMU tries to protect image files from unexpected concurrent +access, as long as it's supported by the block protocol driver and host +operating system. If multiple QEMU processes (including QEMU emulators and +utilities) try to open the same image with conflicting accessing modes, all but +the first one will get an error. + +This feature is currently supported by the file protocol on Linux with Opens/with/with the/
docs/qemu-block-drivers.texi warning: ssh server @code{ssh.example.com:22} does not support fsync · line 803
Quoted 6 lines
docs/qemu-block-drivers.texi +6
-0+File Descriptor (OFD) locking API, and can be configured to fall back to POSIX +locking if the POSIX host doesn't support Linux OFD locking. + +To explicitly enable image locking, specify "locking=on" in the file protocol +driver options. If OFD locking is not possible, a warning will be printed and +the POSIX locking API will be used. In this case there is risk that the locks/risk/a risk/ (native speakers, is this the right correction?)
docs/qemu-block-drivers.texi warning: ssh server @code{ssh.example.com:22} does not support fsync · line 811
Quoted 8 lines
docs/qemu-block-drivers.texi +8
-0+will get silently lost when doing hot plugging and block jobs, due to the +shortcomings of the POSIX locking API. + +QEMU transparently handles lock handover during shared storage migration. For +shared virtual disk images between multiple VMs, the "share-rw" device option +should be used. + +Alternatively, locking can be fully disabled by "locking=off" block devices/by/with the/
docs/qemu-block-drivers.texi warning: ssh server @code{ssh.example.com:22} does not support fsync · line 812
Quoted 1 line
docs/qemu-block-drivers.texi +1
-0+option. In the command line the option is usually in the form ofComma after "command line"?
docs/qemu-block-drivers.texi warning: ssh server @code{ssh.example.com:22} does not support fsync · line 818
Quoted 6 lines
docs/qemu-block-drivers.texi +6
-0+"file.locking=off" as the protocol driver is normally placed as a "file" child +under a format driver. For example: + +@code{-blockdev driver=qcow2,file.filename=/path/to/image,file.locking=off,file.driver=file} + +To check if image locking is active, check the output of "lslocks" command on_the_ "lslocks" command
docs/qemu-block-drivers.texi warning: ssh server @code{ssh.example.com:22} does not support fsync · line 819
Quoted 1 line
docs/qemu-block-drivers.texi +1
-0+host and see if there are locks held by QEMU process on the image file. More"by a" or "by the", depending on what exactly you want to say
docs/qemu-block-drivers.texi warning: ssh server @code{ssh.example.com:22} does not support fsync · line 820
Quoted 1 line
docs/qemu-block-drivers.texi +1
-0+than one bytes could be locked by a QEMU instance, each byte of which reflectss/bytes/byte/
Quoted 7 lines
docs/qemu-block-drivers.texi warning: ssh server @code{ssh.example.com:22} does not support fsync · line 821
Quoted 1 line
docs/qemu-block-drivers.texi +1
-0+a perticular permission that are acquired or protected by the running blocks/are/is/
docs/qemu-block-drivers.texi warning: ssh server @code{ssh.example.com:22} does not support fsync · line 824
Quoted 3 lines
docs/qemu-block-drivers.texi +2
-0+driver. + @c man end
Updating all of them. Thanks!
Fam
PATCH 2/2 qemu-options: Mention locking option of file driver
In reply to Fam Zheng--- qemu-options.hx | 3 +++ 1 file changed, 3 insertions(+)
qemu-options.hx +3 -0
@@ -693,6 +693,9 @@ This is the protocol-level block driver for accessing regular files. The path to the image file in the local filesystem @item aio Specifies the AIO backend (threads/native, default: threads) +@item locking +Specifies whether the image file is protected with Linux OFD / POSIX locks. +(auto/on/off, default: auto) @end table Example: @example
Signature · 1 line
2.14.3
Re: [Qemu-devel] [PATCH 2/2] qemu-options: Mention locking option of file driver
Am 23.11.2017 um 14:59 hat Fam Zheng geschrieben:
Quoted 10 lines
Signed-off-by Fam Zheng <[email protected]>--- qemu-options.hx | 3 +++ 1 file changed, 3 insertions(+)qemu-options.hx +0
-0
qemu-options.hx This is the protocol-level block driver for accessing regular files. · line 698
Quoted 6 lines
qemu-options.hx +3
-0@@ -693,6 +693,9 @@ This is the protocol-level block driver for accessing regular files. The path to the image file in the local filesystem @item aio Specifies the AIO backend (threads/native, default: threads) +@item locking +Specifies whether the image file is protected with Linux OFD / POSIX locks. +(auto/on/off, default: auto)
Maybe "should be protected" would be better than "is protected"?
Do we want to explain what "auto" means?
Kevin
Re: [Qemu-devel] [PATCH 2/2] qemu-options: Mention locking option of file driver
Quoted 6 lines · Kevin Wolf
Am 23.11.2017 um 14:59 hat Fam Zheng geschrieben:
Quoted 5 lines
Signed-off-by Fam Zheng <[email protected]>--- qemu-options.hx | 3 +++ 1 file changed, 3 insertions(+)
Quoted 13 lines
qemu-options.hx This is the protocol-level block driver for accessing regular files. · line 698
Quoted 11 lines
qemu-options.hx +3
-0@@ -693,6 +693,9 @@ This is the protocol-level block driver for accessing regular files. The path to the image file in the local filesystem @item aio Specifies the AIO backend (threads/native, default: threads) +@item locking +Specifies whether the image file is protected with Linux OFD / POSIX locks. +(auto/on/off, default: auto)Maybe "should be protected" would be better than "is protected"?
Yes.
Quoted 2 lines
Do we want to explain what "auto" means?
Will add that.
Fam