Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Open readonly connection when server is readonly.
Eric Blake patched qemu so it is no longer possible to open a writeable connection from qemu to an NBD server which has advertized that it supports only readonly connections: commit 1104d83c726d2b20f9cec7b99ab3570a2fdbd46d Author: Eric Blake <eblake@redhat.com> Date: Wed Nov 8 15:56:58 2017 -0600 nbd-client: Refuse read-only client with BDRV_O_RDWR The NBD spec says that clients should not try to write/trim to an export advertised as read-only by the server. But we failed to check that, and would allow the block layer to use NBD with BDRV_O_RDWR even when the server is read-only, which meant we were depending on the server sending a proper EPERM failure for various commands, and also exposes a leaky abstraction: using qemu-io in read-write mode would succeed on 'w -z 0 0' because of local short-circuiting logic, but 'w 0 0' would send a request over the wire (where it then depends on the server, and fails at least for qemu-nbd but might pass for other NBD implementations). With this patch, a client MUST request read-only mode to access a server that is doing a read-only export, or else it will get a message like: can't open device nbd://localhost:10809/foo: request for write access conflicts with read-only export Therefore we need to open such connections readonly. There is a further problem that libguestfs was broken because it tried to add the locking=off flag to NBD connections, so that requires the following fix to libguestfs: https://bugzilla.redhat.com/show_bug.cgi?id=1516094 libguestfs/libguestfs@35320dd Thanks: Eric Blake and Lars Seipel.
- Loading branch information