mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
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>
This commit is contained in:
parent
3e8c2e5705
commit
43de7e2de0
4 changed files with 173 additions and 62 deletions
|
@ -1492,6 +1492,44 @@ Example:
|
|||
"format": "qcow2" } }
|
||||
<- { "return": {} }
|
||||
|
||||
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
|
||||
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue