qemu/include
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 block: Add auto-read-only option 2018-11-05 15:09:55 +01:00
chardev chardev: mark the calls that allow an implicit mux monitor 2018-10-03 14:45:05 +04:00
crypto tests: call qcrypto_init instead of gnutls_global_init 2018-07-24 17:33:39 +01:00
disas target/mips: Add disassembler support for nanoMIPS 2018-10-25 22:13:33 +02:00
exec cputlb: Remove tlb_c.pending_flushes 2018-10-31 12:16:39 +00:00
fpu softfloat: Don't execute divdeu without power7 2018-11-04 10:04:40 +00:00
hw hw/arm: versal: Add a model of Xilinx Versal SoC 2018-11-02 14:10:53 +00:00
io qio: non-default context for TLS handshake 2018-03-06 10:19:07 +00:00
libdecnumber
migration COLO: Remove colo_state migration struct 2018-10-19 11:15:03 +08:00
monitor qdev-monitor: print help to stdout 2018-10-05 16:14:22 +04:00
net filter: Add handle_event method for NetFilterClass 2018-10-19 11:15:03 +08:00
qapi error: Fix use of error_prepend() with &error_fatal, &error_abort 2018-10-19 14:51:34 +02:00
qemu dirty-bitmap: make it possible to restore bitmap after merge 2018-10-29 16:23:15 -04:00
qom cputlb: Move cpu->pending_tlb_flush to env->tlb_c.pending_flush 2018-10-31 12:16:02 +00:00
scsi pr-manager: add query-pr-managers QMP command 2018-06-28 19:05:35 +02:00
standard-headers linux-headers: update 2018-10-12 11:32:18 +02:00
sysemu block: change some function return type to bool 2018-11-05 15:09:54 +01:00
ui ui: Convert vnc_display_init(), init_keyboard_layout() to Error 2018-10-19 14:51:34 +02:00
elf.h elf: Define MIPS_ABI_FP_UNKNOWN macro 2018-10-29 15:47:32 +01:00
glib-compat.h glib: enforce the minimum required version and warn about old APIs 2018-06-29 12:22:28 +01:00
qemu-common.h qemu-common.h: update copyright date to 2018 2018-10-16 17:52:06 +02:00
qemu-io.h qemu-io: Let command functions return error code 2018-06-11 16:18:45 +02:00
trace-tcg.h