Features/Block/Rebase

From QEMU
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Summary

Add dynamic rebase of running disk

Owner

Description

qapi-schema.json

##
# @block_rebase
#
# This command will change backing file of disk.
#
# Since: 2.x
##
{ 'command': 'block_rebase',
  'data' : { 'device' : 'str',
             'file' : 'str' } }


qmp-command.hx

    {
        .name       = "block_rebase",
        .args_type  = "device:s,file:s",
        .mhandler.cmd_new = qmp_marshal_input_block_rebase,
    },

SQMP
block_rebase
------------

Rebase a block image file in another location while a guest is running.

Arguments:

- "device": the device's ID, must be unique
- "file": new backing file path

Example:
-> { "execute": "block_rebase", "arguments": { "device": "ide0-hd0", "file": "/storage/new_base.img" }}
<- { "return": {} }
EQMP

hmp-command.hx

    {
        .name       = "block_rebase",
        .args_type  = "drive:s,file:s",
        .params     = "drive file",
        .help       = "rebase drive's backing file",
        .mhandler.cmd = hmp_block_rebase,
    },

STEXI
@item block_rebase
@findex block_rebase
Rebase drive's backing file.
ETEXI

Usage example

Original Disk

Qcow2.png

New rebased Disk

Rebase.png

QMP command

{ "execute": "block_rebase", "arguments": { "device": "ide0-hd0", "file": "/storage/new_base.img" } }

HMP command

(qemu) block_rebase ide0-hd0 /storage/new_base.img

Detailed Smmary

Links

Status