From 43de7e2de07093e47c7f25386aff280875dc3c62 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Date: Mon, 26 Oct 2015 14:27:16 +0200 Subject: 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 Reviewed-by: Max Reitz Signed-off-by: Kevin Wolf --- qapi/block-core.json | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'qapi/block-core.json') diff --git a/qapi/block-core.json b/qapi/block-core.json index f592adc8df..083d2cd346 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -704,6 +704,21 @@ 'snapshot-file': 'str', '*snapshot-node-name': 'str', '*format': 'str', '*mode': 'NewImageMode' } } +## +# @BlockdevSnapshot +# +# @node: device or node name that will have a snapshot created. +# +# @overlay: reference to the existing block device that will become +# the overlay of @node, as part of creating the snapshot. +# It must not have a current backing file (this can be +# achieved by passing "backing": "" to blockdev-add). +# +# Since 2.5 +## +{ 'struct': 'BlockdevSnapshot', + 'data': { 'node': 'str', 'overlay': 'str' } } + ## # @DriveBackup # @@ -800,6 +815,19 @@ { 'command': 'blockdev-snapshot-sync', 'data': 'BlockdevSnapshotSync' } + +## +# @blockdev-snapshot +# +# Generates a snapshot of a block device. +# +# For the arguments, see the documentation of BlockdevSnapshot. +# +# Since 2.5 +## +{ 'command': 'blockdev-snapshot', + 'data': 'BlockdevSnapshot' } + ## # @change-backing-file # -- cgit v1.2.3