summaryrefslogtreecommitdiffstats
path: root/qmp-commands.hx
diff options
context:
space:
mode:
authorAlberto Garcia <berto@igalia.com>2015-10-26 14:27:16 +0200
committerKevin Wolf <kwolf@redhat.com>2015-11-11 16:25:47 +0100
commit43de7e2de07093e47c7f25386aff280875dc3c62 (patch)
tree28759e468f75d58f1d64e4c6ceeb5437b4f7d687 /qmp-commands.hx
parent3e8c2e57056614933fc5eb022e1d6d0f28071b44 (diff)
downloadhqemu-43de7e2de07093e47c7f25386aff280875dc3c62.zip
hqemu-43de7e2de07093e47c7f25386aff280875dc3c62.tar.gz
block: add a 'blockdev-snapshot' QMP command
One of the limitations of the 'blockdev-snapshot-sync' command is that it does not allow passing BlockdevOptions to the newly created snapshots, so they are always opened using the default values. Extending the command to allow passing options is not a practical solution because there is overlap between those options and some of the existing parameters of the command. This patch introduces a new 'blockdev-snapshot' command with a simpler interface: it just takes two references to existing block devices that will be used as the source and target for the snapshot. Since the main difference between the two commands is that one of them creates and opens the target image, while the other uses an already opened one, the bulk of the implementation is shared. Signed-off-by: Alberto Garcia <berto@igalia.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'qmp-commands.hx')
-rw-r--r--qmp-commands.hx38
1 files changed, 38 insertions, 0 deletions
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 39d6e25..5fd6f9c 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -1495,6 +1495,44 @@ Example:
EQMP
{
+ .name = "blockdev-snapshot",
+ .args_type = "node:s,overlay:s",
+ .mhandler.cmd_new = qmp_marshal_blockdev_snapshot,
+ },
+
+SQMP
+blockdev-snapshot
+-----------------
+Since 2.5
+
+Create a snapshot, by installing 'node' as the backing image of
+'overlay'. Additionally, if 'node' is associated with a block
+device, the block device changes to using 'overlay' as its new active
+image.
+
+Arguments:
+
+- "node": device that will have a snapshot created (json-string)
+- "overlay": device that will have 'node' as its backing image (json-string)
+
+Example:
+
+-> { "execute": "blockdev-add",
+ "arguments": { "options": { "driver": "qcow2",
+ "node-name": "node1534",
+ "file": { "driver": "file",
+ "filename": "hd1.qcow2" },
+ "backing": "" } } }
+
+<- { "return": {} }
+
+-> { "execute": "blockdev-snapshot", "arguments": { "node": "ide-hd0",
+ "overlay": "node1534" } }
+<- { "return": {} }
+
+EQMP
+
+ {
.name = "blockdev-snapshot-internal-sync",
.args_type = "device:B,name:s",
.mhandler.cmd_new = qmp_marshal_blockdev_snapshot_internal_sync,
OpenPOWER on IntegriCloud