[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 22/28] block: Allow omitting the 'backing' option in
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 22/28] block: Allow omitting the 'backing' option in certain cases |
Date: |
Tue, 12 Mar 2019 18:30:19 +0100 |
From: Alberto Garcia <address@hidden>
Of all options of type BlockdevRef used to specify children in
BlockdevOptions, 'backing' is the only one that is optional.
For "x-blockdev-reopen" we want that if an option is omitted then it
must be reset to its default value. The default value of 'backing'
means that QEMU opens the backing file specified in the image
metadata, but this is not something that we want to support for the
reopen operation.
Because of this the 'backing' option has to be specified during
reopen, pointing to the existing backing file if we want to keep it,
or pointing to a different one (or NULL) if we want to replace it (to
be implemented in a subsequent patch).
In order to simplify things a bit and not to require that the user
passes the 'backing' option to every single block device even when
it's clearly not necessary, this patch allows omitting this option if
the block device being reopened doesn't have a backing file attached
_and_ no default backing file is specified in the image metadata.
Signed-off-by: Alberto Garcia <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/block.c b/block.c
index 9698f2ad44..c043f5eadd 100644
--- a/block.c
+++ b/block.c
@@ -3434,7 +3434,13 @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_state,
BlockReopenQueue *queue,
drv_prepared = true;
- if (drv->supports_backing && reopen_state->backing_missing) {
+ /*
+ * We must provide the 'backing' option if the BDS has a backing
+ * file or if the image file has a backing file name as part of
+ * its metadata. Otherwise the 'backing' option can be omitted.
+ */
+ if (drv->supports_backing && reopen_state->backing_missing &&
+ (backing_bs(reopen_state->bs) || reopen_state->bs->backing_file[0])) {
error_setg(errp, "backing is missing for '%s'",
reopen_state->bs->node_name);
ret = -EINVAL;
--
2.20.1
- [Qemu-block] [PULL 08/28] block: Make permission changes in reopen less wrong, (continued)
- [Qemu-block] [PULL 08/28] block: Make permission changes in reopen less wrong, Kevin Wolf, 2019/03/12
- [Qemu-block] [PULL 12/28] file-posix: Lock new fd in raw_reopen_prepare(), Kevin Wolf, 2019/03/12
- [Qemu-block] [PULL 13/28] file-posix: Prepare permission code for fd switching, Kevin Wolf, 2019/03/12
- [Qemu-block] [PULL 16/28] block: Allow freezing BdrvChild links, Kevin Wolf, 2019/03/12
- [Qemu-block] [PULL 17/28] block: Freeze the backing chain for the duration of the commit job, Kevin Wolf, 2019/03/12
- [Qemu-block] [PULL 18/28] block: Freeze the backing chain for the duration of the mirror job, Kevin Wolf, 2019/03/12
- [Qemu-block] [PULL 19/28] block: Freeze the backing chain for the duration of the stream job, Kevin Wolf, 2019/03/12
- [Qemu-block] [PULL 20/28] block: Add 'keep_old_opts' parameter to bdrv_reopen_queue(), Kevin Wolf, 2019/03/12
- [Qemu-block] [PULL 22/28] block: Allow omitting the 'backing' option in certain cases,
Kevin Wolf <=
- [Qemu-block] [PULL 21/28] block: Handle child references in bdrv_reopen_queue(), Kevin Wolf, 2019/03/12
- [Qemu-block] [PULL 24/28] block: Add a 'mutable_opts' field to BlockDriver, Kevin Wolf, 2019/03/12
- [Qemu-block] [PULL 23/28] block: Allow changing the backing file on reopen, Kevin Wolf, 2019/03/12
- [Qemu-block] [PULL 26/28] block: Remove the AioContext parameter from bdrv_reopen_multiple(), Kevin Wolf, 2019/03/12
- [Qemu-block] [PULL 27/28] block: Add an 'x-blockdev-reopen' QMP command, Kevin Wolf, 2019/03/12
- [Qemu-block] [PULL 25/28] block: Add bdrv_reset_options_allowed(), Kevin Wolf, 2019/03/12
- [Qemu-block] [PULL 28/28] qemu-iotests: Test the x-blockdev-reopen QMP command, Kevin Wolf, 2019/03/12
- Re: [Qemu-block] [PULL 00/28] Block layer patches, Peter Maydell, 2019/03/13