qemu-e2k/qapi
Kevin Wolf e35bdc123a block: Add auto-read-only option
If a management application builds the block graph node by node, the
protocol layer doesn't inherit its read-only option from the format
layer any more, so it must be set explicitly.

Backing files should work on read-only storage, but at the same time, a
block job like commit should be able to reopen them read-write if they
are on read-write storage. However, without option inheritance, reopen
only changes the read-only option for the root node (typically the
format layer), but not the protocol layer, so reopening fails (the
format layer wants to get write permissions, but the protocol layer is
still read-only).

A simple workaround for the problem in the management tool would be to
open the protocol layer always read-write and to make only the format
layer read-only for backing files. However, sometimes the file is
actually stored on read-only storage and we don't know whether the image
can be opened read-write (for example, for NBD it depends on the server
we're trying to connect to). This adds an option that makes QEMU try to
open the image read-write, but allows it to degrade to a read-only mode
without returning an error.

The documentation for this option is consciously phrased in a way that
allows QEMU to switch to a better model eventually: Instead of trying
when the image is first opened, making the read-only flag dynamic and
changing it automatically whenever the first BLK_PERM_WRITE user is
attached or the last one is detached would be much more useful
behaviour.

Unfortunately, this more useful behaviour is also a lot harder to
implement, and libvirt needs a solution now before it can switch to
-blockdev, so let's start with this easier approach for now.

Instead of adding a new auto-read-only option, turning the existing
read-only into an enum (with a bool alternate for compatibility) was
considered, but it complicated the implementation to the point that it
didn't seem to be worth it.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2018-11-05 15:09:55 +01:00
..
block-core.json block: Add auto-read-only option 2018-11-05 15:09:55 +01:00
block.json pr-manager-helper: report event on connection/disconnection 2018-06-28 19:05:35 +02:00
char.json chardev: Add websocket support 2018-11-01 12:12:58 +04:00
common.json Record history of ppcemb target in common.json 2018-09-25 11:12:22 +10:00
crypto.json qapi: remove empty flat union branches and types 2018-06-22 16:33:46 +02:00
introspect.json json: Update references to RFC 7159 to RFC 8259 2018-08-24 20:27:14 +02:00
job.json qapi/job: The next release will be 3.0 2018-06-29 14:20:56 +02:00
Makefile.objs
migration.json qapi: Fix COLOStatus and query-colo-status since version 2018-10-31 09:38:59 +00:00
misc.json memory-device: introduce separate config option 2018-10-24 06:44:59 -03:00
net.json slirp: Implement RFC2132 TFTP server name 2018-10-21 21:24:55 +02:00
opts-visitor.c
qapi-clone-visitor.c
qapi-dealloc-visitor.c
qapi-schema.json job: Introduce qapi/job.json 2018-05-23 14:30:51 +02:00
qapi-util.c
qapi-visit-core.c
qmp-dispatch.c qmp: constify qmp_is_oob() 2018-08-30 16:08:47 +02:00
qmp-event.c qmp: Switch timestamp_put() to qdict_from_jsonf_nofail() 2018-07-03 23:18:56 +02:00
qmp-registry.c
qobject-input-visitor.c qjson: Have qobject_from_json() & friends reject empty and blank 2018-08-24 20:26:37 +02:00
qobject-output-visitor.c qobject: Modify qobject_ref() to return obj 2018-05-04 08:27:53 +02:00
rocker.json
run-state.json qapi: introduce new cmd option "allow-preconfig" 2018-05-30 13:19:09 -03:00
sockets.json
string-input-visitor.c
string-output-visitor.c
tpm.json
trace-events trace: forbid floating point types 2018-06-27 11:09:29 +01:00
trace.json
transaction.json qapi: add transaction support for x-block-dirty-bitmap-merge 2018-10-29 16:23:15 -04:00
ui.json gtk: add zoom-to-fit to gtk options. 2018-10-01 11:29:03 +02:00