aboutsummaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
authorBenoƮt Canet <benoit.canet@irqsave.net>2014-06-16 12:00:55 +0200
committerKevin Wolf <kwolf@redhat.com>2014-06-27 14:18:18 +0200
commit4c828dc61a0d729ae9bfa6fdee55558314135737 (patch)
tree96846720549c13f20e3c2d63123d39072aa4e764 /blockdev.c
parentcf29a570a7aa7abab66bf256fdf9540873590811 (diff)
downloadqemu-4c828dc61a0d729ae9bfa6fdee55558314135737.zip
qemu-4c828dc61a0d729ae9bfa6fdee55558314135737.tar.gz
qemu-4c828dc61a0d729ae9bfa6fdee55558314135737.tar.bz2
block: Add node-name argument to drive-mirror
This new argument can be used to specify the node-name of the new mirrored BDS. Signed-off-by: Benoit Canet <benoit@irqsave.net> Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/blockdev.c b/blockdev.c
index e8bfa3c..9433012 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2099,6 +2099,7 @@ BlockDeviceInfoList *qmp_query_named_block_nodes(Error **errp)
void qmp_drive_mirror(const char *device, const char *target,
bool has_format, const char *format,
+ bool has_node_name, const char *node_name,
enum MirrorSyncMode sync,
bool has_mode, enum NewImageMode mode,
bool has_speed, int64_t speed,
@@ -2112,6 +2113,7 @@ void qmp_drive_mirror(const char *device, const char *target,
BlockDriverState *source, *target_bs;
BlockDriver *drv = NULL;
Error *local_err = NULL;
+ QDict *options = NULL;
int flags;
int64_t size;
int ret;
@@ -2213,12 +2215,17 @@ void qmp_drive_mirror(const char *device, const char *target,
return;
}
+ if (has_node_name) {
+ options = qdict_new();
+ qdict_put(options, "node-name", qstring_from_str(node_name));
+ }
+
/* Mirroring takes care of copy-on-write using the source's backing
* file.
*/
target_bs = NULL;
- ret = bdrv_open(&target_bs, target, NULL, NULL, flags | BDRV_O_NO_BACKING,
- drv, &local_err);
+ ret = bdrv_open(&target_bs, target, NULL, options,
+ flags | BDRV_O_NO_BACKING, drv, &local_err);
if (ret < 0) {
error_propagate(errp, local_err);
return;