[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 19/37] block: support passing 'backing': '' to 'block
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 19/37] block: support passing 'backing': '' to 'blockdev-add' |
Date: |
Thu, 5 Nov 2015 19:17:47 +0100 |
From: Alberto Garcia <address@hidden>
Passing an empty string allows opening an image but not its backing
file. This was already described in the API documentation, only the
implementation was missing.
This is useful for creating snapshots using images opened with
blockdev-add, since they are not supposed to have a backing image
before the operation.
Signed-off-by: Alberto Garcia <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/block.c b/block.c
index a99e6d8..3493501 100644
--- a/block.c
+++ b/block.c
@@ -1393,6 +1393,7 @@ static int bdrv_open_inherit(BlockDriverState **pbs,
const char *filename,
BlockDriverState *bs;
BlockDriver *drv = NULL;
const char *drvname;
+ const char *backing;
Error *local_err = NULL;
int snapshot_flags = 0;
@@ -1460,6 +1461,12 @@ static int bdrv_open_inherit(BlockDriverState **pbs,
const char *filename,
assert(drvname || !(flags & BDRV_O_PROTOCOL));
+ backing = qdict_get_try_str(options, "backing");
+ if (backing && *backing == '\0') {
+ flags |= BDRV_O_NO_BACKING;
+ qdict_del(options, "backing");
+ }
+
bs->open_flags = flags;
bs->options = options;
options = qdict_clone_shallow(options);
--
1.8.3.1
- [Qemu-block] [PULL 12/37] qmp: Introduce blockdev-change-medium, (continued)
- [Qemu-block] [PULL 12/37] qmp: Introduce blockdev-change-medium, Kevin Wolf, 2015/11/05
- [Qemu-block] [PULL 14/37] blockdev: read-only-mode for blockdev-change-medium, Kevin Wolf, 2015/11/05
- [Qemu-block] [PULL 15/37] hmp: Add read-only-mode option to change command, Kevin Wolf, 2015/11/05
- [Qemu-block] [PULL 17/37] block: check for existing device IDs in external_snapshot_prepare(), Kevin Wolf, 2015/11/05
- [Qemu-block] [PULL 09/37] blockdev: Implement eject with basic operations, Kevin Wolf, 2015/11/05
- [Qemu-block] [PULL 13/37] hmp: Use blockdev-change-medium for change command, Kevin Wolf, 2015/11/05
- [Qemu-block] [PULL 20/37] block: add a 'blockdev-snapshot' QMP command, Kevin Wolf, 2015/11/05
- [Qemu-block] [PULL 16/37] iotests: Add test for change-related QMP commands, Kevin Wolf, 2015/11/05
- [Qemu-block] [PULL 21/37] block: add tests for the 'blockdev-snapshot' command, Kevin Wolf, 2015/11/05
- [Qemu-block] [PULL 18/37] block: rename BlockdevSnapshot to BlockdevSnapshotSync, Kevin Wolf, 2015/11/05
- [Qemu-block] [PULL 19/37] block: support passing 'backing': '' to 'blockdev-add',
Kevin Wolf <=
- [Qemu-block] [PULL 22/37] commit: reopen overlay_bs before base, Kevin Wolf, 2015/11/05
- [Qemu-block] [PULL 23/37] qemu-iotests: Test the reopening of overlay_bs in 'block-commit', Kevin Wolf, 2015/11/05
- [Qemu-block] [PULL 25/37] qemu-img: add check for zero-length job len, Kevin Wolf, 2015/11/05
- [Qemu-block] [PULL 24/37] qcow2: avoid misaligned 64bit bswap, Kevin Wolf, 2015/11/05
- [Qemu-block] [PULL 30/37] block: test 'blockdev-snapshot' using a file BDS as the overlay, Kevin Wolf, 2015/11/05
- [Qemu-block] [PULL 26/37] throttle: Check for pending requests in throttle_group_unregister_bs(), Kevin Wolf, 2015/11/05
- [Qemu-block] [PULL 27/37] throttle: Use bs->throttle_state instead of bs->io_limits_enabled, Kevin Wolf, 2015/11/05
- [Qemu-block] [PULL 28/37] block: Disallow snapshots if the overlay doesn't support backing files, Kevin Wolf, 2015/11/05
- [Qemu-block] [PULL 29/37] block: Remove inner quotation marks in iotest 085, Kevin Wolf, 2015/11/05
- [Qemu-block] [PULL 32/37] qemu-iotests: fix -valgrind option for check, Kevin Wolf, 2015/11/05