]> Git Repo - qemu.git/commitdiff
block: Accept node-name for blockdev-mirror
authorKevin Wolf <[email protected]>
Thu, 23 Jun 2016 12:20:24 +0000 (14:20 +0200)
committerKevin Wolf <[email protected]>
Mon, 5 Sep 2016 17:06:47 +0000 (19:06 +0200)
In order to remove the necessity to use BlockBackend names in the
external API, we want to allow node-names everywhere. This converts
blockdev-mirror to accept a node-name without lifting the restriction
that we're operating at a root node.

Signed-off-by: Kevin Wolf <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Alberto Garcia <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
blockdev.c
qapi/block-core.json
qmp-commands.hx

index 46beafdfad14f7682d5fea2824e9d16211547507..ccff1f7d05c62bb553a95bf002b5a744ddbf9654 100644 (file)
@@ -3627,21 +3627,13 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id,
                          Error **errp)
 {
     BlockDriverState *bs;
-    BlockBackend *blk;
     BlockDriverState *target_bs;
     AioContext *aio_context;
     BlockMirrorBackingMode backing_mode = MIRROR_LEAVE_BACKING_CHAIN;
     Error *local_err = NULL;
 
-    blk = blk_by_name(device);
-    if (!blk) {
-        error_setg(errp, "Device '%s' not found", device);
-        return;
-    }
-    bs = blk_bs(blk);
-
+    bs = qmp_get_root_bs(device, errp);
     if (!bs) {
-        error_setg(errp, "Device '%s' has no media", device);
         return;
     }
 
index 53f46b625cea39fe76ed8c9ba9385d734e1eb22b..bcb37db5af2f1e69e32b1005f6aac179670d07d3 100644 (file)
 # @job-id: #optional identifier for the newly-created block job. If
 #          omitted, the device name will be used. (Since 2.7)
 #
-# @device: the name of the device whose writes should be mirrored.
+# @device: The device name or node-name of a root node whose writes should be
+#          mirrored.
 #
 # @target: the id or node-name of the block device to mirror to. This mustn't be
 #          attached to guest.
index 2077585dd383f484f93064c2eb6a8cae2a007d89..034d51718c56dc25ddec1aea6867eeada62ed574 100644 (file)
@@ -1747,7 +1747,8 @@ Arguments:
 
 - "job-id": Identifier for the newly-created block job. If omitted,
             the device name will be used. (json-string, optional)
-- "device": device name to operate on (json-string)
+- "device": The device name or node-name of a root node whose writes should be
+            mirrored (json-string)
 - "target": device name to mirror to (json-string)
 - "replaces": the block driver node name to replace when finished
               (json-string, optional)
This page took 0.038357 seconds and 4 git commands to generate.