From 6d4a2b3a47959f02e7f307f50396e70e8464f95e Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Mon, 24 Jan 2011 13:32:33 +0100 Subject: block: add block_resize monitor command Add a monitor command that allows resizing of block devices while qemu is running. It uses the existing bdrv_truncate method already used by qemu-img to do it's work. Compared to qemu-img the size parsing is very simplicistic, but I think having a properly numering object is more useful for non-humand monitor users than having the units and relative resize parsing. For SCSI devices the new size can be updated in Linux guests by doing the following shell command: echo > /sys/class/scsi_device/0:0:0:0/device/rescan For ATA devices I don't know of a way to update the block device size in Linux system, and for virtio-blk the next two patches will provide an automatic update of the size when this command is issued on the host. Signed-off-by: Christoph Hellwig Signed-off-by: Kevin Wolf --- qmp-commands.hx | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'qmp-commands.hx') diff --git a/qmp-commands.hx b/qmp-commands.hx index 56c4d8bc47..9f79f5fdf2 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -601,6 +601,34 @@ Example: -> { "execute": "netdev_del", "arguments": { "id": "netdev1" } } <- { "return": {} } + +EQMP + + { + .name = "block_resize", + .args_type = "device:B,size:o", + .params = "device size", + .help = "resize a block image", + .user_print = monitor_user_noop, + .mhandler.cmd_new = do_block_resize, + }, + +SQMP +block_resize +------------ + +Resize a block image while a guest is running. + +Arguments: + +- "device": the device's ID, must be unique (json-string) +- "size": new size + +Example: + +-> { "execute": "block_resize", "arguments": { "device": "scratch", "size": 1073741824 } } +<- { "return": {} } + EQMP { -- cgit v1.2.3