[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL v2 17/40] block: check for existing device IDs in ext
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL v2 17/40] block: check for existing device IDs in external_snapshot_prepare() |
Date: |
Tue, 10 Nov 2015 15:09:17 +0100 |
From: Alberto Garcia <address@hidden>
The 'snapshot-node-name' parameter of blockdev-snapshot-sync allows
setting the node name of the image that is going to be created.
Before creating the image, external_snapshot_prepare() checks that the
name is not already being used. The check is however incomplete since
it only considers existing node names, but node names must not clash
with device IDs either because they share the same namespace.
If the user attempts to create a snapshot using the name of an
existing device for the 'snapshot-node-name' parameter the operation
will eventually fail, but only after the new image has been created.
This patch replaces bdrv_find_node() with bdrv_lookup_bs() to extend
the check to existing device IDs, and thus detect possible name
clashes before the new image is created.
Signed-off-by: Alberto Garcia <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
blockdev.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index 34f6e5b..0c6c2a7 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1579,8 +1579,9 @@ static void external_snapshot_prepare(BlkTransactionState
*common,
return;
}
- if (has_snapshot_node_name && bdrv_find_node(snapshot_node_name)) {
- error_setg(errp, "New snapshot node name already existing");
+ if (has_snapshot_node_name &&
+ bdrv_lookup_bs(snapshot_node_name, snapshot_node_name, NULL)) {
+ error_setg(errp, "New snapshot node name already in use");
return;
}
--
1.8.3.1
- [Qemu-block] [PULL v2 06/40] blockdev: Add blockdev-close-tray, (continued)
- [Qemu-block] [PULL v2 06/40] blockdev: Add blockdev-close-tray, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 09/40] blockdev: Implement eject with basic operations, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 08/40] blockdev: Add blockdev-insert-medium, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 07/40] blockdev: Add blockdev-remove-medium, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 11/40] block: Inquire tray state before tray-moved events, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 10/40] blockdev: Implement change with basic operations, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 12/40] qmp: Introduce blockdev-change-medium, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 13/40] hmp: Use blockdev-change-medium for change command, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 15/40] hmp: Add read-only-mode option to change command, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 14/40] blockdev: read-only-mode for blockdev-change-medium, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 17/40] block: check for existing device IDs in external_snapshot_prepare(),
Kevin Wolf <=
- [Qemu-block] [PULL v2 18/40] block: rename BlockdevSnapshot to BlockdevSnapshotSync, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 19/40] block: support passing 'backing': '' to 'blockdev-add', Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 16/40] iotests: Add test for change-related QMP commands, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 20/40] block: add a 'blockdev-snapshot' QMP command, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 21/40] block: add tests for the 'blockdev-snapshot' command, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 22/40] commit: reopen overlay_bs before base, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 23/40] qemu-iotests: Test the reopening of overlay_bs in 'block-commit', Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 26/40] throttle: Check for pending requests in throttle_group_unregister_bs(), Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 24/40] qcow2: avoid misaligned 64bit bswap, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 27/40] throttle: Use bs->throttle_state instead of bs->io_limits_enabled, Kevin Wolf, 2015/11/10